1
1
Compiling KiCad on Apple Mac OS X
2
2
=================================
4
Building on OSX is very similar to building on Linux. This document will provide a
5
complete walk-through on what to do but it will focus on OSX specific things.
4
Building on OSX is very similar to building on Linux. This document will provide
5
a complete walk-through on what to do but it will focus on OSX specific things.
6
6
See general documentation on non-OSX specific KiCad build switches, etc.
21
21
* GLEW - The OpenGL Extension Wrangler Library
22
22
* cairo - 2D graphics library
23
23
* wxWidgets - Cross-Platform GUI Library
25
wxPython - A blending of the wxWidgets C++ class library with the Python
25
28
Optional library dependencies, depends on used KiCad features
26
29
* OpenSSL - The Open Source toolkit for SSL/TLS
27
30
=> Needed for github plugin
29
All tools (except XCode, of course) and all dependencies except wxWidgets can be compiled
30
manually, but it is advised to install them using your favorite package manager for OSX
31
like MacPorts or Homebrew.
32
Depending on the package manager the development packages of the library dependencies
33
may have to be installed (usually something like <pkg>-dev or <pkg>-devel).
34
Further, depending on the configuration of your package manager packages might have to
35
be compiled with special flags/variants to support the correct architecture. E.g., some
36
packages of MacPorts need to have the "+universal" variant set to also include the
37
x86_64 variant that might be chosen automatically by KiCad build process.
32
All tools (except XCode, of course) and all dependencies except wxWidgets/wxPython
33
can be compiled manually, but it is advised to install them using your favorite
34
package manager for OSX like MacPorts or Homebrew.
35
Depending on the package manager the development packages of the library
36
dependencies may have to be installed (usually something like <pkg>-dev or
38
Further, depending on the configuration of your package manager packages might
39
have to be compiled with special flags/variants to support the correct
40
architecture. E.g., some packages of MacPorts need to have the "+universal"
41
variant set to also include the x86_64 variant that might be chosen
42
automatically by KiCad build process.
40
At the moment you *must not* use a wxWidgets version installed by any package manager.
41
KiCad on OSX needs overlay support and some other fixes, which are not yet contained in
42
mainline wxWidgets sources and builds.
45
At the moment you *must not* use a wxWidgets/wxPython version installed by any
47
KiCad on OSX needs overlay support and some other fixes, which are not yet
48
contained in mainline wxWidgets/wxPython sources and builds.
49
If you don't use a patched wxWidgets you will get graphical artifacts (something
50
like a magnifying glass effect in the upper left corner of KiCad windows) or
51
KiCad will just crash on start (due to duplicate libraries).
44
53
Install now the tools and library dependencies as mentioned above.
50
This documentation will use the following folder structure as an example, but it is not
51
mandatory to do it like that:
59
This documentation will use the following folder structure as an example, but it
60
is not mandatory to do it like that:
53
62
+-- kicad/ KiCad source folder
54
63
+-- build/ KiCad build folder
55
64
+-- bin/ KiCad binaries folder
56
+-- wx-src/ wxWidgets source folder
57
+-- wx-build/ wxWidgets build folder
58
+-- wx-bin/ wxWidgets binaries folder
65
+-- wx-src/ wxWidgets/wxPython source folder
66
+-- wx-build/ wxWidgets/wxPython build folder
67
+-- wx-bin/ wxWidgets/wxPython binaries folder
67
76
# bzr branch lp:kicad
79
Compiling wxWidgets / wxPython
80
------------------------------
82
If you don't intend to build KiCad with scripting support then you only need
83
wxWidgets, otherwise you need wxPython (which also contains wxWidgets).
73
85
Get wxWidgets sources from
74
86
http://www.wxwidgets.org/downloads/
75
and unpack them to the wx-src folder.
76
It's recommended to use the latest stable (at the time of this writing 3.0.1) version.
78
Apply the patches needed for KiCad:
87
or wxPython sources from
88
http://www.wxpython.org/download.php#source
89
and unpack it to the wx-src folder.
90
It is recommended to use the latest stable version. As of this writing this is
91
3.0.2 for wxWidgets or 3.0.1.1 for wxPython.
93
There is a little helper script osx_build_wx.sh in kicad/scripts that does all
94
the patching/configuring/compiling of wxWidgets or wxPython for you.
95
Go to your working root "KiCad" and run:
96
# kicad/scripts/osx_build_wx.sh wx-src wx-bin kicad "-j4"
98
First parameter is the source folder of wxWidgets/wxPython, second parameter the
99
target folder for compiled binaries, third parameter is the kicad folder, and
100
the last optional parameter are make options used during the build (in this
101
case for building with 4 jobs in parallel).
102
The script will automatically detect if you are compiling wxWidgets or wxPython.
103
CAUTION: The script will erase existing wx-build and target folders (wx-bin)
104
without any confirmation!
106
If everything went fine during compilation you will now have a working
107
wxWidgets/wxPython installation in the wx-bin folder.
108
For building KiCad it is sufficient to keep the wx-bin folder.
110
The script doesn't have to be used, the usual "configure/make/make install" will
111
also work. If you do so, be sure to apply the patches needed for KiCad:
80
112
# patch -p0 < ../kicad/patches/wxwidgets-3.0.0_macosx.patch
81
113
# patch -p0 < ../kicad/patches/wxwidgets-3.0.0_macosx_bug_15908.patch
82
114
# patch -p0 < ../kicad/patches/wxwidgets-3.0.0_macosx_soname.patch
115
The same patches apply both for wxWidgets and for wxPython.
117
The script uses the following configure command/options for wxWidgets known to
88
119
# ../wx-src/configure \
89
120
--prefix=`pwd`/../wx-bin \
100
131
--with-expat=builtin \
101
132
--without-liblzma \
102
133
--with-macosx-version-min=10.5 \
134
--enable-universal-binary=i386,x86_64 \
103
135
CPPFLAGS="-stdlib=libstdc++" \
104
136
LDFLAGS="-stdlib=libstdc++" \
110
... will take some time ...
113
If everything went fine you will now have a working wxWidgets installation in the wx-bin
115
For building KiCad it is sufficient to keep the wx-bin folder.
116
The above configuration of wxWidgets is known to work, if you know what you are doing
117
you of course can use different settings.
120
Compiling KiCad (without scripting support)
121
-------------------------------------------
139
If you know what you are doing, you can of course use different settings.
123
145
Change to your working root "KiCad" and create the build folder there:
149
Now, configure KiCad without scripting support:
128
150
# cmake ../kicad \
129
151
-DCMAKE_C_COMPILER=clang \
130
152
-DCMAKE_CXX_COMPILER=clang++ \
135
157
-DCMAKE_INSTALL_PREFIX=../bin \
136
158
-DCMAKE_BUILD_TYPE=Release
138
Now KiCad is configured using default features/build-switches without scripting support.
139
See Documentation/compiling/build-config.txt for a list of all CMake options available
140
when compiling KiCad.
160
or, configure KiCad with scripting support:
162
-DCMAKE_C_COMPILER=clang \
163
-DCMAKE_CXX_COMPILER=clang++ \
164
-DwxWidgets_CONFIG_EXECUTABLE=../wx-bin/bin/wx-config \
165
-DPYTHON_EXECUTABLE=`which python` \
166
-DPYTHON_SITE_PACKAGE_PATH=`pwd`/../wx-bin/lib/python2.7/site-packages \
167
-DKICAD_SCRIPTING=ON \
168
-DKICAD_SCRIPTING_MODULES=ON \
169
-DKICAD_SCRIPTING_WXPYTHON=ON \
170
-DCMAKE_INSTALL_PREFIX=../bin \
171
-DCMAKE_BUILD_TYPE=Release
172
Note, that depending on your python version the "python2.7" part of the
173
"-DPYTHON_SITE_PACKAGE_PATH" variable might have to be adjusted to what has
174
been generated when compiling/installing wxPython. If you want to use a specific
175
python, you can also specify it via "-DPYTHON_EXECUTABLE" instead of using
176
`which python` (this one will just detect/use you default python).
178
Now KiCad is configured using default features/build-switches.
179
See Documentation/compiling/build-config.txt for a list of all CMake options
180
available when compiling KiCad.
144
184
... will take some time ...
147
Again, if everything went fine you will now have KiCad binaries in the "bin" folder.
148
KiCad application can be directly run from there to test.
149
If everything is OK, you can create a .dmg image of your "bin" folder or just copy/install
150
the KiCad binaries and/or support files (like demos or documentation) wherever you want.
187
Again, if everything went fine you will now have KiCad binaries in the "bin"
188
folder. KiCad application can be directly run from there to test.
189
If everything is OK, you can create a .dmg image of your "bin" folder or just
190
copy/install the KiCad binaries and/or support files (like demos or
191
documentation) wherever you want.
193
If you resync to newer versions of KiCad you don't have to rebuild wxWidgets or
195
CMake should pick up the changes automatically and build correctly. However, it
196
is advised that you make a clean build to be sure (just delete the build folder
197
and go again through the configure/build steps).