2010-01-31 19:49:53 +00:00
|
|
|
Compiling KiCad from Source
|
|
|
|
===========================
|
|
|
|
KiCad Documentation Team
|
2012-03-15 08:56:55 +00:00
|
|
|
Last revised on 12-mars-2012 by jp Charras
|
2010-01-31 19:49:53 +00:00
|
|
|
|
|
|
|
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:
|
2007-12-20 02:56:03 +00:00
|
|
|
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.
|
|
|
|
|
2010-01-31 19:49:53 +00:00
|
|
|
On linux:
|
2009-05-21 17:42:42 +00:00
|
|
|
|
2010-01-31 19:49:53 +00:00
|
|
|
Install "mesa". Use your package manager to install the
|
|
|
|
development libaries.
|
2009-05-21 17:42:42 +00:00
|
|
|
|
2012-03-15 08:56:55 +00:00
|
|
|
After a fresh install you need the following packages to compile and run
|
|
|
|
KiCad from source.
|
|
|
|
|
|
|
|
CMake - Cross-platform make
|
|
|
|
GLUT - The OpenGL Utility Library
|
|
|
|
wxGTK or wxWidgets - The wxWidgets GUI toolkit with GTK+ bindings
|
|
|
|
|
|
|
|
Boost - Collection of portable C++ source libraries
|
|
|
|
Because boost is in the repository of kicad you don't need to install them.
|
|
|
|
|
|
|
|
Useful, but not required:
|
|
|
|
Doxygen - Documentation system for several programming languages
|
|
|
|
|
|
|
|
|
|
|
|
Compiler and basic development tools
|
2010-01-31 19:49:53 +00:00
|
|
|
-------------
|
|
|
|
Make sure g++, make and other tools are in your path.
|
2007-12-20 02:56:03 +00:00
|
|
|
If windows, then try running g++ and make from within your msys bash shell.
|
|
|
|
|
2009-05-21 17:42:42 +00:00
|
|
|
|
2010-01-31 19:49:53 +00:00
|
|
|
Install or Build wxWidgets
|
|
|
|
--------------------------
|
2011-04-12 12:41:13 +00:00
|
|
|
|
|
|
|
WARNING:
|
|
|
|
see wxWidgets_patch_notes.txt for patches and issues in wxWidgets.
|
|
|
|
|
2012-03-15 08:56:55 +00:00
|
|
|
If on Windows, download
|
2012-02-26 18:49:00 +00:00
|
|
|
http://sourceforge.net/projects/wxwindows/files/wxAll/2.9.3/wxWidgets-2.9.3.zip/download
|
2010-01-31 19:49:53 +00:00
|
|
|
or a newer version.
|
2012-03-15 08:56:55 +00:00
|
|
|
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 abd the debug version are same.
|
2008-01-06 13:23:30 +00:00
|
|
|
|
2012-03-15 08:56:55 +00:00
|
|
|
Unzip the wxWidgets zip file into the build directory. Change directories into
|
|
|
|
there, and then:
|
2008-01-06 13:23:30 +00:00
|
|
|
|
2012-03-15 08:56:55 +00:00
|
|
|
mkdir Release
|
|
|
|
cd Release
|
|
|
|
../configure --enable-unicode --enable-monolithic=no --disable-shared --with-opengl
|
2008-01-06 13:23:30 +00:00
|
|
|
make
|
|
|
|
|
2012-03-15 08:56:55 +00:00
|
|
|
and under Linux, but not under Windows:
|
|
|
|
sudo make install that install wxWidgets libs and headers in /usr/local/
|
2010-02-10 16:25:13 +00:00
|
|
|
|
2007-12-20 02:56:03 +00:00
|
|
|
|
2012-03-15 08:56:55 +00:00
|
|
|
If on linux, you can use your package manager to install the
|
2008-01-06 12:03:13 +00:00
|
|
|
development versions of the wxWidgets packages which include the C++ headers. An
|
|
|
|
alternative is to build static libaries from source. Verify that wx-config is in
|
|
|
|
your path by running it from a command prompt. Linux users then go to next step.
|
|
|
|
|
2010-01-31 19:49:53 +00:00
|
|
|
Install CMake
|
|
|
|
-------------
|
2008-06-22 16:02:08 +00:00
|
|
|
If windows, download the installation binary for windows from cmake.org.
|
2007-12-20 02:56:03 +00:00
|
|
|
Install that and choose to add cmake to your path during installation. You
|
|
|
|
will have to restart and command shells for the new path to take effect.
|
|
|
|
Verify that cmake is in your path by trying to run it from a command prompt.
|
|
|
|
|
2008-01-06 12:03:13 +00:00
|
|
|
|
2012-02-26 18:49:00 +00:00
|
|
|
If linux, use your package manager to install cmake. You should get cmake 2.6.4
|
2007-12-20 02:56:03 +00:00
|
|
|
or later. If only an older one is available in your package repository, build
|
2012-02-26 18:49:00 +00:00
|
|
|
cmake from source. Verify that cmake is in your path by trying to run it from a
|
2007-12-20 02:56:03 +00:00
|
|
|
command prompt.
|
|
|
|
|
2009-05-21 17:42:42 +00:00
|
|
|
|
2010-01-31 19:49:53 +00:00
|
|
|
Obtain Sources
|
|
|
|
--------------
|
2011-04-12 12:41:13 +00:00
|
|
|
You can use the Launchpad repository or a tar file for this. See the wiki.
|
2012-03-15 08:56:55 +00:00
|
|
|
To download files from Launchpad repository, you should install bazaar (bzr) that is a
|
|
|
|
version control system like subversion, mercurial, git...
|
2011-04-12 12:41:13 +00:00
|
|
|
|
2012-03-15 08:56:55 +00:00
|
|
|
Launchpad repository handle 2 branches for KiCda sources:
|
2011-04-12 12:41:13 +00:00
|
|
|
- a testing branch (used by developers)
|
|
|
|
- a stable branch (a copy of the testing branch, when this testing branch is near a stable state))
|
2007-12-20 02:56:03 +00:00
|
|
|
|
2012-03-15 08:56:55 +00:00
|
|
|
Testing branch:
|
|
|
|
bzr branch lp:kicad kicad_testing
|
|
|
|
|
|
|
|
Stable branch:
|
|
|
|
bzr branch lp:kicad/stable kicad_stable
|
|
|
|
|
|
|
|
Components and Footprints libraries
|
|
|
|
bzr branch lp:~kicad-lib-committers/kicad/library kicad_libraries
|
|
|
|
|
|
|
|
Documentation and translations:
|
|
|
|
bzr branch lp:~kicad-developers/kicad/doc kicad_doc
|
2009-05-21 17:42:42 +00:00
|
|
|
|
2010-01-31 19:49:53 +00:00
|
|
|
Create Makefiles with CMake
|
|
|
|
---------------------------
|
2008-06-22 16:02:08 +00:00
|
|
|
If windows, go into your msys shell. Linux and windows users both then make
|
2007-12-20 02:56:03 +00:00
|
|
|
two "out of source" build directories:
|
|
|
|
cd <kicadSource>
|
2008-03-11 15:57:54 +00:00
|
|
|
mkdir -p build/release
|
2012-03-15 08:56:55 +00:00
|
|
|
mkdir build/debug (if you want a debug version of KiCad)
|
2008-03-11 15:57:54 +00:00
|
|
|
cd build/release
|
2007-12-20 02:56:03 +00:00
|
|
|
|
|
|
|
On either cmake command line shown below, you can optionally include
|
|
|
|
-DCMAKE_INSTALL_PREFIX=<finallInstallDir>
|
2008-01-06 12:03:13 +00:00
|
|
|
|
2007-12-20 02:56:03 +00:00
|
|
|
If windows, run the following command:
|
2012-03-15 08:56:55 +00:00
|
|
|
cmake -G "MSYS Makefiles" -DCMAKE_BUILD_TYPE=Release -DKICAD_TESTING_VERSION=ON -DwxWidgets_ROOT_DIR=<wxInstallDir> ../../
|
2007-12-20 02:56:03 +00:00
|
|
|
|
|
|
|
If linux, run instead the following command:
|
2008-01-06 12:03:13 +00:00
|
|
|
cmake -DCMAKE_BUILD_TYPE=Release ../../
|
2007-12-20 02:56:03 +00:00
|
|
|
|
|
|
|
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.
|
|
|
|
|
2010-01-31 19:49:53 +00:00
|
|
|
Compiling with Make
|
|
|
|
------------------~
|
2008-06-22 16:02:08 +00:00
|
|
|
You compile Kicad here. You will only need to do step 8) again when one of the
|
2007-12-20 02:56:03 +00:00
|
|
|
CMakeLists.txt files change. If windows, you must be in your msys shell.
|
|
|
|
On either platform then:
|
2009-05-21 17:42:42 +00:00
|
|
|
|
2008-03-11 15:57:54 +00:00
|
|
|
cd <kicadSource>/build/release
|
2007-12-20 02:56:03 +00:00
|
|
|
make
|
|
|
|
[sudo] make install
|
|
|
|
|
|
|
|
You are now done unless you want to make a Debug build.
|
|
|
|
|
2009-05-21 17:42:42 +00:00
|
|
|
|
2010-01-31 19:49:53 +00:00
|
|
|
Compiling a Debug version
|
|
|
|
-------------------------
|
2008-03-11 15:57:54 +00:00
|
|
|
cd <kicadSource>/build/debug
|
2007-12-20 02:56:03 +00:00
|
|
|
|
|
|
|
On either cmake command line shown below, you can optionally include
|
2009-05-21 17:42:42 +00:00
|
|
|
-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.
|
2007-12-20 02:56:03 +00:00
|
|
|
|
|
|
|
If windows, run the following command:
|
2012-03-15 08:56:55 +00:00
|
|
|
cmake -G "MSYS Makefiles" -DCMAKE_BUILD_TYPE=Debug -DKICAD_TESTING_VERSION=ON -DwxWidgets_ROOT_DIR=<wxInstallDir> ../../
|
|
|
|
where <wxInstallDir> is <wxWidgets path>/Release
|
2007-12-20 02:56:03 +00:00
|
|
|
|
|
|
|
If linux, run instead the following command:
|
2008-01-06 12:03:13 +00:00
|
|
|
cmake -DCMAKE_BUILD_TYPE=Debug -DwxWidgets_USE_DEBUG=ON ../../
|
2007-12-20 02:56:03 +00:00
|
|
|
|
|
|
|
Make the Debug binaries:
|
|
|
|
make
|
2008-01-06 12:03:13 +00:00
|
|
|
|
2009-05-21 17:42:42 +00:00
|
|
|
|
2010-01-31 19:49:53 +00:00
|
|
|
Fine-tune Build Process
|
|
|
|
-----------------------
|
2008-03-12 09:18:51 +00:00
|
|
|
These should be set from command line:
|
|
|
|
|
2011-04-12 12:41:13 +00:00
|
|
|
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
|
|
|
|
|
2008-03-12 09:18:51 +00:00
|
|
|
CMAKE_BUILD_TYPE Release/Debug (REQUIRED)
|
|
|
|
Choose build type: Release/Debug.
|
|
|
|
|
|
|
|
wxWidgets_USE_STATIC ON/OFF (OPTIONAL)
|
2008-06-22 16:02:08 +00:00
|
|
|
|
2008-03-12 09:18:51 +00:00
|
|
|
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)
|
2008-06-22 16:02:08 +00:00
|
|
|
|
2010-02-10 16:25:13 +00:00
|
|
|
USE_WX_GRAPHICS_CONTEXT ON/OFF (OPTIONAL)
|
2011-02-12 19:38:55 +00:00
|
|
|
*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.
|
2010-02-10 16:25:13 +00:00
|
|
|
See building wxWidgets above.
|
|
|
|
|
2011-08-29 19:50:05 +00:00
|
|
|
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.
|
|
|
|
|
2008-01-06 12:03:13 +00:00
|
|
|
Note: that it is easy to build only a specific binary such as pcbnew alone:
|
2007-12-20 02:56:03 +00:00
|
|
|
make pcbnew
|