Create markdown version of compiling KiCad for developer documentation.

* Add compiling.md with most of the important information from the plain
  text versions of platform specific compiling files.
* Remove the old plain text compiling files and folder.
This commit is contained in:
Wayne Stambaugh 2015-10-11 11:16:25 -04:00
parent 70b584c5f5
commit faf8e3a723
7 changed files with 392 additions and 862 deletions

View File

@ -1,219 +0,0 @@
Compiling KiCad from Source
===========================
KiCad Documentation Team
Last revised on 2014-december-24 by JP Charras
Introduction
------------
This is a generic guide how to compile kicad from scratch. On windows and linux.
If you need something more distribution specific or the experimental mac-osx port
read the other documents in the Documentation/compiling folder.
Installation of Tools
---------------------
On windows:
Get msys and mingw here:
http://mingw.org/
msys sets up a development environment that allows the bash shell to run.
mingw are a set of tools that run on windows or under msys. You will need
at least the following mingw packages: make, gcc, g++, binutils, autoconf, and
automake.
On linux:
Install "mesa". Use your package manager to install the
development libaries.
After a fresh install you need the following packages to compile and run
KiCad from source.
* bzr - Bazaar version control system
* CMake - Cross-platform make
* GLUT - The OpenGL Utility Library
* GLEW
* wxWidgets - The wxWidgets GUI toolkit with GTK+ bindings version 3.0 or more
* libbz2 (dev)
* libcairo (dev)
* Boost - Collection of portable C++ source libraries
boost will be automagically downloaded, copied in kicad sources tree and patched,
the first time you compile kicad.
Useful, but not required:
* Doxygen - Documentation system for several programming languages
Required to build Kicad with scripting (using python) support:
Python
Swig
KiCad uses the Bazaar version control system to track source code changes,
and download the boost libraries needed by Kicad.
Be sure you bzr install also includes bzrtools.
boost libraries will be downloaded the first time you build Kicad.
Compiler and basic development tools
-------------
Make sure g++, make and other tools are in your path.
If windows, then try running g++ and make from within your msys bash shell.
PLEASE NOTE: g++ 4.7.1 and 4.7.2 are known to
miscompile pcbnew (it get zones wrong) with -O2; using -O1 is a suitable
workaround until they fix the compiler.
Install or Build wxWidgets
--------------------------
WARNING:
see wxWidgets_patch_notes.txt for patches and issues in wxWidgets.
On Windows, download
http://sourceforge.net/projects/wxwindows/files/3.0.2/wxWidgets-3.0.2.zip/download
or a newer version.
Do NOT use previous versions which all have annoying issues for KiCad.
Start msys so you have a bash shell.
Note also since 2.9 versions no need to build a "debug" version of the wxWidgets library,
the release and the debug version are same.
Unzip the wxWidgets zip file into the build directory. Change directories into
there, and then:
mkdir Release
cd Release
../configure --with-opengl
make
and under Linux, but not under Windows:
sudo make install that install wxWidgets libs and headers in /usr/local/
On linux, yo can also download wxWidgets 3.0 (recommandedd)
or you can use your package manager to install the
development versions of the wxWidgets packages which include the C++ headers.
The recommended way is to build wxWidgets from source, and use wxWidgets 3.0
or more recent (Older versions have a print function which does not work).
Verify that wx-config is in your path by running it from a command prompt.
Linux users then go to next step.
Install CMake
-------------
On windows, download the installation binary for windows from cmake.org.
Install that and choose to add cmake to your path during installation. You
will have to restart your command shell for the new path to take effect.
Verify that cmake is in your path by trying to run it from a command prompt.
On linux, use your package manager to install cmake. You should get cmake 2.8.4
or later. If only an older one is available in your package repository, build
cmake from source. Verify that cmake is in your path by trying to run it from a
command prompt.
Obtain Sources
--------------
You can use the Launchpad repository or a tar file for this. See the wiki.
To download files from Launchpad repository, you should install bazaar (bzr) that is a
version control system like subversion, mercurial, git...
Launchpad repository handle 2 branches for KiCda sources:
- a product branch (used by developers, which is most of time usable in production)
- a stable branch (a copy of the testing branch,
when the product branch is a stable state))
Remarks:
- The product branch is actively maintained
- From the product branch, you can go back to any previous version, using bzr features
- The stable branch is poorly or not maintained (and could be removed)
In order to have a working Kicad installtion, you need
- sources to build binaries
- libraries (they are not included in sources)
- documentation and translations (they are not included in sources)
product branch:
bzr branch https://code.launchpad.net/~kicad-product-committers/kicad kicad_src
Stable branch:
bzr branch https://code.launchpad.net/~kicad-product-committers/kicad/stable kicad_src
Components and Footprints libraries
all (schematic libs, 3D shapes ...) but new footprints libraries (use Download zip tool)
https://github.com/KiCad/kicad-library/
New footprints libraries (use Download zip tool for each lib you want)
https://github.com/KiCad/ for footprint libs (*.pretty folders)
A mirror of github is available, using bzr:
(schematic libs, 3D shapes ... all but new footprints libraries)
bzr checkout lp:~kicad-product-committers/kicad/library
Old legacy libraries:
bzr checkout lp:~dickelbeck/kicad/library-read-only
Note also Kicad is able to read on github.com/KiCad/ the *.pretty folders
without download, using github plugin.
(however the time to read them can be long)
Documentation and translations:
bzr branch lp:~kicad-developers/kicad/doc kicad_doc
Create Makefiles with CMake
---------------------------
On windows, go into your msys shell.
Linux and windows users both then make two "out of source" build directories:
cd <kicadSource>
mkdir -p build/release
mkdir build/debug (if you want a debug version of KiCad)
cd build/release
On either cmake command line shown below, you can optionally include
-DCMAKE_INSTALL_PREFIX=<finallInstallDir>
For instance on Linux: <finallInstallDir>=/usr/local/kicad or ~/kicad
On windows, run the following command:
cmake -G "MSYS Makefiles" -DCMAKE_BUILD_TYPE=Release -DwxWidgets_ROOT_DIR=<wxInstallDir> ../../
Avoid installing Kicad on C: disk, which is protected by Windows.
Use D: or E: ...
On linux, run instead the following command:
cmake -DCMAKE_BUILD_TYPE=Release ../../
Take a look at CMakeCache.txt, and in particular CMAKE_INSTALL_PREFIX, which
gives the final install directory. If not what you want, edit it with a text
editor and re-run the same cmake command again, but with no
-DCMAKE_INSTALL_PREFIX given on the command line.
Compiling with Make
------------------~
You compile Kicad here. You will only need to do step 8) again when one of the
CMakeLists.txt files change. If windows, you must be in your msys shell.
On either platform then:
cd <kicadSource>/build/release
make
[sudo] make install
You are now done unless you want to make a Debug build.
Compiling a Debug version
-------------------------
cd <kicadSource>/build/debug
On either cmake command line shown below, you can optionally include
-DCMAKE_INSTALL_PREFIX=<finallInstallDir> before the final ../../ argument.
Although normally you do not install the Debug binaries, you can debug them
where they were built.
On windows, run the following command:
cmake -G "MSYS Makefiles" -DCMAKE_BUILD_TYPE=Debug -DwxWidgets_ROOT_DIR=<wxInstallDir> ../../
where <wxInstallDir> is <wxWidgets path>/Release
On linux, run instead the following command:
cmake -DCMAKE_BUILD_TYPE=Debug -DwxWidgets_USE_DEBUG=ON ../../
Make the Debug binaries:
make
See Documentation/compiling/build-config.txt for a list of all CMake options
available when compiling KiCad.

View File

@ -1,192 +0,0 @@
Bazaar
======
KiCad uses the Bazaar version control system to track source code changes,
and download the boost libraries needed by Kicad.
The easiest way to get a copy of the KiCad source is to use Bazaar.
Bazaar can be download from http://wiki.bazaar.canonical.com.
Your best bet is to use the stand alone version of Bazaar
(which includes bzrtools, needed by Kicad) rather than one of
the Python specific versions.
Be sure bzrtools is also installed.
boost libraries will be downloaded the first time you build Kicad.
CMake
=====
KiCad uses CMake (version 2.12 or later) 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)
----------------------------------------------------------
Default: Release
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.
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_SKIP_BOOST (ON/OFF)
--------------------------
Default: OFF
Use the version of the Boost library installed on the system rather than
building a local copy.
WARNING: The KiCad developers strongly advise you to build the bundled copy of
the Boost library, as it is known to work with KiCad. Other versions may
contain bugs that may result in KiCad errors.
USE_IMAGES_IN_MENUS (ON/OFF)
----------------------------
Default: OFF for OSX, ON for other platforms.
This option is used to enable or disable building KiCad with images (icons) 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.
Note also, on Linux, some window managers do not show icons in menu, or
show them only if the current option is activated.
Therefore, even if you have icons in menus, they will be not always displayed
DOWNLOAD_DIR (PATH)
-------------------
Default: <source directory>/.downloads-by-cmake
Some external dependencies are automatically download and built when you
compile KiCad. This option specifies which directory they are stored in. If you
are building multiple copies of KiCad (e.g., to test different features or your
own modifications), it is recommended you set this option to a global directory
to avoid download and building the dependencies multiple times.
KICAD_USER_CONFIG_DIR (PATH)
----------------------------
Default: ~/.config (Unix-based systems), Application data directory (Windows)
This option specifies where to store user-specific configuration information.
USE_WX_OVERLAY (ON/OFF)
-----------------------
Default: ON for OSX, OFF for other platforms.
This option enables or disables the use of wxOverlay for drawing operations.
Warning, this is experimental!
KICAD_SCRIPTING (ON/OFF)
------------------------
Default: OFF
This option enables or disables building Python scripting support within KiCad.
Currently only Pcbnew is supported. This option requires SWIG and Python to be
installed on the system.
It allows using footprint wizards in footprint editor to create new footprints
KICAD_SCRIPTING_MODULES (ON/OFF)
--------------------------------
Default: OFF
This option enables or disables building KiCad Python modules that can be used
externally by Python. Currently only Pcbnew is supported. This option
requires SWIG and Python to be installed on the system.
This python module is used to edit board files (.kicad_pcb files) from a
python script, outside kicad.
KICAD_SCRIPTING_WXPYTHON (ON/OFF)
---------------------------------
Default: OFF
This option enables or disables building wxPython support into the KiCad
scripting support. Currently only Pcbnew has scripting support. This option requires
SWIG, Python, and wxPython to be installed on the system.
It allows execution of python scripts insided Pcbnew, during a session.
PYTHON_SITE_PACKAGE_PATH (PATH)
-------------------------------
Default: System site library 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.
BUILD_GITHUB_PLUGIN (ON/OFF)
----------------------------
Default: ON
This option enables or disables building KiCad with a pcbnew plugin for loading
footprints from a GitHub repository.
KICAD_REPO_NAME (STRING)
------------------------
Default: "product"
The name of the repository this copy of KiCad was compiled from. This is
reported in the "About" dialog and is useful for people who are working with
multiple copies of the code from different sources. The default value is
"product", the name of the main development branch on Launchpad.

View File

@ -1,229 +0,0 @@
Introduction
------------
This document details how to build KiCad from source on Windows. The current
supported method of building KiCad for Windows systems is to use the MinGW
compiler, either from Windows or cross compiling from Linux. MSYS can be
used on Windows to extend the range of subprojects that you can build, but
is not needed to build KiCad itself.
Visual Studio is not supported, and don't ask about it, it is not supported
and will not be, ever.
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,
and download the boost libraries needed by Kicad.
The easiest way to get a copy of the KiCad source is to use Bazaar. Bazaar
can be download from http://wiki.bazaar.canonical.com/WindowsDownloads.
Your best bet is to use the stand alone version of Bazaar
(which includes bzrtools, needed Kicad) 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 --enable-monolithic=no --enable-shared=yes --with-opengl
#make
If you want to install wxWidgets in MinGW then enter the following commands:
#mkdir Release
#cd Release
#../configure --prefix=/mingw --enable-monolithic=no --enable-shared=yes --with-opengl
#make && make install
wxWidgets cannot be statically linked to Kicad.
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 https://code.launchpad.net/~kicad-product-committers/kicad kicad_testing
To download the stable branch:
#bzr branch https://code.launchpad.net/~kicad-product-committers/kicad/stable kicad_stable
To download the component and footprint libraries:
(This branch is a bzr/launchpad import of the Git repository
at https://github.com/KiCad/kicad-library.git.
It has schematic parts and 3D models in it.)
#bzr branch https://code.launchpad.net/~kicad-product-committers/kicad/library kicad_libraries
To download the documentation and translation files:
#bzr branch https://code.launchpad.net/~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.
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 ../../
#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 ../../
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/release
#make doxygen-docs
The documentation will be created in the <kicadSouce>/Documentation/html
directory.

View File

@ -1,221 +0,0 @@
Compiling KiCad on Apple Mac OS X
=================================
Building on OS X is very similar to building on Linux. This document will provide
a complete walk-through on what to do but it will focus on OS X specific things.
See general documentation on non OS X specific KiCad build switches, etc.
Prerequisites
-------------
Tools needed for building KiCad:
* XCode Tools
* bzr - Bazaar version control system
* CMake - Cross-platform make
Optional tools:
* Doxygen - Documentation system for several programming languages
Mandatory library dependencies needed to compile KiCad:
* GLEW - The OpenGL Extension Wrangler Library
* cairo - 2D graphics library
* wxWidgets - Cross-Platform GUI Library
OR
wxPython - A blending of the wxWidgets C++ class library with the Python
programming language
* SWIG - Interface compiler (only needed for scripting/wxPython builds)
Optional library dependencies, depends on used KiCad features
* OpenSSL - The Open Source toolkit for SSL/TLS
=> Needed for github plugin
All tools (except XCode, of course) and all dependencies except wxWidgets/wxPython
can be compiled manually, but it is advised to install them using your favorite
package manager for OS X like MacPorts or Homebrew.
Depending on the package manager the development packages of the library
dependencies may have to be installed (usually something like <pkg>-dev or
<pkg>-devel).
Further, depending on the configuration of your package manager packages might
have to be compiled with special flags/variants to support the correct
architecture. E.g., some packages of MacPorts need to have the "+universal"
variant set to also include the x86_64 variant that might be chosen
automatically by KiCad build process.
IMPORTANT:
At the moment you *must not* use a wxWidgets/wxPython version installed by any
package manager.
KiCad on OS X needs overlay support and some other fixes, which are not yet
contained in mainline wxWidgets/wxPython sources and builds.
If you don't use a patched wxWidgets you will get graphical artifacts (something
like a magnifying glass effect in the upper left corner of KiCad windows) or
KiCad will just crash on start (due to duplicate libraries).
Install now the tools and library dependencies as mentioned above.
Folder Structure
----------------
This documentation will use the following folder structure as an example, but it
is not mandatory to do it like that:
KiCad/
+-- kicad/ KiCad source folder
+-- build/ KiCad build folder
+-- bin/ KiCad binaries folder
+-- wx-src/ wxWidgets/wxPython source folder
+-- wx-build/ wxWidgets/wxPython build folder
+-- wx-bin/ wxWidgets/wxPython binaries folder
Get KiCad sources
-----------------
Create your work root "KiCad" wherever you like and sync KiCad sources to it:
# mkdir KiCad
# cd KiCad
# bzr branch lp:kicad
Compiling wxWidgets / wxPython
------------------------------
If you don't intend to build KiCad with scripting support then you only need
wxWidgets, otherwise you need wxPython (which also contains wxWidgets).
Get wxWidgets sources from
http://www.wxwidgets.org/downloads/
or wxPython sources from
http://www.wxpython.org/download.php#source
and unpack it to the wx-src folder.
It is recommended to use the latest stable version. As of this writing this is
3.0.2 for wxWidgets or 3.0.1.1 for wxPython.
There is a little helper script osx_build_wx.sh in kicad/scripts that does all
the patching/configuring/compiling of wxWidgets or wxPython for you.
Go to your working root "KiCad" and for example run:
# kicad/scripts/osx_build_wx.sh wx-src wx-bin kicad 10.7 "-j4"
First parameter is the source folder of wxWidgets/wxPython, second parameter the
target folder for compiled binaries, and third parameter is the kicad folder.
The fourth parameter is the minimum OS X version you are building for (see the
section about compiling KiCad for further notes on minimum OS X version).
The last parameter is optional and contains make options used during the build
(in this example for building with 4 jobs in parallel).
The script will automatically detect if you are compiling wxWidgets or wxPython.
NOTE: All paths are assumed to be relative to the current directory, i.e., the
working root you are in.
CAUTION: The script will erase existing wx-build and target folders (wx-bin)
without any confirmation!
If everything went fine during compilation you will now have a working
wxWidgets/wxPython installation in the wx-bin folder.
For building KiCad it is sufficient to keep the wx-bin folder.
The script doesn't have to be used, the usual "configure/make/make install" will
also work. If you do so, be sure to apply the patches needed for KiCad:
# patch -p0 < ../kicad/patches/wxwidgets-3.0.0_macosx.patch
# patch -p0 < ../kicad/patches/wxwidgets-3.0.0_macosx_bug_15908.patch
# patch -p0 < ../kicad/patches/wxwidgets-3.0.0_macosx_soname.patch
The same patches apply both for wxWidgets and for wxPython.
There is also an optional patch that enables full screen resolution on Retina displays:
# patch -p0 < ../kicad/patches/wxwidgets-3.0.2_macosx_retina_opengl.patch
Optional patch to support pinch gesture on trackpads to control zoom:
# patch -p0 < ../kicad/patches/wxwidgets-3.0.2_macosx_magnify_event.patch
The script uses the following configure command/options for wxWidgets known to
work:
# ../wx-src/configure \
--prefix=`pwd`/../wx-bin \
--with-opengl \
--enable-aui \
--enable-utf8 \
--enable-html \
--enable-stl \
--with-libjpeg=builtin \
--with-libpng=builtin \
--with-regex=builtin \
--with-libtiff=builtin \
--with-zlib=builtin \
--with-expat=builtin \
--without-liblzma \
--with-macosx-version-min=<osxtarget> \
--enable-universal-binary=i386,x86_64 \
CC=clang \
CXX=clang++
If you know what you are doing, you can of course use different settings.
Compiling KiCad
---------------
Change to your working root "KiCad" and create the build folder there:
# mkdir build
# cd build
Now, configure KiCad without scripting support:
# cmake ../kicad \
-DCMAKE_C_COMPILER=clang \
-DCMAKE_CXX_COMPILER=clang++ \
-DCMAKE_OSX_DEPLOYMENT_TARGET=10.7 \
-DwxWidgets_CONFIG_EXECUTABLE=../wx-bin/bin/wx-config \
-DKICAD_SCRIPTING=OFF \
-DKICAD_SCRIPTING_MODULES=OFF \
-DKICAD_SCRIPTING_WXPYTHON=OFF \
-DCMAKE_INSTALL_PREFIX=../bin \
-DCMAKE_BUILD_TYPE=Release
or, configure KiCad with scripting support:
# cmake ../kicad \
-DCMAKE_C_COMPILER=clang \
-DCMAKE_CXX_COMPILER=clang++ \
-DCMAKE_OSX_DEPLOYMENT_TARGET=10.7 \
-DwxWidgets_CONFIG_EXECUTABLE=../wx-bin/bin/wx-config \
-DPYTHON_EXECUTABLE=`which python` \
-DPYTHON_SITE_PACKAGE_PATH=`pwd`/../wx-bin/lib/python2.7/site-packages \
-DKICAD_SCRIPTING=ON \
-DKICAD_SCRIPTING_MODULES=ON \
-DKICAD_SCRIPTING_WXPYTHON=ON \
-DCMAKE_INSTALL_PREFIX=../bin \
-DCMAKE_BUILD_TYPE=Release
Note, that depending on your python version the "python2.7" part of the
"-DPYTHON_SITE_PACKAGE_PATH" variable might have to be adjusted to what has
been generated when compiling/installing wxPython. If you want to use a specific
python, you can also specify it via "-DPYTHON_EXECUTABLE" instead of using
`which python` (this one will just detect/use you default python).
The parameter "-DCMAKE_OSX_DEPLOYMENT_TARGET=10.x" is mandatory, you have to
specify the (minimum) OS X version you intend to build for. It is important that
at least wxWidgets/wxPython and KiCad (and boost, if you use an external build)
are built using the same or compatible settings. If not, you might get linker
errors, because this parameter influences which standard C++ library is being
used (libstdc++ vs. libc++).
If you don't know what to use and you are only building for your machine, just
set it to your current OS X version (e.g., MacPorts always builds this way).
Binaries built with a target OS X version <10.7 are known to show strange
behavior in some situations on recent systems (maybe because libc++ is standard
on everything >= 10.7 and problems arise due to mixing libstdc++/libc++).
Now KiCad is configured using default features/build-switches.
See Documentation/compiling/build-config.txt for a list of all CMake options
available when compiling KiCad.
Build & Install:
# make
... will take some time ...
# make install
Again, if everything went fine you will now have KiCad binaries in the "bin"
folder. KiCad application can be directly run from there to test.
If everything is OK, you can create a .dmg image of your "bin" folder or just
copy/install the KiCad binaries and/or support files (like demos or
documentation) wherever you want.
If you resync to newer versions of KiCad you don't have to rebuild wxWidgets or
other dependencies.
CMake should pick up the changes automatically and build correctly. However, it
is advised that you make a clean build to be sure (just delete the build folder
and go again through the configure/build steps).

View File

@ -648,7 +648,8 @@ WARN_LOGFILE =
INPUT = coding-style-policy.md \
stable-release-policy.md \
road-map.md
road-map.md \
compiling.md
# This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is

View File

@ -0,0 +1,389 @@
# Building KiCad from Source #
If you are a user and not a developer, please consider using one of the prebuilt packages
of KiCad which can be found at the [download][] page on the [KiCad website][]. Building KiCad
from source is not for the faint of heart and is not recommended unless you have reasonable
software development experience. This document contains the instructions on how to build KiCad
from source on the supported platforms. It is not intended as a guide for installing or building
library dependencies. Please consult you platforms documentation for installing packages or the
source code when building the library dependencies. Currently the supported platforms are Windows
Versions 7-10, just about any version of Linux, and OSX 10.7-10.10. You may be able to build
KiCad on other platforms but it is not supported. On Windows and Linux the [GNU GCC][] is the
only supported compiler and on OSX [Clang][] is the only supported compiler.
[TOC]
# Development Tools # {#development_tools}
Before you begin building KiCad, there are a few tools required beside your compiler. Some of
these tools are required to build from source and some are optional.
## CMake Build Configuration Tool ## {#cmake}
[CMake][] is the build configuration and makefile generation tool used by KiCad. It is required.
## Bazaar Version Control System ## {#bazaar}
The official source code repository is hosted on [Launchpad][] and requires [Bazaar][] in order
to create a branch of the latest source. Bazaar is optional if you are going to build a stable
version of KiCad from a source archive.
## GIT Version Control System ## {#git}
If you prefer to use [GIT][] for version control, there is a mirror of the official KiCad
repository on [Github][]. GIT is optional if you are going to build a stable version of
KiCad from a source archive. Please note that the Github mirror is read only. Do not submit
pull requests to Github. Changes should be sent to the KiCad developer's [mailing list][] as
an attached patch with [PATCH] at the beginning of the subject.
## Doxygen Code Documentation Generator ## {#doxygen_section}
The KiCad source code is documented using [Doxygen][] which parses the KiCad source code files
and builds a dependency tree along with the source documentation into HTML. Doxygen is only
required if you are going to build the KiCad documentation.
## SWIG Simplified Wrapper and Interface Generator ## {#swig}
[SWIG][] is used to generate the Python scripting language extensions for KiCad. SWIG is not
required if you are not going to build the KiCad scripting extension.
# Library Dependencies # {#library_dependencies}
This section includes a list of library dependencies required to build KiCad. It does not
include any dependencies of the libraries. Please consult the library's documentation for any
additional dependencies. Some of these libraries are optional depending on you build
configuration. This is not a guide on how to install the library dependencies using you systems
package management tools or how to build the library from source. Consult the appropriate
documentation to perform these tasks.
## wxWidgets Cross Platform GUI Library## {#wxwidgets}
[wxWidgets][] is the graphical user interface (GUI) library used by KiCad. The current minimum
version is 3.0.0. However, 3.0.2 should be used whenever possible as there are some known bugs
in prior versions that can cause problems on some platforms. Please note that there are also
some platform specific patches that must be applied before building wxWidgets from source. These
patches can be found in the [patches folder][] in the KiCad source. These patches are named by
the wxWidgets version and platform name they should be applied against. wxWidgets must be built
with the --with-opengl option. If you installed the packaged version of wxWidgets on your system,
verify that it was built with this option.
## Boost C++ Libraries ## {#boost}
The [Boost][] C++ library is required only if you intend to build KiCad with the system installed
version of Boost instead of the default internally built version. If you use the system installed
version of Boost, version 1.56 or greater is required. Please note there are some platform
specific patches required to build a working Boost library. These patches can be found in the
[patches folder][] in the KiCad source. These patches are named by the platform name they should
be applied against.
## OpenSSL Secure Socket Layer Library ## {#openssl}
The [OpenSSL][] library is only required when the KiCad build is configured with the Github plugin
enabled. See the [KiCad Build Configuration Options](#build_opts)` section for more information.
Please note that KiCad will download and build version 1.0.1e of OpenSSL by default. You should
probably use the version of OpenSSL installed on your system as it will most likely be more up to
date and contain the latest security fixes.
## GLEW OpenGL Extension Wrangler Library ## {#glew}
The [OpenGL Extension Wrangler][GLEW] is an OpenGL helper library used by the KiCad graphics
abstraction library [GAL] and is always required to build KiCad.
## GLUT OpenGL Utility Toolkit Library ## {#glut}
The [OpenGL Utility Toolkit][GLUT] is an OpenGL helper library used by the KiCad graphics
abstraction library [GAL] and is always required to build KiCad.
## Cairo 2D Graphics Library ## {#cairo}
The [Cairo][] 2D graphics library is used as a fallback rendering canvas when OpenGL is no
available and is always required to build KiCad.
## Python Programming Language ## {#python}
The [Python][] programming language is used to provide scripting support to KiCad. It only needs
to be install if the [KiCad scripting](#kicad_scripting) build configuration option is enabled.
## wxPython Library ## {#wxpython}
The [wxPython][] library is used to provide a scripting console for Pcbnew. It only needs to be
installed if the [wxPython scripting](#wxpython_scripting) build configuration option is enabled.
When building KiCad with wxPython support, make sure the version of the wxWidgets library and
the version of wxPython installed on your system are the same. Mismatched versions have been
known to cause runtime issues.
# KiCad Build Configuration Options # {#build_opts}
KiCad has many build options that can be configured to build different options depending on
the availability of support for each option on a given platform. This section documents
these options and their default values.
## Case Sensitivity ## {#case_sensitive_opt}
The KICAD_KEEPCASE option allows you to build KiCad so that the string matching for component
names is case sensitive of case insensitive. This option is enabled by default.
## Advanced Graphics Context ## {#graphics_context_opt}
The USE_WX_GRAPHICS_CONTEXT option replaces wxDC with wxGraphicsContext for graphics rendering.
This option is disabled by default. Warning: the is experimental and has not been maintained
so use at your own risk.
## Graphics Context Overlay ## {#overlay_opt}
The USE_WX_OVERLAY option is used to enable the optional wxOverlay class for graphics rendering
on OSX. This is enabled on OSX by default and disabled on all other platforms.
## Scripting Support ## {#scripting_opt}
The KICAD_SCRIPTING option is used to enable building the Python scripting support into Pcbnew.
This options is disabled by default.
## Scripting Module Support ## {#scripting_mod_opt}
The KICAD_SCRIPTING_MODULES option is used to enable building and installing the Python modules
supplied by KiCad. This option is disabled by default.
## wxPython Scripting Support ## {#wxpython_opt}
The KICAD_SCRIPTING_WXPYTHON option is used to enable building the wxPython interface into
Pcbnew including the wxPython console. This option is disabled by default.
## Build with Static Libraries ## {#static_lib_opt}
The KICAD_BUILD_STATIC option is used to build KiCad with static libraries. This option is
used for OSX builds only and is disabled by default.
## Build with Dynamic Libraries ## {#dynamic_lib_opt}
The KICAD_BUILD_DYNAMIC option is used to build KiCad with dynamic libraries. This option is
used for OSX only and is disabled by default.
## Build with System Boost ## {#boost_opt}
The KICAD_SKIP_BOOST option allow you to use the Boost libraries installed on your system to
be used instead of downloading Boost 1.54 and building a custom version specifically for
building KiCad. It is high recommended that you enable this option on Linux and use Boost
version 1.56 or greater. On other platforms you mileage may vary. This option is disabled
by default.
## OSX Dependency Builder ## {#osx_deps_opt}
The USE_OSX_DEPS_BUILDER option forces the build configuration to download and build the
required dependencies to build KiCad on OSX. This option is not longer maintained and most
likely is broken. Use it at your own peril.
## Github Plugin ## {#github_opt}
The BUILD_GITHUB_PLUGIN option is used to control if the Github plugin is built. This option is
enabled by default.
# Getting the KiCad Source Code ## {#getting_src}
There are several ways to get the KiCad source. If you want to build the stable version you
can down load the source archive from the [KiCad Launchpad] developers page. Use tar or some
other archive program to extract the source on your system. If you are using tar, use the
following command:
tar -xzf kicad_src_archive.tar.gz
If you are contributing directly to the KiCad project on Launchpad, you can create a local
branch on your machine by using the following command:
bzr branch lp:repo_to_branch
If you prefer to use [GIT][] as you version control system, you can clone the KiCad mirror on
Github using the following command:
git clone https://github.com/KiCad/kicad-source-mirror
Here is a list of source links:
Stable release archive: https://launchpad.net/kicad/4.0/4.0.0-rc1/+download/kicad-4.0.0-rc1.tar.xz
Development branch: https://code.launchpad.net/~kicad-product-committers/kicad/product
Github mirror: https://github.com/KiCad/kicad-source-mirror
# Building KiCad on Linux # {#build_linux}
To full KiCad build on Linux, do the following:
```
cd kicad_source_tree
mkdir -p build/release
mkdir build/debug # Optional for debug build.
cd build/release
cmake -DCMAKE_BUILD_TYPE=Release \
-DKICAD_SCRIPTING=ON \
-DKICAD_SCRIPTING_MODULES=ON \
-DKICAD_SCRIPTING_WXPYTHON=ON \
../../
make
sudo make install
```
If the CMake configuration fails, determine the missing dependencies and install them on your
system. By default, CMake sets the install path on Linux to /usr/local. Use the
CMAKE_INSTALL_PREFIX option to specify a different install path.
# Building KiCad on Windows # {#build_windows}
The preferred Windows build environment is [MSYS2][]. The [MinGW][] build environment is still
supported but it is not recommended because the developer is responsible for building *all* of
the dependencies from source which is a huge and frustrating undertaking. The [MSYS2][] project
provides packages for all of the require dependencies to build KiCad. To setup the [MSYS2][]
build environment, depending on your system download and run either the [MSYS2 32-bit Installer][]
or the [MSYS2 64-bit Installer][]. After the installer is finished, update to the latest
package versions by running the `msys2_shell.bat` file located in the MSYS2 install path and
running the command `pacman -Syu`. If the msys2-runtime package is updated, close the shell
and run `msys2_shell.bat`.
## MSYS2 the Easy Way ## {#msys2_easy}
The easiest way to build KiCad using the [MSYS2][] build environment is to use the KiCad
[PKGBUILD][] provided by the MSYS2 project to build package using the head of the KiCad
development branch. To build the KiCad package, run the `msys2_shell.bat` file located in the
MSYS2 install path and run the following commands:
```
pacman -S git
mkdir src
cd src
git clone https://github.com/Alexpux/MINGW-packages
cd MinGW-packages/mingw-w64-kicad-git
makepkg-mingw -is
```
This will download and install all of the build dependencies, clone the KiCad source mirror
from Github, create both 32-bit and 64-bit KiCad packages depending on your MSYS setup, and
install the newly built KiCad packages. Please note that this build process takes a very
long time to build even on a fast system.
## MSYS2 the Hard Way ## {#msys2_hard}
If you do not want to create KiCad packages and prefer the traditional `make && make install`
method of building KiCad, your task is significantly more involved. For 64 bit builds run
the `mingw64_shell.bat` file located in the MSYS2 install path. At the command prompt run the
the following commands:
```
pacman -S mingw-w64-x86_64-cmake \
mingw-w64-x86_64-doxygen \
mingw-w64-x86_64-gcc \
mingw-w64-x86_64-python2 \
mingw-w64-x86_64-pkg-config \
mingw-w64-x86_64-swig \
mingw-w64-x86_64-boost \
mingw-w64-x86_64-cairo \
mingw-w64-x86_64-glew \
mingw-w64-x86_64-openssl \
mingw-w64-x86_64-wxPython \
mingw-w64-x86_64-wxWidgets
cd kicad-source
mkdir -p build/release
mkdir build/debug # Optional for debug build.
cd build/release
cmake -DCMAKE_BUILD_TYPE=Release \
-G "MSYS Makefiles" \
-DCMAKE_PREFIX_PATH=/mingw64 \
-DCMAKE_INSTALL_PREFIX=/mingw64 \
-DDEFAULT_INSTALL_PATH=/mingw64 \
-DOPENSSL_ROOT_DIR=/mingw64 \
-DKICAD_SKIP_BOOST=ON \
-DKICAD_SCRIPTING=ON \
-DKICAD_SCRIPTING_MODULES=ON \
-DKICAD_SCRIPTING_WXPYTHON=ON \
../../
make install
```
# Building KiCad on OSX # {#build_osx}
Building on OSX is challenging at best. It typically requires building dependency libraries
that require patching in order to work correctly. For more information on the complexities of
building KiCad on OSX, see the [OSX bundle build scripts][].
Download the wxPython source and build using the following commands:
```
cd path-to-wxwidgets-src
patch -p0 < path-to-kicad-src/patches/wxwidgets-3.0.0_macosx.patch
patch -p0 < path-to-kicad-src/wxwidgets-3.0.0_macosx_bug_15908.patch
patch -p0 < path-to-kicad-src/patches/wxwidgets-3.0.0_macosx_soname.patch
patch -p0 < path-to-kicad-src/patches/wxwidgets-3.0.2_macosx_yosemite.patch
patch -p0 < path-to-kicad-src/patches/wxwidgets-3.0.0_macosx_scrolledwindow.patch
mkdir build
cd build
export MAC_OS_X_VERSION_MIN_REQUIRED=10.7
../configure \
--prefix=`pwd`/../wx-bin \
--with-opengl \
--enable-aui \
--enable-utf8 \
--enable-html \
--enable-stl \
--with-libjpeg=builtin \
--with-libpng=builtin \
--with-regex=builtin \
--with-libtiff=builtin \
--with-zlib=builtin \
--with-expat=builtin \
--without-liblzma \
--with-macosx-version-min=10.7 \
--enable-universal-binary=i386,x86_64 \
CC=clang \
CXX=clang++
```
Build KiCad using the following commands:
```
cd kicad-source
mkdir -p build/release
mkdir build/debug # Optional for debug build.
cd build/release
cmake -DCMAKE_C_COMPILER=clang \
-DCMAKE_CXX_COMPILER=clang++ \
-DCMAKE_OSX_DEPLOYMENT_TARGET=10.7 \
-DwxWidgets_CONFIG_EXECUTABLE=path-to-wx-install/bin/wx-config \
-DKICAD_SCRIPTING=ON \
-DKICAD_SCRIPTING_MODULES=ON \
-DKICAD_SCRIPTING_WXPYTHON=ON \
-DPYTHON_EXECUTABLE=path-to-python-exe/python \
-DPYTHON_SITE_PACKAGE_PATH=wx/wx-bin/lib/python2.7/site-packages \
-DCMAKE_INSTALL_PREFIX=../bin \
-DCMAKE_BUILD_TYPE=Release \
../../
make
make install
```
[download]: http://kicad-pcb.org/download/
[KiCad website]: http://kicad-pcb.org/
[KiCad Launchpad]: https://launchpad.net/kicad
[GNU GCC]: https://gcc.gnu.org/
[Clang]: http://clang.llvm.org/
[CMake]: https://cmake.org/
[Launchpad]: https://code.launchpad.net/~kicad-product-committers/kicad/product
[Bazaar]: http://bazaar.canonical.com/en/
[GIT]: https://git-scm.com/
[Github]: https://github.com/KiCad/kicad-source-mirror
[Doxygen]: http://www.stack.nl/~dimitri/doxygen/
[mailing list]: https://launchpad.net/~kicad-developers
[SWIG]: http://www.swig.org/
[wxWidgets]: http://wxwidgets.org/
[patches folder]: http://bazaar.launchpad.net/~kicad-product-committers/kicad/product/files/head:/patches/
[Boost]: http://www.boost.org/
[OpenSSL]: https://www.openssl.org/
[GLEW]: http://glew.sourceforge.net/
[GLUT]: https://www.opengl.org/resources/libraries/glut/
[Cairo]: http://cairographics.org/
[Python]: https://www.python.org/
[wxPython]: http://wxpython.org/
[MSYS2]: http://msys2.github.io/
[MSYS2 32-bit Installer]: http://repo.msys2.org/distrib/i686/msys2-i686-20150916.exe
[MSYS2 64-bit Installer]: http://repo.msys2.org/distrib/x86_64/msys2-x86_64-20150916.exe
[PKGBUILD]: https://github.com/Alexpux/MINGW-packages/blob/master/mingw-w64-kicad-git/PKGBUILD
[OSX bundle build scripts]:http://bazaar.launchpad.net/~adamwolf/+junk/kicad-mac-packaging/files

View File

@ -648,6 +648,7 @@ WARN_LOGFILE =
INPUT = Documentation/development/coding-style-policy.md \
Documentation/development/stable-release-policy.md \
Documentation/development/road-map.md \
Documentation/development/compiling.md \
kicad \
pcbnew \
cvpcb \