kicad/COMPILING.txt

279 lines
9.9 KiB
Plaintext
Raw Normal View History

--== How to build kicad ==--
2007-12-28 03:38:27 +00:00
First Written: 19-Dec-2007
Last Revised: 13-May-2009
2007-12-20 02:56:03 +00:00
Kicad needs wxWidgets, the multi platform G.U.I.
Perform these steps in sequence. (Platform specific details are given in
sections below.)
1) If windows, then install "msys" and "mingw".
2007-12-28 03:38:27 +00:00
2) If linux, then install "mesa".
3) Make sure g++ and "make" are in your path.
4) Install wxWidgets [and build it if on windows].
5) Install zlib [and build it if on windows].
6) Install CMAKE
7) Install Boost C++ Template Libraries (*.hpp files)
8) Install the kicad source tree.
9) Use cmake to build the kicad makefiles.
10) Use make to build and install kicad.
11) Making a "Debug" build.
12) Variables for fine-tuning the build process.
2007-12-20 02:56:03 +00:00
===== Step Details ====================================================
1) If windows, then install "msys" and "mingw".
2007-12-20 02:56:03 +00:00
Skip this step if on a Unix box. 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.
2007-12-20 02:56:03 +00:00
-----------------------------------------------------------------------------
2) If linux, install "mesa". Use your package manager to install the
development libaries.
2007-12-20 02:56:03 +00:00
-----------------------------------------------------------------------------
2007-12-28 03:38:27 +00:00
3) Make sure g++ and "make" 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.
2007-12-20 02:56:03 +00:00
-----------------------------------------------------------------------------
2007-12-28 03:38:27 +00:00
4) Install wxWidgets [and build it if on windows].
2007-12-20 02:56:03 +00:00
If on windows, download
2008-06-22 16:02:08 +00:00
http://prdownloads.sourceforge.net/wxwindows/wxMSW-2.8.8.zip or a newer version.
2007-12-20 02:56:03 +00:00
Start msys so you have a bash shell. Decide where your wxWidgets build directory
2008-06-22 16:02:08 +00:00
will be. It must be where you can access it from within the msys environment,
such as home/<user>. Edit your msys/1.0/etc/fstab file if needed to provide
2008-01-06 13:23:30 +00:00
access to this build directory from msys. (Note that if you want you can build
a "debug" version of the wxWidgets library at this point, instead of the release
version, or in addition to the the release version.)
Unzip the wmMWS zip file into the build directory. Change directories into
there, and then:
2008-01-06 13:23:30 +00:00
mkdir build-release
mkdir build-debug
-- release
cd build-release
../configure --enable-unicode --enable-monolithic --disable-shared --with-msw --with-opengl
2007-12-20 02:56:03 +00:00
make
make install
2008-01-06 13:23:30 +00:00
-- debug
cd build-debug
../configure --enable-unicode --enable-monolithic --enable-debug --enable-debug_gdb --disable-shared --with-msw --with-opengl
2008-01-06 13:23:30 +00:00
make
make install
2008-06-22 16:02:08 +00:00
I think the default is to install into /usr/local/wxMSW-2.8.8. You can probably
2007-12-20 02:56:03 +00:00
pass --prefix=<wxInstallDir> to configure above to change where "make install"
puts everything. We will refer to <wxInstallDir> again below. Without the
--prefix=<wxInstallDir> passed to configure, <wxInstallDir> will likely be
2008-06-22 16:02:08 +00:00
/usr/local/wxMSW-2.8.8
2007-12-20 02:56:03 +00:00
Verify that wx-config is in your path. Modify your PATH environment variable
2008-06-22 16:02:08 +00:00
if need be so you can run wx-config from a command prompt. You may have to
2007-12-20 02:56:03 +00:00
restart your msys shell, depending on how you modify your PATH.
If on linux, use your package manager to install shared object libraries and the
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.
-----------------------------------------------------------------------------
5) Install zlib [and build it if on windows].
If on windows, download http://www.zlib.net/zlib123.zip or a newer version.
Start msys so you have a bash shell. Decide where your zlib build directory
will be. It must be where you can access it from within the msys environment,
2008-06-22 16:02:08 +00:00
such as home/<user>. Edit your msys/1.0/etc/fstab file if needed to provide
access to this build directory from msys. Unzip the zlib123.zip file into this
build directory. Change directories into there, and then:
./configure
make
make install
If linux, use your package manager to install zlib pre-built binaries.
Note (JP Charras):
Under Linux, zlib is usually installed.
If it is not found by the wxWidget installation, wxWidgets creates an alternate zlib library.
Under Windows, if zlib is not installed, my cmake build will try to use the
wxWidgets zlib build. So, under windows kicad build should work without
zlib install.
If you are using the wxWidget zlib, make sure that the wxWidgets/src/zlib directory is copied
to ${wxWidgets_ROOT_DIR}/src/zlib
-----------------------------------------------------------------------------
6) 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.
If linux, use your package manager to install cmake. You should get cmake 2.6.1
2007-12-20 02:56:03 +00:00
or later. If only an older one is available in your package repository, build
2.6.1 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.
2008-02-06 22:13:19 +00:00
-----------------------------------------------------------------------------
7) Install Boost C++ Libraries
Under linux, boost is already installed, but can be too old.
If this is the case, you *must* update boost.
Go to http://www.boost.org/ dowlload the latest version of boost.
unzip (or untar) boots file.
under Windows, files can be installed (unzipped) everywhere, but when create
makefiles using cmake, you will have a message saying boost is not found,
something like:
-- Check for installed Boost -- not found
CMake Error at CMakeModules/CheckFindPackageResult.cmake:6 (message):
Boost was not found - it is required to build Kicad
Edit the CMakeCache.txt file to replace the Boost_INCLUDE_DIR "notfound" value by the right value:
You must find a line like
//Path to a file.
Boost_INCLUDE_DIR:PATH=Boost_INCLUDE_DIR-NOTFOUND
and edit it to set the right path, something like:
Boost_INCLUDE_DIR:PATH=f:/boost/boost
(on my computer boost is unzipper in f:\boost, and boost installed files are
in f:\boost\boost)
2007-12-20 02:56:03 +00:00
-----------------------------------------------------------------------------
8) Install the kicad source tree.
2008-06-22 16:02:08 +00:00
You can use the subversion repository or a tar file for this. See the wiki.
2007-12-20 02:56:03 +00:00
2007-12-20 02:56:03 +00:00
-----------------------------------------------------------------------------
9) Use cmake to create the kicad makefiles.
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
mkdir build/debug
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>
2007-12-20 02:56:03 +00:00
If windows, run the following command:
cmake -G "MSYS Makefiles" -DCMAKE_BUILD_TYPE=Release -DwxWidgets_ROOT_DIR=<wxInstallDir> ../../
2007-12-20 02:56:03 +00:00
If linux, run instead the following command:
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.
CMake will try and find the boost header files and will often fail. If it
fails, you will have to edit your CMakeCache.txt file manually and set your
Boost_INCLUDE_DIR:PATH=/svn/boost-trunk
setting to point to the base of the boost installation directory. Account
for the fact that the boost #include references use a <boost/..> type prefix.
Example C++ code: #include <boost/ptr_container/ptr_vector.hpp> and please
notice the leading <boost/ in the path.
So point your Boost_INCLUDE_DIR:PATH= variable to a directory above the
"boost" directory.
2007-12-20 02:56:03 +00:00
-----------------------------------------------------------------------------
10) Use make to build and install kicad.
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:
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.
2007-12-20 02:56:03 +00:00
-----------------------------------------------------------------------------
11) Making a "Debug" build.
2007-12-20 02:56:03 +00:00
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
-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:
cmake -G "MSYS Makefiles" -DCMAKE_BUILD_TYPE=Debug -DwxWidgets_USE_DEBUG=ON -DwxWidgets_ROOT_DIR=<wxInstallDir> ../../
2007-12-20 02:56:03 +00:00
If linux, run instead the following command:
cmake -DCMAKE_BUILD_TYPE=Debug -DwxWidgets_USE_DEBUG=ON ../../
2007-12-20 02:56:03 +00:00
Make the Debug binaries:
make
-----------------------------------------------------------------------------
12) Variables for fine-tuning the build process.
These should be set from command line:
CMAKE_BUILD_TYPE Release/Debug (REQUIRED)
Choose build type: Release/Debug.
wxWidgets_USE_DEBUG ON/OFF (REQUIRED)
Should be set to ON only when CMAKE_BUILD_TYPE=Debug.
wxWidgets_USE_STATIC ON/OFF (OPTIONAL)
2008-06-22 16:02:08 +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
KICAD_MINIZIP ON/OFF
2008-06-22 16:02:08 +00:00
KICAD_PYTHON ON/OFF
2008-06-22 16:02:08 +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
-----------------------------------------------------------------------------