2008-01-06 12:03:13 +00:00
|
|
|
--== How to build kicad using CMAKE ==--
|
2007-12-28 03:38:27 +00:00
|
|
|
First Written: 19-Dec-2007
|
2008-01-06 12:03:13 +00:00
|
|
|
Last Revised: 06-Jan-2008
|
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].
|
2008-01-05 17:43:24 +00:00
|
|
|
5) Install zlib [and build it if on windows].
|
|
|
|
6) Install CMAKE
|
2008-01-18 06:54:54 +00:00
|
|
|
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.
|
2007-12-20 02:56:03 +00:00
|
|
|
|
|
|
|
|
|
|
|
===== Step Details ====================================================
|
|
|
|
|
|
|
|
1) If windows, then install "msys" and "mingw".
|
|
|
|
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-28 03:38:27 +00:00
|
|
|
2) If linux, install "mesa". Use your package manager to install the development
|
2007-12-20 02:56:03 +00:00
|
|
|
libaries.
|
|
|
|
|
|
|
|
-----------------------------------------------------------------------------
|
|
|
|
|
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-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
|
|
|
|
http://prdownloads.sourceforge.net/wxwindows/wxMSW-2.8.7.zip or a newer version.
|
|
|
|
Start msys so you have a bash shell. Decide where your wxWidgets build directory
|
|
|
|
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:
|
|
|
|
|
|
|
|
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
|
|
|
|
../confgiure --enable-unicode --enable-monolithic --enable-debug --enable-debug_gdb --disable-shared --with-msw --with-opengl
|
|
|
|
make
|
|
|
|
make install
|
|
|
|
|
2007-12-20 02:56:03 +00:00
|
|
|
I think the default is to install into /usr/local/wxMSW-2.8.7. You can probably
|
|
|
|
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
|
|
|
|
/usr/local/wxMSW-2.8.7
|
|
|
|
|
|
|
|
Verify that wx-config is in your path. Modify your PATH environment variable
|
|
|
|
if need be so you can run wx-config from a command prompt. You may have to
|
|
|
|
restart your msys shell, depending on how you modify your PATH.
|
|
|
|
|
2008-01-06 12:03:13 +00:00
|
|
|
|
|
|
|
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.
|
|
|
|
|
2008-01-05 17:43:24 +00:00
|
|
|
|
2008-01-29 22:36:00 +00:00
|
|
|
-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
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,
|
|
|
|
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 (CHANGES NEEDED!!!)
|
|
|
|
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 not found by wxWidget installation, wxWidgets creates an alternate zlib
|
|
|
|
Under Windows, zlib is not installed, so my cmake buld try to use the wxWidgets zlib build.
|
|
|
|
So, under windows kicad build should work without zlib install.
|
|
|
|
|
2008-01-05 17:43:24 +00:00
|
|
|
-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
6) Install CMAKE.
|
2007-12-20 02:56:03 +00:00
|
|
|
If 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 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
|
|
|
|
2007-12-20 02:56:03 +00:00
|
|
|
If linux, use your package manager to install cmake. You should get cmake 2.4.7
|
|
|
|
or later. If only an older one is available in your package repository, build
|
|
|
|
2.4.7 from source. Verify that cmake is in your path by trying to run it from a
|
|
|
|
command prompt.
|
|
|
|
|
2008-02-06 22:13:19 +00:00
|
|
|
-----------------------------------------------------------------------------
|
2008-01-18 06:54:54 +00:00
|
|
|
|
|
|
|
7) Install Boost C++ Libraries
|
|
|
|
If windows, well I'm guessing, so somebody please try these two options and
|
|
|
|
correct this text please according to which ever is easier:
|
|
|
|
(optionA) Go to http://sourceforge.net/project/showfiles.php?group_id=7586
|
|
|
|
and download boost_1_34_1.zip or later and unzip it so as to put the files
|
|
|
|
into C:\Program Files\boost\boost_1_34_1
|
|
|
|
(optionB)
|
|
|
|
Go to http://www.boost-consulting.com/products/free
|
|
|
|
and download the http://www.boost-consulting.com/boost_1_34_1_setup.exe
|
|
|
|
file and run it.
|
|
|
|
|
|
|
|
If linux, and using a GCC earlier than 4.2, then install the
|
|
|
|
"Boost C++ Libraries development files" or similarly named package using your
|
|
|
|
package manager. Note that if you are using gcc 4.2 or later, there were
|
|
|
|
incompatibilities that exist between boost 1.34.1 and gcc 4.2. So in this case,
|
|
|
|
instead of installing boost using your package manager, you should use the svn
|
|
|
|
HEAD copy which overcomes the gcc 4.2 incompatibility, specifically with
|
|
|
|
<boost/ptr_container/ptr_vector.hpp>.
|
|
|
|
|
|
|
|
|
2007-12-20 02:56:03 +00:00
|
|
|
-----------------------------------------------------------------------------
|
|
|
|
|
2008-01-18 06:54:54 +00:00
|
|
|
8) Install the kicad source tree.
|
2007-12-20 02:56:03 +00:00
|
|
|
You can use the subversion repository or a tar file for this. See the wiki.
|
|
|
|
|
|
|
|
-----------------------------------------------------------------------------
|
|
|
|
|
2008-01-18 06:54:54 +00:00
|
|
|
9) Use cmake to create the kicad makefiles.
|
2007-12-20 02:56:03 +00:00
|
|
|
If windows, go into your msys shell. Linux and windows users both then make
|
|
|
|
two "out of source" build directories:
|
|
|
|
cd <kicadSource>
|
2008-01-06 12:03:13 +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>
|
2008-01-06 12:03:13 +00:00
|
|
|
|
2007-12-20 02:56:03 +00:00
|
|
|
If windows, run the following command:
|
2008-01-06 12:03:13 +00:00
|
|
|
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:
|
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.
|
|
|
|
|
2008-01-18 06:54:54 +00:00
|
|
|
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
|
|
|
-----------------------------------------------------------------------------
|
|
|
|
|
2008-01-18 06:54:54 +00:00
|
|
|
10) Use make to build and install kicad.
|
2007-12-20 02:56:03 +00:00
|
|
|
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:
|
2008-01-06 12:03:13 +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.
|
|
|
|
|
|
|
|
-----------------------------------------------------------------------------
|
|
|
|
|
2008-01-18 06:54:54 +00:00
|
|
|
11) Making a "Debug" build.
|
2007-12-20 02:56:03 +00:00
|
|
|
|
2008-01-06 12:03:13 +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
|
2008-01-06 12:03:13 +00:00
|
|
|
-DCMAKE_INSTALL_PREFIX=<finallInstallDir> before the final ../../ argument. Although
|
2007-12-20 02:56:03 +00:00
|
|
|
normally you do not install the Debug binaries, you can debug them where they
|
|
|
|
were built.
|
|
|
|
|
|
|
|
If windows, run the following command:
|
2008-01-06 12:03:13 +00:00
|
|
|
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:
|
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
|
|
|
|
|
|
|
-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
End of CMAKE related building.
|
|
|
|
|
|
|
|
|
|
|
|
============= OLD STUFF NOT PERTINENT TO CMAKE ==============================
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
|
|
unzip sources in a working directory.
|
|
|
|
This will create the directory "kicad-dev".
|
|
|
|
|
|
|
|
First you must install wxWidgets (see www.wxWidgets.org)
|
2007-06-11 18:58:45 +00:00
|
|
|
See below for suggested configure command.
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
|
|
Linux compilation:
|
|
|
|
You must have:
|
|
|
|
wxWidgets ( I suggest you install wxWidgets in /usr/local).
|
2007-06-11 18:58:45 +00:00
|
|
|
(see below for suggested configure command, then make and make install)
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
|
|
Mesa: pcbnew and cvpcv need openGL or mesa.
|
|
|
|
(you must install mesa devel if libGL et libGLU are not found).
|
|
|
|
GTK 2 (install development libraries).
|
|
|
|
|
|
|
|
Because old version of Mesa has problem under a recent linux distrib (mandarke 10.1),
|
|
|
|
I am using Mesa version 6.2.1, statically compiled, installed in /usr/local
|
|
|
|
Mesa installation:
|
|
|
|
Get MesaLib-6.2.1.tar.gz from http://www.mesa3d.org/
|
|
|
|
in /usr/local : tar zxvf MesaLib-6.2.1.tar.gz
|
|
|
|
in /usr/local/Mesa-6.2.1 :
|
|
|
|
make linux-x86-static
|
|
|
|
make install ( libGL.a et libGLU.a are copied in /usr/local/lib, and header in /usr/local/include)
|
|
|
|
|
|
|
|
kicad compilation:
|
|
|
|
in kicad-dev:
|
2007-11-09 14:42:10 +00:00
|
|
|
Have a look to libs.linux (you can/must edit this file if you have problems)
|
|
|
|
Currently libs.linux uses wxWidgets 2.8.6 build (see below for suggested configure command)
|
|
|
|
lines to edit:
|
|
|
|
STD_INSTALL = 1
|
|
|
|
which can be (see comments in libs.linux)
|
2007-11-29 11:13:16 +00:00
|
|
|
STD_INSTALL = 0 (or 2)
|
2007-11-09 14:42:10 +00:00
|
|
|
|
|
|
|
after libs.linux edition:
|
2007-05-06 16:03:28 +00:00
|
|
|
run make -f makefile.gtk
|
|
|
|
|
|
|
|
Windows compilation:
|
|
|
|
|
|
|
|
kicad is build with mingw and msys.
|
2007-11-09 14:42:10 +00:00
|
|
|
Currently libs.win uses wxWidgets 2.8.6 (see below for suggested configure command)
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
|
|
install mingw and msys ( see mingw.org )
|
|
|
|
(opengl libs are included in mingw or windows)
|
|
|
|
|
|
|
|
Under msys:
|
2007-12-20 02:56:03 +00:00
|
|
|
(Warning: make.exe utility is sometime renamed mingw32-make.exe in install process
|
|
|
|
of msys.)
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2007-11-09 14:42:10 +00:00
|
|
|
Build wxWidgets (currently version 2.8.6)
|
2007-12-20 02:56:03 +00:00
|
|
|
See below for suggested configure command, then make
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2007-12-20 02:56:03 +00:00
|
|
|
In include/wx/msw/setup.h, check (and edit if needed) the defines :
|
|
|
|
#define wxUSE_GLCANVAS 1
|
|
|
|
#define wxUSE_MOUSEWHEEL 1 // Include mouse wheel support
|
|
|
|
#define wxUSE_HOTKEY 0 // Hotkey support (currently Windows only)
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
|
|
|
|
|
|
Exit msys.
|
2007-11-09 14:42:10 +00:00
|
|
|
Set environment variable WXWIN ( something as wxwin=/d/wxWidgets-2.8.6
|
|
|
|
for a wxWidget installed in d:\wxWidgets-2.8.6)
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2007-11-09 14:42:10 +00:00
|
|
|
Have a look to libs.win (Currently this file handle wxWidgets 2.8.6)
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
|
|
Under msys:
|
2007-12-20 02:56:03 +00:00
|
|
|
in kicad-dev:
|
|
|
|
run make -f makefile.g95
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2007-06-11 18:58:45 +00:00
|
|
|
*************************************************************************************
|
|
|
|
Building wxWidgets:
|
|
|
|
*************************************************************************************
|
|
|
|
linux:
|
|
|
|
rm *.cache
|
|
|
|
./configure --enable-monolithic --enable-unicode=no --enable-shared=no --with-opengl --with-libpng=builtin --with-libjpeg=builtin --with-libtiff=builtin --with-zlib=builtin --with-regex=builtin
|
|
|
|
|
|
|
|
linux-unicode:
|
|
|
|
rm *.cache
|
|
|
|
./configure --enable-monolithic --enable-unicode=yes --enable-shared=no --with-opengl --with-libpng=builtin --with-libjpeg=builtin --with-libtiff=builtin --with-zlib=builtin --with-regex=builtin
|
|
|
|
|
|
|
|
osX:
|
|
|
|
rm *.cache
|
|
|
|
./configure --enable-unicode=yes --enable-shared=no --enable-monolithic --with-opengl --disable-universal --disable-compat24
|
|
|
|
|
|
|
|
osX-unicode:
|
|
|
|
rm *.cache
|
|
|
|
./configure --enable-unicode=yes --enable-shared=no --enable-monolithic --with-opengl --enable-universal_binary
|
|
|
|
|
|
|
|
windows:
|
|
|
|
rm *.cache
|
|
|
|
./configure --enable-unicode=no --enable-shared=no --enable-monolithic --with-msw --with-opengl --with-odbc
|
|
|
|
|
|
|
|
windows-unicode:
|
|
|
|
rm *.cache
|
|
|
|
./configure --enable-unicode=yes --enable-shared=no --enable-monolithic --with-msw --with-opengl
|
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
*************************************************************************************
|
|
|
|
Patch wxWidgets
|
|
|
|
*************************************************************************************
|
|
|
|
*************************************************************************************
|
|
|
|
wxGTK version:
|
|
|
|
*************************************************************************************
|
|
|
|
Patch for printing wide traces that were showing missing rounded end caps:
|
2007-11-09 14:42:10 +00:00
|
|
|
wxGTK-2.8.6/src/generic/dcpsg.cpp
|
2007-05-06 16:03:28 +00:00
|
|
|
line 1634
|
2007-12-20 02:56:03 +00:00
|
|
|
PsPrint( "%%EndProlog\n" );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
|
|
must be
|
2007-12-20 02:56:03 +00:00
|
|
|
PsPrint( "%%EndProlog\n" );
|
2007-05-06 16:03:28 +00:00
|
|
|
PsPrint("%%BeginSetup\n");
|
|
|
|
PsPrint( "1 setlinecap\n" );
|
|
|
|
PsPrint("%%EndSetup\n");
|
|
|
|
|
|
|
|
|
|
|
|
patch for Arcs drawings (NOT NEEDED for wxWidgets 2.7.1, needed for versions prior to 2.7.1)
|
|
|
|
wxGTK-2.x.y/src/gtk/dcclient.cpp
|
|
|
|
in function WindowDC::DoDrawArc
|
|
|
|
line 572 for wxWidgets 2.7.0-1:
|
|
|
|
if (m_pen.GetStyle() != wxTRANSPARENT)
|
|
|
|
{
|
|
|
|
gdk_draw_arc( m_window, m_penGC, FALSE, xxc-r, yyc-r, 2*r,2*r, alpha1, alpha2 );
|
|
|
|
|
2007-12-20 02:56:03 +00:00
|
|
|
gdk_draw_line( m_window, m_penGC, xx1, yy1, xxc, yyc );
|
|
|
|
gdk_draw_line( m_window, m_penGC, xxc, yyc, xx2, yy2 );
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
must be
|
|
|
|
if (m_pen.GetStyle() != wxTRANSPARENT)
|
|
|
|
{
|
|
|
|
gdk_draw_arc( m_window, m_penGC, FALSE, xxc-r, yyc-r, 2*r,2*r, alpha1, alpha2 );
|
|
|
|
|
2007-12-20 02:56:03 +00:00
|
|
|
if (m_brush.GetStyle() != wxTRANSPARENT)
|
|
|
|
{
|
|
|
|
gdk_draw_line( m_window, m_penGC, xx1, yy1, xxc, yyc );
|
|
|
|
gdk_draw_line( m_window, m_penGC, xxc, yyc, xx2, yy2 );
|
|
|
|
}
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
*************************************************************************************
|
|
|
|
wxMSW version: for wxWMSW 2.8.1 only
|
|
|
|
*************************************************************************************
|
|
|
|
|
|
|
|
wxMSW.2.8.1/src/msw/menu.cpp
|
|
|
|
line 410
|
|
|
|
if ( !pItem->IsOwnerDrawn() )
|
|
|
|
must be
|
|
|
|
if ( !pItem->IsOwnerDrawn() && !pItem->IsSeparator() )
|