From 15b5df831b63cad83821cf0aa42508b54f689c0a Mon Sep 17 00:00:00 2001 From: dickelbeck Date: Thu, 20 Dec 2007 02:56:03 +0000 Subject: [PATCH] CMAKE howto --- how-to-build-kicad.txt | 216 ++++++++++++++++++++++++++++++++++++----- 1 file changed, 194 insertions(+), 22 deletions(-) diff --git a/how-to-build-kicad.txt b/how-to-build-kicad.txt index 90bbf150fa..5d16f3c145 100644 --- a/how-to-build-kicad.txt +++ b/how-to-build-kicad.txt @@ -1,9 +1,181 @@ -How to build kicad: -kicad do not use configure (Use of Cmake is in progress) -it is compiled with make. -kicad needs wxWidgets (the multi platform G.U.I.) +How to build kicad using CMAKE. +19-Dec-2007 + + +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". +2) If windows, then install "opengl". +3) If linux, then install "mesa". +4) Make sure g++ and "make" are in your path. +5) Install wxWidgets [and build it if on windows]. +6) Install CMAKE +7) Install the kicad source tree. +8) Use cmake to build the kicad makefiles. +9) Use make to build and install kicad. +10) Making a "Debug" build. + + +===== 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. + +----------------------------------------------------------------------------- + +2) If windows, then install "opengl". Google around for how to this. It +might already be installed. + +----------------------------------------------------------------------------- + +3) If linux, install "mesa". Use your package manager to install the development +libaries. + +----------------------------------------------------------------------------- + +4) Make sure g++ and "make" are in your path. +If windows, then try running g++ and make from within your msys bash shell. + +----------------------------------------------------------------------------- + +5) Install wxWidgets [and build it if on windows]. + +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. + +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/. Edit your msys/1.0/etc/fstab file if needed to provide +access to this build directory from msys. Unzip the wmMWS zip file into this +build directory. Change directories into there, and then + rm *.cache + ./configure --enable-unicode=yes --enable-shared=no --enable-monolithic --with-msw --with-opengl + make + make install +I think the default is to install into /usr/local/wxMSW-2.8.7. You can probably +pass --prefix= to configure above to change where "make install" +puts everything. We will refer to again below. Without the +--prefix= passed to configure, will likely be + /usr/local/wxMSW-2.8.7 + +Also 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. + +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. + +----------------------------------------------------------------------------- + +6) Install CMAKE. +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. + +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. + +----------------------------------------------------------------------------- + +7) Install the kicad source tree. +You can use the subversion repository or a tar file for this. See the wiki. + +----------------------------------------------------------------------------- + +8) Use cmake to create the kicad makefiles. +If windows, go into your msys shell. Linux and windows users both then make +two "out of source" build directories: + cd + mkdir release + mkdir debug + cd release + +On either cmake command line shown below, you can optionally include + -DCMAKE_INSTALL_PREFIX= +before the final .. argument. + +If windows, run the following command: + cmake -G "MSYS Makefiles" -DCMAKE_BUILD_TYPE=Release -DwxWidgets_ROOT_DIR= .. + +If 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. + +----------------------------------------------------------------------------- + +9) Use make to build and install kicad. +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 /release + make + [sudo] make install + +You are now done unless you want to make a Debug build. + +----------------------------------------------------------------------------- + +10) Making a "Debug" build. + + cd /debug + +On either cmake command line shown below, you can optionally include +-DCMAKE_INSTALL_PREFIX= before the final .. argument. Although +normally you do not install the Debug binaries, you can debug them where they +were built. + + +If windows, run the following command: + cmake -G "MSYS Makefiles" -DCMAKE_BUILD_TYPE=Debug -DwxWidgets_ROOT_DIR= .. + +If linux, run instead the following command: + cmake -DCMAKE_BUILD_TYPE=Debug ../ + +Edit CMakeCache.txt, and look for the line that defines wxWidgets_CONFIG_EXECUTABLE: + wxWidgets_CONFIG_EXECUTABLE:FILEPATH=E:/usr/local/bin/wx-config +If you have debug libaries for wxWidgets, which should be the case if you installed +them in linux or if you built them on windows, then add "--debug" to the end of +the wx-config command, for example: + + wxWidgets_CONFIG_EXECUTABLE:FILEPATH=E:/usr/local/bin/wx-config --debug + +Re-run the same cmake command again as given above for your respective platform. + +Make the Debug binaries: + make + +Note that it is easy to build only a specific binary such as pcbnew alone: + make pcbnew + +----------------------------------------------------------------------------- + +End of CMAKE related building. + + +============= OLD STUFF NOT PERTINENT TO CMAKE ============================== unzip sources in a working directory. This will create the directory "kicad-dev". @@ -50,16 +222,16 @@ install mingw and msys ( see mingw.org ) (opengl libs are included in mingw or windows) Under msys: - (Warning: make.exe utility is sometime renamed mingw32-make.exe in install process - of msys.) + (Warning: make.exe utility is sometime renamed mingw32-make.exe in install process + of msys.) Build wxWidgets (currently version 2.8.6) - See below for suggested configure command, then make + See below for suggested configure command, then make - 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) + 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) Exit msys. @@ -69,8 +241,8 @@ for a wxWidget installed in d:\wxWidgets-2.8.6) Have a look to libs.win (Currently this file handle wxWidgets 2.8.6) Under msys: - in kicad-dev: - run make -f makefile.g95 + in kicad-dev: + run make -f makefile.g95 ************************************************************************************* Building wxWidgets: @@ -108,10 +280,10 @@ wxGTK version: Patch for printing wide traces that were showing missing rounded end caps: wxGTK-2.8.6/src/generic/dcpsg.cpp line 1634 - PsPrint( "%%EndProlog\n" ); + PsPrint( "%%EndProlog\n" ); must be - PsPrint( "%%EndProlog\n" ); + PsPrint( "%%EndProlog\n" ); PsPrint("%%BeginSetup\n"); PsPrint( "1 setlinecap\n" ); PsPrint("%%EndSetup\n"); @@ -125,19 +297,19 @@ line 572 for wxWidgets 2.7.0-1: { gdk_draw_arc( m_window, m_penGC, FALSE, xxc-r, yyc-r, 2*r,2*r, alpha1, alpha2 ); - gdk_draw_line( m_window, m_penGC, xx1, yy1, xxc, yyc ); - gdk_draw_line( m_window, m_penGC, xxc, yyc, xx2, yy2 ); + gdk_draw_line( m_window, m_penGC, xx1, yy1, xxc, yyc ); + gdk_draw_line( m_window, m_penGC, xxc, yyc, xx2, yy2 ); } 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 ); - 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 ); - } + 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 ); + } }