Commit 4d465ec8 authored by Wayne Stambaugh's avatar Wayne Stambaugh

Configuration and compile documentation improvements.

* Improve the stable and testing build version option logic.
* Use CMake FindPythonInterp to configure the Python interpreter.
* Use Python interpreter to determine the system Python module install
  path if not already defined on the command line.
* Add header symbol checks for asinh(), acosh(), and atanh().
* Add test source to check for isinf() which can be defined as a C++template.
* Replace conditional compile on windows systems for aXXXh() with CMake
  configuration tests.
* A few minor MSVC compile fixes.
* Fix incorrect python environment string in fixswigimports.py
* Create a separate document for KiCad CMake build options.
* Create a separate how to compile KiCad on Windows document.
parent 00fafe7d
......@@ -61,29 +61,22 @@ option(KICAD_SCRIPTING_WXPYTHON
# PYTHON_EXECUTABLE can be defined when invoking cmake
# ( use -DPYTHON_EXECUTABLE=<python path>/python.exe or python2 )
# when not defined by user, the default is python.exe under Windows and python2 for others
# python binary filee should be is exec path.
# python binary file should be is exec path.
#Set version option (stable or testing)
if (KICAD_STABLE_VERSION )
if ( KICAD_TESTING_VERSION )
message( FATAL_ERROR
"Please set to ON only one option KICAD_TESTING_VERSION or KICAD_STABLE_VERSION" )
endif( KICAD_TESTING_VERSION )
if(KICAD_STABLE_VERSION AND KICAD_TESTING_VERSION )
message(FATAL_ERROR "Only one KiCad build version option KICAD_TESTING_VERSION or KICAD_STABLE_VERSION can be set to ON")
elif(NOT KICAD_STABLE_VERSION AND NOT KICAD_TESTING_VERSION)
message(FATAL_ERROR "Either KiCad build version option KICAD_TESTING_VERSION or KICAD_STABLE_VERSION must be set to ON")
elif(KICAD_STABLE_VERSION)
add_definitions(-DKICAD_STABLE_VERSION)
message( "Build stable version of Kicad" )
else (KICAD_STABLE_VERSION )
if (KICAD_TESTING_VERSION )
add_definitions(-DKICAD_TESTING_VERSION)
message( "Build testing (unstable) version of Kicad" )
else (KICAD_TESTING_VERSION )
message( "Please set to ON one option of KICAD_TESTING_VERSION or KICAD_STABLE_VERSION" )
message( "When calling cmake add option -DKICAD_STABLE_VERSION=ON" )
message( "or add option -DKICAD_TESTING_VERSION=ON" )
message( FATAL_ERROR "one option of KICAD_TESTING_VERSION or KICAD_STABLE_VERSION must be defined" )
endif(KICAD_TESTING_VERSION )
endif(KICAD_STABLE_VERSION )
message( "Build stable version of KiCad")
else(KICAD_STABLE_VERSION AND KICAD_TESTING_VERSION)
add_definitions(-DKICAD_TESTING_VERSION)
message("Build testing (unstable) version of KiCad")
endif(KICAD_STABLE_VERSION AND KICAD_TESTING_VERSION)
#================================================
......@@ -291,22 +284,30 @@ if(WIN32 AND USE_WX_GRAPHICS_CONTEXT)
endif(WIN32 AND USE_WX_GRAPHICS_CONTEXT)
# Find Python and other scripting resources
if (KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES)
if( "${PYTHON_EXECUTABLE}" STREQUAL "" )
if(WIN32)
SET( PYTHON_EXECUTABLE "python.exe" )
else(WIN32)
SET( PYTHON_EXECUTABLE "python2" )
endif(WIN32)
endif()
execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "import sys;print\"%s.%s\"%sys.version_info[0:2]" OUTPUT_VARIABLE PYTHON_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE)
set(PYTHON_DEST "lib/python${PYTHON_VERSION}/dist-packages" )
find_package(PythonLibs)
include_directories(${PYTHON_INCLUDE_PATH}
./scripting)
if(KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES)
set(PythonInterp_FIND_VERSION)
find_package(PythonInterp)
check_find_package_result(PYTHONINTERP_FOUND "Python Interpreter")
# Get the correct Python site package install path from the Python interpreter found by
# FindPythonInterp unless the user specifically defined a custom path.
if(NOT PYTHON_SITE_PACKAGE_PATH)
execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "import distutils.sysconfig;print\"%s\"%distutils.sysconfig.get_python_lib()"
OUTPUT_VARIABLE PYTHON_SITE_PACKAGE_PATH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if(NOT PYTHON_SITE_PACKAGE_PATH)
message(FATAL_ERROR "Error occurred while attemping to find the Python site library path.")
endif(NOT PYTHON_SITE_PACKAGE_PATH)
endif(NOT PYTHON_SITE_PACKAGE_PATH)
set(PYTHON_DEST "${PYTHON_SITE_PACKAGE_PATH}" CACHE PATH "Python module install path.")
mark_as_advanced(PYTHON_DEST)
message( STATUS "Python module install path: ${PYTHON_DEST}")
find_package(PythonLibs)
include_directories(${PYTHON_INCLUDE_PATH}
./scripting)
endif(KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES)
......
......@@ -42,6 +42,9 @@ macro(perform_feature_checks)
#include(CheckFunctionExists)
include(CheckLibraryExists)
include(CheckSymbolExists)
include(CheckIncludeFileCXX)
include(CheckCXXSymbolExists)
include(CheckCXXSourceCompiles)
check_include_file("malloc.h" HAVE_MALLOC_H)
......@@ -70,8 +73,21 @@ macro(perform_feature_checks)
check_symbol_exists(_stricmp "string.h" HAVE_ISO_STRICMP)
check_symbol_exists(_strnicmp "string.h" HAVE_ISO_STRNICMP)
check_symbol_exists(_snprintf "stdio.h" HAVE_ISO_SNPRINTF)
# Check for functions in math.h.
check_include_file("math.h" HAVE_MATH_H)
check_symbol_exists(_hypot "math.h" HAVE_ISO_HYPOT)
# Check for functions in C++ cmath.
check_include_file_cxx(cmath HAVE_CXX_CMATH)
check_cxx_symbol_exists(asinh cmath HAVE_CMATH_ASINH )
check_cxx_symbol_exists(acosh cmath HAVE_CMATH_ACOSH )
check_cxx_symbol_exists(atanh cmath HAVE_CMATH_ATANH )
# CMakes check_cxx_symbol_exists() doesn't work for templates so we must create a
# small program to verify isinf() exists in cmath.
check_cxx_source_compiles( "#include <cmath>\nusing namespace std;\nint main(int argc, char** argv)\n{\n (void)argv;\n isinf(1.0); (void)argc;\n return 0;\n}\n" HAVE_CMATH_ISINF )
#check_symbol_exists(clock_gettime "time.h" HAVE_CLOCK_GETTIME) non-standard library, does not work
check_library_exists(rt clock_gettime "" HAVE_CLOCK_GETTIME)
......
......@@ -17,13 +17,30 @@
#define snprintf _snprintf
#endif
// Handle platform differences in math.h
#cmakedefine HAVE_MATH_H
#cmakedefine HAVE_ISO_HYPOT
#if defined( HAVE_ISO_HYPOT )
#define hypot _hypot
#endif
// Handle platform differences in C++ cmath.
#cmakedefine HAVE_CXX_CMATH
#cmakedefine HAVE_CMATH_ASINH
#cmakedefine HAVE_CMATH_ACOSH
#cmakedefine HAVE_CMATH_ATANH
#cmakedefine HAVE_CMATH_ISINF
#cmakedefine HAVE_CLOCK_GETTIME
#cmakedefine HAVE_GETTIMEOFDAY_FUNC
#cmakedefine MALLOC_IN_STDLIB_H
......
......@@ -170,42 +170,8 @@ If linux, run instead the following command:
Make the Debug binaries:
make
Fine-tune Build Process
-----------------------
These should be set from command line:
One of these 2 option *must* be set to ON:
KICAD_STABLE_VERSION or KICAD_TESTING_VERSION
** KICAD_STABLE_VERSION:
set this option to ON to build the stable version of KICAD. mainly used to set version ID
Usually set for kicad version downloaded from stable branch
** KICAD_TESTING_VERSION
set this option to ON to build the stable version of KICAD. mainly used to set version ID
Usually set for kicad version downloaded from testing branch
CMAKE_BUILD_TYPE Release/Debug (REQUIRED)
Choose build type: Release/Debug.
wxWidgets_USE_STATIC ON/OFF (OPTIONAL)
CMAKE_VERBOSE_MAKEFILE ON/OFF (OPTIONAL)
Turns ON/OFF verbose build messages.
You can also pass VERBOSE=1 to make for the same effect.
CMAKE_INSTALL_PREFIX (OPTIONAL)
USE_WX_GRAPHICS_CONTEXT ON/OFF (OPTIONAL)
*Experimental* advanced drawing library code using wxGraphicsContext (for tests only).
Under Windows, a very recent version of mingw is needed.
It requires wxWidgets to be built with the --enable-graphics_ctx switch.
See building wxWidgets above.
USE_IMAGES_IN_MENUS ON/OFF (OPTIONAL)
Force building Kicad with or without images in menu items. If this is not defined on
when CMake is used to create the build files, images will be included in menu items
on all platforms except OSX.
Note: that it is easy to build only a specific binary such as pcbnew alone:
make pcbnew
See ./cmake_config.txt for customizing the KiCad build setting.
KiCad uses CMake to generate the build files specific for the target platform
specified by the developer. This document attempts to define some of the more
common CMake and KiCad build configuration settings. You can use CMake either
by the command CMake on or the graphical version ccmake. This document only
documents a very small subset of the total CMake documentation For all of the
gory details, please see the complete CMake documentation at:
http://www.cmake.org/cmake/help/documentation.html.
Useful CMake Build Settings.
----------------------------
This section defines some of the more common CMake build configuration setting
used when configuring KiCad. These settings are valid for all projects that
use CMake.
Changing the Build Generator.
-----------------------------
CMake attempts to create the project build system based on the platform. On
Posix systems CMake will create Unix Makefiles to build KiCad. On Windows
systems CMake will attempt to find the latest version of Visual C++ installed
on the system and create the appropriate project files. This behavior can be
changed by specifying the project generator using the -G "Project Generator"
switch on the command line. Please note, only a small subset of these project
generators are supported. If you want to use Eclipse on Linux to build KiCad,
you may be in for a lot of work.
CMAKE_BUILD_TYPE (Release/Debug/RelWithDebInfo/MinSizeRel)
----------------------------------------------------------
When configuring the KiCad build for the command line you must specify build
type. To create a debug build, set CMAKE_BUILD_TYPE to Debug. To create a
release build, set CMAKE_BUILD_TYPE to Release. See the CMake documentation
for other build types. For IDE project files, the build type can be selected
by the IDE configuration manager.
CMAKE_INSTALL_PATH (InstallPath)
--------------------------------
By default CMake will select the correct install path for your platform. If
you wish to install KiCad in a custom location, set CMAKE_INSTALL_PATH to the
path where you want to install KiCad. Please note that the default install
path that CMake chooses will likely overwrite the current version of KiCad
installed on your system.
wxWidgets Library Configuration.
--------------------------------
KiCad is built using the wxWidgets library. The following options allow you
to specifically tailor the wxWidgets library configuration. For the complete
list of wxWidgets setting see CMakeModules/FindwxWidgets.cmake in the KiCad
source.
wxWidgets_ROOT_DIR (NonDefaultwxWidgetsPath)
--------------------------------------------
CMake looks in the standard platform locations to find the default version of
the wxWidgets library. If you wish to use a custom built wxWidgets library,
set wxWidgets_ROOT_DIR to the correct path.
wxWidgets_USE_DEBUG (ON/OFF)
----------------------------
When creating a debug build of KiCad, it is often useful to link against the
debug build of the wxWidgets. To use the debug build of wxWidgets, set
wxWidgets_USE_DEBUG to ON.
wxWidgets_USE_UNICODE (ON/OFF)
------------------------------
If you platform supports Unicode and you wish to build KiCad with Unicode
support, set wxWidgets_USE_UNICODE to ON. Please note as of the 2.9 branch
this option is not required.
KiCad Specific Options
----------------------
All of the configuration settings below are specific to the KiCad project.
If for any reason you add or remove a build option to the KiCad CMake files,
please update the list below.
KICAD_STABLE_VERSION (ON/OFF)
-----------------------------
This option enables or disables the stable version string to be created and
used when building KiCad. It is mutually exclusive with KICAD_TESTING_VERSION.
KICAD_TESTING_VERSION (ON/OFF)
------------------------------
This option enables or disables the testing version string to be created and
used when building KiCad. It is mutually exclusive with KICAD_STABLE_VERSION.
USE_WX_GRAPHICS_CONTEXT (ON/OFF)
--------------------------------
This option is *Experimental* and used the advanced drawing library code
using wxGraphicsContext and should only be used for testing purposes.
Under Windows, a very recent version of mingw is needed. It also requires
wxWidgets to be built with the --enable-graphics_ctx configuration switch.
USE_IMAGES_IN_MENUS (ON/OFF)
----------------------------
This option is used to enable or disable building KiCad with images in menu
items. If this is not defined when CMake is used to create the build files,
images will be included in menu items on all platforms except OSX.
USE_PCBNEW_NANOMETRES (ON/OFF)
This option is used to enable or disable the nano-meter internal units for
Pcbnew. The default is ON.
KICAD_GOST (ON/OFF)
-------------------
This option is used to enable or disable the GOST notation for multiple gates
per package in Eeschema. The default is OFF
KICAD_KEEPCASE (ON/OFF)
-----------------------
This option enables or disables turning off the automatic component name
conversion to uppercase. The default is OFF which means component names will
be converted to upper case.
USE_WX_OVERLAY (ON/OFF)
-----------------------
This option enables or disables wxOverlay for drawing operation on OSX. It is
OFF by default on all platforms except OSX. Warning, this is experimental!
KICAD_SCRIPTING (ON/OFF)
------------------------
This option enables or disables building Python scripting support for KiCad.
The default is OFF. Currently only Pcbnew is supported. This option requires
that SWIG and Python are installed on the system.
KICAD_SCRIPTING_MODULES (ON/OFF)
--------------------------------
This option enables or disables building the KiCad modules that can be used
from scripting languages. The default is OFF. Currently only Pcbnew is
supported. This option requires that SWIG and Python are installed on the
system.
KICAD_SCRIPTING_WXPYTHON (ON/OFF)
---------------------------------
This option enables or disables building wxPython support into KiCad for
python and py.shell. The default is OFF. Currently only Pcbnew is
supported. This option requires that SWIG, Python, and wxPython are
installed on the system.
PYTHON_SITE_PACKAGE_PATH (PATH)
-------------------------------
When building KiCad with Python scripting enable, the Python site library path
is used by default. If you want to install the KiCad Python extension in a
different path, set this variable to the desired path.
Introduction
------------
This document details how to build KiCad from source on Windows. The current
supported method of building KiCad on Windows systems is to use MinGW/MSYS.
Other build systems such as Visual Studio and Eclipse can be used but your
mileage may vary. If you choose to build KiCad with one of the unsupported
tools, please do not expect a great deal of help from the KiCad developers
unless you want to be the person that supports the build tool. If you add
or remove any of the KiCad build dependencies, please update this document.
Install Build Tools
-------------------
This section describes the tools required to build KiCad from source and how
to install them. Failure to install these tools properly will likely result
in build errors.
MinGW/MSYS
----------
MinGW/MSYS provides the compiler tools and a partial Posix environment useful
for building software. Download the MinGW installer from http://mingw.org.
Run the installer and and verify MinGW and MSYS are checked. You will also
need to expand the MinGW entry and select C++ from the list of supported
languages. Only C is installed by default and C++ is required to build KiCad.
Bazaar
------
KiCad uses the Bazaar version control system to track source code changes.
The easiest way to get a copy of the KiCad source is to use Bazaar. Bazaar
can be download from http://http://wiki.bazaar.canonical.com/WindowsDownloads.
Your best bet is to use the stand alone version of Bazaar rather than one of
the Python specific versions.
CMake
-----
The KiCad source uses CMake to make sure the system has the required software
and libraries installed to properly compile the source. Download the latest
CMake installer from http://cmake.org. Run the installer and make sure the
add CMake to PATH variable check box is checked. If you fail to do this step,
the CMake executable will not be found.
Doxygen (Optional)
------------------
Doxygen is used to generate HTML documentation of the KiCad source code. While
it is not necessary to install Doxygen, it is a very good way to learn your way
around the KiCad code base. It is highly recommended for new developers. The
latest Doxygen installer can be downloaded from http://www.stack.nl/~dimitri/
doxygen/
Python (Optional)
-----------------
KiCad supports the Python scripting language (currently only Pcbnew scripting
exists). Currently the Python scripting support will only build against the
version 2 branch of Python. The Python installer can be downloaded from http://
www.python.org.
SWIG (Optional)
---------------
SWIG is used to generate the Python scripting code. It must be installed to
build the Python scripting support. Unfortunately there in no installer for
windows. You can download precompiled binaries from http://http://www.swig.
org/download.html and install swig.exe. Make sure the folder you install the
SWIG binary into is in the system PATH. Otherwise CMake will not be able to
find it.
NullSoft Installer System (Optional)
------------------------------------
The NullSoft Installer System (NSIS) is used to create a Windows installer for
end users from the binaries created from the KiCad source along with the
library and documentation files. NSIS is typically only used be developers who
create installers for end users and is not required if you install from source.
NSIS can be downloaded from http://nsis.sourceforge.net/Download.
Install and Build Libraries
---------------------------
This section documents installing and build all of the software libraries
required to build KiCad. As of now, these libraries have to be built because
MinGW builds of these libraries are not readily available Attempting to link
programs built on MinGW with libraries from other compilers (namely Microsoft
Visual C) is problematic. It can be done but it is not painless. As far as
the author of this document knows, MinGW can only link to Visual Studio C
libraries. The name mangling of Visual Studio C++ is not compatible with the
MinGW linker.
Build and Install the wxWidgets Library
---------------------------------------
The wxWidgets library is the base that KiCad is built upon. Version 2.9.4
or later of wxWidgets should be used on Windows. You may be able to build
KiCad with older versions of wxWidgets but it is not recommended. wxWidgets
can be downloaded from http://http://www.wxwidgets.org/downloads/
Unzip the wxWidgets zip file into your preferred build directory. Avoid using
spaces in the path names. Some MinGW tools do not play well with them. It is
always best to error on the side of caution.
Open MinGW and change to the wxWidgets source directory. If you don't want to
install the wxWidgets library into MinGW then enter the following commands:
#mkdir Release
#cd Release
#../configure --with-opengl
#make
If you want to install wxWidgets in MinGW then enter the following commands:
#mkdir Release
#cd Release
#../configure --prefix=/mingw --with-opengl
#make && make install
#move /mingw/lib/wxmsw*.dll /mingw/bin
The last command is critical so that the libraries are in the MinGW PATH
and can be found at run time. If you want to build a full debugging version
of wxWidgets, add --enable-debug to the configure command. If you are going
to use the GNU debugger, you may also want to build the debugging libraries
with the extra GDB debugging information by adding --enable-debug_gdb to the
configure command.
Download the KiCad Source Code
------------------------------
You can use the Launchpad repository or a tar file for this. See the wiki.
To download files from Launchpad repository, you need to install the Bazaar
(bzr) version control system.
Launchpad repository has two branches for KiCad sources:
- a testing branch (used by developers)
- a stable branch (a copy of the testing branch, when this testing branch is
near a stable state)
To download the testing branch:
#bzr branch lp:kicad kicad_testing
To download the stable branch:
#bzr branch lp:kicad/stable kicad_stable
To download the component and footprint libraries
#bzr branch lp:~kicad-lib-committers/kicad/library kicad_libraries
To download the documentation and translation files:
#bzr branch lp:~kicad-developers/kicad/doc kicad_doc
Create Makefiles with CMake
---------------------------
Open your Msys shell. Create two "out of source" build directories at the
command line enter the following commands:
#cd <kicadSource>
#mkdir -p build/release # Build path can be anywhere you prefer.
#mkdir build/debug # Only if you want a debug version of KiCad.
To create a release build of KiCad, run the following command:
#cd build
#cmake -G "MSYS Makefiles" \ # Back slashes are not required
-DCMAKE_BUILD_TYPE=Release \ # and are for formatting only.
-DKICAD_TESTING_VERSION=ON ../../
If the configuration fails, you have failed to install the required software
on you system. The error message should give you a good indication of what is
missing. You must resolve this before you can build KiCad.
Compiling the Code
------------------
To build KiCad, at the command line enter following comnands:
#cd <kicadSource>/build/release
#make
Installing KiCad
----------------
To install Kicad, at the command line enter the following commands:
#cd <kicadSource>/build/release
#make install
If you get any errors during the installation, you probably do not have the
appropriate privileges to the install path. Take a look at CMakeCache.txt
that was created when you ran CMake, and in particular look at the value of
the CMAKE_INSTALL_PREFIX variable. This is where KiCad will be installed. If
this not where you want KiCad installed, edit it with a text editor rerun the
make install command. You do not have the appropriate privileges to install
KiCad in the CMAKE_INSTALL_PATH, run the make install command as administrator.
You are now done unless you want to make a Debug build.
Compiling a Debug version
-------------------------
To create a debug version of KiCad, enter the following commands:
#cd <kicadSource>/build/debug
#cmake -G "MSYS Makefiles" \
-DCMAKE_BUILD_TYPE=Debug \
-DKICAD_TESTING_VERSION=ON ../../
#make
Generally speaking you do not install debug binaries. They can be debugged in
place. To monitor the debugging output, you can download the Windows debug
viewer DbgView from http://technet.microsoft.com/en-us/sysinternals/
bb896647.aspx
Compiling the Python Scripting Support.
---------------------------------------
Before building KiCad Python scripting extension, you must create a MinGW
compatible Python link library. The directions to do this can be found in
the "How do I create Python extensions?" FAQ at http://www.mingw.org/wiki/FAQ.
To build KiCad with Python scripting support, run CMake as follows and then
compile the source as described above.
#cmake -G "MSYS Makefiles" \
-DCMAKE_BUILD_TYPE=Release \
-DKICAD_PYTHON_SCRIPTING=ON \
-DKICAD_PYTHON_MODULES=ON \
-DKICAD_TESTING_VERSION=ON ../../
You only need to include the KICAD_PYTHON_MODULES option if you want to
install the python modules that ship with KiCad. Also note that the wxPython
support cannot be compiled on Windows at this time due to library conflicts
between MinGW and Python. Work is currently underway by the KiCad developers
to provide a MinGW build of Python which should resolve this issue.
Building the Developer Documentation
------------------------------------
To build the HTML developer documentation, run the following commands:
#cd <kicadSource>/build/debug
#make doxygen-docs
The documentation will be created in the <kicadSouce>/Documenation/html
directory.
......@@ -387,7 +387,8 @@ void PLOTTER::segmentAsOval( const wxPoint& start, const wxPoint& end, int width
else if( size.x == 0 )
orient = 900;
else
orient = -(int) ( RAD2DEG( atan2( size.y, size.x ) ) * 10.0 );
orient = -(int) ( RAD2DEG( atan2( (double)size.y, (double)size.x ) ) * 10.0 );
size.x = (int) sqrt( ( (double) size.x * size.x )
+ ( (double) size.y * size.y ) ) + width;
size.y = width;
......
......@@ -519,7 +519,7 @@ void SCH_COMPONENT::SetRef( const SCH_SHEET_PATH* sheet, const wxString& ref )
}
void SCH_COMPONENT::SetTimeStamp( long aNewTimeStamp )
void SCH_COMPONENT::SetTimeStamp( time_t aNewTimeStamp )
{
wxString string_timestamp, string_oldtimestamp;
......
......@@ -25,6 +25,9 @@
#include <transline.h>
#include <units.h>
using namespace std;
#ifndef INFINITY
#define INFINITY std::numeric_limits<double>::infinity()
#endif
......@@ -34,35 +37,11 @@
#define M_PI_2 (M_PI/2)
#endif
#ifdef _MSC_VER
#ifndef HAVE_CMATH_ISINF
inline bool isinf(double x)
{
return x == INFINITY; // return true if x is infinity
}
inline double asinh(double x)
{
return log(x+sqrt(x*x+1));
}
inline double acosh(double x)
{
// must be x>=1, if not return Nan (Not a Number)
if(!(x>=1.0)) return sqrt(-1.0);
// return only the positive result (as sqrt does).
return log(x+sqrt(x*x-1.0));
}
inline double atanh(double x)
{
// must be x>-1, x<1, if not return Nan (Not a Number)
if(!(x>-1.0 && x<1.0)) return sqrt(-1.0);
return log((1.0+x)/(1.0-x))/2.0;
}
#else
using namespace std;
#endif
......
......@@ -24,15 +24,41 @@
#ifndef __UNITS_H
#define __UNITS_H
#include <config.h>
#include <cmath>
#include <units_scales.h>
#ifdef __MINGW32__
#define atanh(x) (0.5 * log((1.0 + (x)) / (1.0 - (x))))
#define asinh(x) log((x) + sqrt((x) * (x) + 1.0))
#define acosh(x) log((x) + sqrt((x) * (x) - 1.0))
#ifndef HAVE_CMATH_ASINH
inline double asinh( double x )
{
if( x==0.0 ) return sqrt( -1.0 );
return log( x+sqrt(x*x+1) );
}
#endif
#ifndef HAVE_CMATH_ACOSH
inline double acosh( double x )
{
// must be x>=1, if not return Nan (Not a Number)
if( !(x>=1.0) ) return sqrt( -1.0 );
// return only the positive result (as sqrt does).
return log( x+sqrt(x*x-1.0) );
}
#endif
#ifndef HAVE_CMATH_ATANH
inline double atanh( double x )
{
// must be x>-1, x<1, if not return Nan (Not a Number)
if( !(x>-1.0 && x<1.0) ) return sqrt( -1.0 );
return log( (1.0+x)/(1.0-x) ) / 2.0;
}
#endif
#ifndef M_PI
#define M_PI 3.1415926535897932384626433832795029 /* pi */
#endif
......
......@@ -30,7 +30,6 @@
#include <wx/wx.h>
#include <wx/config.h>
#include <trigo.h>
#include <stdint.h>
#include <pcb_pad.h>
......@@ -155,7 +154,7 @@ void PCB_PAD::WriteToFile( wxFile* aFile, char aFileType, int aRotation )
PCB_PAD_SHAPE* padShape;
wxString padShapeName = wxT( "Ellipse" );
wxString s, padType;
uint32_t layerMask;
wxUint32 layerMask;
int i;
int width = 0;
int height = 0;
......
......@@ -321,8 +321,7 @@ void BOARD_PRINTOUT_CONTROLLER::DrawPage()
#if defined(DEBUG)
wxRect paperRect = GetPaperRectPixels();
wxLogTrace( tracePrinting, wxT( "Paper rectangle: left=%d, top=%d, "
"right=%d, bottom=%d" ),
wxLogTrace( tracePrinting, wxT( "Paper rectangle: left=%d, top=%d, right=%d, bottom=%d" ),
paperRect.GetLeft(), paperRect.GetTop(), paperRect.GetRight(),
paperRect.GetBottom() );
......@@ -330,8 +329,7 @@ void BOARD_PRINTOUT_CONTROLLER::DrawPage()
int devTop = dc->LogicalToDeviceY( drawRect.GetY() );
int devRight = dc->LogicalToDeviceX( drawRect.GetRight() );
int devBottom = dc->LogicalToDeviceY( drawRect.GetBottom() );
wxLogTrace( tracePrinting, wxT( "Final device rectangle: left=%d, top=%d, "
"right=%d, bottom=%d\n" ),
wxLogTrace( tracePrinting, wxT( "Final device rectangle: left=%d, top=%d, right=%d, bottom=%d\n" ),
devLeft, devTop, devRight, devBottom );
#endif
......
......@@ -95,8 +95,7 @@ wxArrayString PYTHON_FOOTPRINT_WIZARD::CallRetArrayStrMethod
if ( !PyList_Check(result) )
{
Py_DECREF( result );
ret.Add( wxT("PYTHON_FOOTPRINT_WIZARD::CallRetArrayStrMethod, "
"result is not a list"),1 );
ret.Add( wxT("PYTHON_FOOTPRINT_WIZARD::CallRetArrayStrMethod, result is not a list"), 1 );
return ret;
}
......
#!/usr/bin/env python2
#!/usr/bin/env python
# the purpose of this script is rewriting the swig_import_helper
# call so it will not load _xxxxx.so/dso from inside a kicad executable
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment