~cern-kicad/kicad/kicad-gal

833 by f3nix
Lowercase CMake commands.
1
project(kicad)
409 by f3nix
CMake build system for all apps. Usage in install.txt
2
4024.13.2 by Dick Hollenbeck
*) Refinements to ExternalProject_Add( boost )
3
cmake_minimum_required(VERSION 2.8.4 FATAL_ERROR)
4
# because of http://public.kitware.com/Bug/view.php?id=10395
409 by f3nix
CMake build system for all apps. Usage in install.txt
5
904 by f3nix
CMake cleanup.
6
# Path to local CMake modules.
833 by f3nix
Lowercase CMake commands.
7
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMakeModules)
582 by f3nix
Debug build should be easier now. See how-to-build-kicad.txt. Tested on linux only.
8
3161 by Wayne Stambaugh
Minor copy version information to clipboard improvements.
9
#
3162 by Wayne Stambaugh
Eeschema ERC improvements and other minor fixes.
10
# KiCad build options should be added below.
3161 by Wayne Stambaugh
Minor copy version information to clipboard improvements.
11
#
12
# If you add a new build option, please add it's state to the CopyVersionInfoToClipboard()
3767.1.1 by Wayne Stambaugh
Initial commit of footprint library table code.
13
# function in common/basicframe.cpp so that build option settings can be included in bug
3161 by Wayne Stambaugh
Minor copy version information to clipboard improvements.
14
# reports.
15
#
16
3483 by Wayne Stambaugh
Initial Pcbnew s-expression file format commit.
17
option(USE_PCBNEW_NANOMETRES
3948 by Dick Hollenbeck
add -fPIC for all builds, even cross comiling to Windows from Linux, even non Debug and Release builds
18
    "Use nanometers for Pcbnew internal units instead of deci-mils (default ON)." ON)
3271.1.1 by Dick Hollenbeck
more plugin work
19
2146 by faa
new font does not demand -DKICAD_CYRILLIC
20
# Russian GOST patch
1285 by faa
cyrillic font support, russian GOST support
21
option(wxUSE_UNICODE "enable/disable building unicode (default OFF)")
1629 by charras
code cleanup, remove multiline text option in eeschema (multiline text is a work in progress) and minor enhancements
22
option(KICAD_GOST "enable/disable building using GOST notation for multiple gates per package (default OFF)")
1285 by faa
cyrillic font support, russian GOST support
23
2560 by Vovanium
Make option not uppercasing component names. I'm so bored with my Eeschema is convert ADuC, Si, component names to ADUC, SI etc., so I contribute this patch so anyone now may keep components
24
#for those who bored with uppercase
25
option(KICAD_KEEPCASE "turn-off automatic component name conversion to uppercase if selected")
26
2164 by stambaughw
Implement wxDC coordinate handling and wxGCDC.
27
option(USE_WX_GRAPHICS_CONTEXT
3948 by Dick Hollenbeck
add -fPIC for all builds, even cross comiling to Windows from Linux, even non Debug and Release builds
28
    "Use wxGraphicsContext for rendering (default OFF). Warning, this is experimental")
1941 by dickelbeck
AUI support into topmost CMakeLists.txt
29
2530 by Marco Serantoni
Zones drawing optimization with WXGrapchisContext + Fix bug #612132
30
option(USE_WX_OVERLAY
3948 by Dick Hollenbeck
add -fPIC for all builds, even cross comiling to Windows from Linux, even non Debug and Release builds
31
    "Use wxOverlay: Always ON for MAC (default OFF). Warning, this is experimental")
2530 by Marco Serantoni
Zones drawing optimization with WXGrapchisContext + Fix bug #612132
32
2955 by jean-pierre charras
Viewlib: fix a zoom error (due to a call to BestZoom() made before the full window is built)
33
#One of these 2 option *must* be set to ON:
34
option(KICAD_STABLE_VERSION
3948 by Dick Hollenbeck
add -fPIC for all builds, even cross comiling to Windows from Linux, even non Debug and Release builds
35
    "set this option to ON to build the stable version of KICAD. mainly used to set version ID (default OFF)"
36
    )
2955 by jean-pierre charras
Viewlib: fix a zoom error (due to a call to BestZoom() made before the full window is built)
37
38
option(KICAD_TESTING_VERSION
4024.1.38 by jean-pierre charras
Pcbnew: fix Bug #1163201. Fix Bug #1162779. Fix incorrect comment in CMakeLists.txt.
39
    "set this option to ON to build the testing version of KICAD. mainly used to set version ID (default OFF)"
3948 by Dick Hollenbeck
add -fPIC for all builds, even cross comiling to Windows from Linux, even non Debug and Release builds
40
    )
2955 by jean-pierre charras
Viewlib: fix a zoom error (due to a call to BestZoom() made before the full window is built)
41
3443.1.7 by Miguel Angel Ajo
pcbnew_scripting_helpers.cpp/h to handle generic scripting tools
42
option(KICAD_SCRIPTING
3948 by Dick Hollenbeck
add -fPIC for all builds, even cross comiling to Windows from Linux, even non Debug and Release builds
43
    "set this option ON to build the scripting support inside kicad binaries"
44
    )
3443.1.7 by Miguel Angel Ajo
pcbnew_scripting_helpers.cpp/h to handle generic scripting tools
45
46
option(KICAD_SCRIPTING_MODULES
3948 by Dick Hollenbeck
add -fPIC for all builds, even cross comiling to Windows from Linux, even non Debug and Release builds
47
    "set this option ON to build kicad modules that can be used from scripting languages"
48
    )
3666.1.2 by jean-pierre charras
Remove Kbool from Kicad. Use Clipper instead, last changes
49
3662.1.4 by Miguel Angel Ajo
pcbnew scripting: cleanup, renamed KICAD_SCRIPTING_EXPERIMENT to KICAD_SCRIPTING_WXPYTHON, now every flavour compiles
50
option(KICAD_SCRIPTING_WXPYTHON
3948 by Dick Hollenbeck
add -fPIC for all builds, even cross comiling to Windows from Linux, even non Debug and Release builds
51
    "set this option ON to build wxpython implementation for wx interface building in python and py.shell"
52
    )
4029 by Maciej Suminski
Introduction of Graphics Abstraction Layer based rendering for pcbnew.
53
    
3746.1.1 by jean-pierre charras
Make scripting version compilable under Windows
54
# when option KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES is enabled:
55
# PYTHON_EXECUTABLE can be defined when invoking cmake
56
# ( use -DPYTHON_EXECUTABLE=<python path>/python.exe or python2 )
57
# when not defined by user, the default is python.exe under Windows and python2 for others
3941 by Wayne Stambaugh
Configuration and compile documentation improvements.
58
# python binary file should be is exec path.
3746.1.1 by jean-pierre charras
Make scripting version compilable under Windows
59
3443.1.7 by Miguel Angel Ajo
pcbnew_scripting_helpers.cpp/h to handle generic scripting tools
60
3971 by Wayne Stambaugh
Add build option to use footprint library table.
61
option(USE_FP_LIB_TABLE "Use the new footprint library table implementation. (default OFF)")
62
2955 by jean-pierre charras
Viewlib: fix a zoom error (due to a call to BestZoom() made before the full window is built)
63
#Set version option (stable or testing)
64
3941 by Wayne Stambaugh
Configuration and compile documentation improvements.
65
if(KICAD_STABLE_VERSION AND KICAD_TESTING_VERSION )
66
    message(FATAL_ERROR "Only one KiCad build version option KICAD_TESTING_VERSION or KICAD_STABLE_VERSION can be set to ON")
3974.1.1 by jean-pierre charras
CMakeLists.txt: use elseif token instead of elif which create issues with some cmake version.
67
elseif(NOT KICAD_STABLE_VERSION AND NOT KICAD_TESTING_VERSION)
3941 by Wayne Stambaugh
Configuration and compile documentation improvements.
68
    message(FATAL_ERROR "Either KiCad build version option KICAD_TESTING_VERSION or KICAD_STABLE_VERSION must be set to ON")
3974.1.1 by jean-pierre charras
CMakeLists.txt: use elseif token instead of elif which create issues with some cmake version.
69
elseif(KICAD_STABLE_VERSION)
2955 by jean-pierre charras
Viewlib: fix a zoom error (due to a call to BestZoom() made before the full window is built)
70
    add_definitions(-DKICAD_STABLE_VERSION)
3941 by Wayne Stambaugh
Configuration and compile documentation improvements.
71
    message( "Build stable version of KiCad")
3948 by Dick Hollenbeck
add -fPIC for all builds, even cross comiling to Windows from Linux, even non Debug and Release builds
72
else()
3941 by Wayne Stambaugh
Configuration and compile documentation improvements.
73
    add_definitions(-DKICAD_TESTING_VERSION)
74
    message("Build testing (unstable) version of KiCad")
3948 by Dick Hollenbeck
add -fPIC for all builds, even cross comiling to Windows from Linux, even non Debug and Release builds
75
endif()
2955 by jean-pierre charras
Viewlib: fix a zoom error (due to a call to BestZoom() made before the full window is built)
76
4024.1.166 by Dick Hollenbeck
downloads-by-cmake now configurable, fix wx2.8 compiler errors
77
# All CMake downloads go here.  Suggested is up in the source tree, not in the build dir where they
78
# would have to be downloaded over and over again.  The default is to choose a directory that is
79
# hidden on linux (starts with a '.') because there is a way to exclude this directory when grepping
80
# the source tree.
81
set( DOWNLOAD_DIR ${PROJECT_SOURCE_DIR}/.downloads-by-cmake
82
    CACHE PATH "Location of KiCad downloads, suggested is a dir common to all builds, i.e. global." )
83
2955 by jean-pierre charras
Viewlib: fix a zoom error (due to a call to BestZoom() made before the full window is built)
84
1117 by jerryjacobs
Code comment clean, cmake file cleanup
85
#================================================
904 by f3nix
CMake cleanup.
86
# Set flags for GCC.
1117 by jerryjacobs
Code comment clean, cmake file cleanup
87
#================================================
88
833 by f3nix
Lowercase CMake commands.
89
if(CMAKE_COMPILER_IS_GNUCXX)
3948 by Dick Hollenbeck
add -fPIC for all builds, even cross comiling to Windows from Linux, even non Debug and Release builds
90
3770 by Wayne Stambaugh
Only use -O1 GCC optimization level for versions 4.7 and above for now.
91
    set(KICAD_GCC_RELEASE_BUILD_FLAGS "-O2")
92
    set(KICAD_GCC_RELEASE_DEBUG_FLAGS "")
93
94
    execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion
95
        OUTPUT_VARIABLE GCC_VERSION
96
        OUTPUT_STRIP_TRAILING_WHITESPACE)
97
3753 by Wayne Stambaugh
Pcbnew s-experssion footprint library implementation.
98
    # Added -Wno-narrowing on 10/7/12 to prevent a huge number of warnings when
99
    # compiling with GCC 4.7.  This appears to be caused by and int to unsigned
100
    # conversion in the Boost polygon library.  At some point in the future when
101
    # Boost is updated to the next version, -Wno-narrowing should be removed to
102
    # see if the problem has been resolved.  Wayne.
3766 by Brian Sidebotham
Commit patch from Brian Sidebotham: Project template in Kicad manager
103
    #
104
    # Also note the optimization level is -O1 instead of the usual -O2 level
105
    # because boost::polygon has a function (inflate polygon) broken by
106
    # the -O2 level with GCC 4.7 (works fine with  with GCC 4.6).
107
    # This lower optimization level does not have a significant change on the speed.
108
    #
3770 by Wayne Stambaugh
Only use -O1 GCC optimization level for versions 4.7 and above for now.
109
    # As newer versions of GCC and/or Boost are released, this code needs reviewed to
110
    # determine if the problems above have been fixed either in Boost or GCC.
111
    if(GCC_VERSION VERSION_GREATER 4.7 OR GCC_VERSION VERSION_EQUAL 4.7)
112
        set(KICAD_GCC_RELEASE_BUILD_FLAGS "-Wno-narrowing -O1")
113
        set(KICAD_GCC_DEBUG_BUILD_FLAGS "-Wno-narrowing")
114
    endif()
115
116
    if(CMAKE_BUILD_TYPE STREQUAL Debug)
117
        message(STATUS
3948 by Dick Hollenbeck
add -fPIC for all builds, even cross comiling to Windows from Linux, even non Debug and Release builds
118
            "Setting GCC version ${GCC_VERSION} build flags \"${KICAD_GCC_DEBUG_BUILD_FLAGS}\"")
119
    else()
3770 by Wayne Stambaugh
Only use -O1 GCC optimization level for versions 4.7 and above for now.
120
        message(STATUS
3948 by Dick Hollenbeck
add -fPIC for all builds, even cross comiling to Windows from Linux, even non Debug and Release builds
121
            "Setting GCC version ${GCC_VERSION} build flags \"${KICAD_GCC_RELEASE_BUILD_FLAGS}\"")
122
    endif()
3770 by Wayne Stambaugh
Only use -O1 GCC optimization level for versions 4.7 and above for now.
123
3950 by Dick Hollenbeck
-fPIC only for non-MINGW. See http://mingw.5.n7.nabble.com/Option-fPIC-not-supported-td18480.html
124
    if(MINGW)
125
        # According to some sources, under Windows -fPIC option is not needed:
126
        # http://mingw.5.n7.nabble.com/Option-fPIC-not-supported-td18480.html
127
3649.1.1 by jean-pierre charras
Fix compil issues under mingw
128
        # Set default flags for Release build.
3770 by Wayne Stambaugh
Only use -O1 GCC optimization level for versions 4.7 and above for now.
129
        set(CMAKE_C_FLAGS_RELEASE "-Wall ${KICAD_GCC_RELEASE_BUILD_FLAGS} -DNDEBUG")
130
        set(CMAKE_CXX_FLAGS_RELEASE "-Wall ${KICAD_GCC_RELEASE_BUILD_FLAGS} -DNDEBUG")
3921 by acobo Aragunde Perez
Eeschema: Add "append schematic" feature. Fix bug 1101718 <Empty plot filename>
131
        set(CMAKE_EXE_LINKER_FLAGS_RELEASE "-s -static-libgcc -static-libstdc++")
3649.1.1 by jean-pierre charras
Fix compil issues under mingw
132
133
        # Set default flags for Debug build.
3770 by Wayne Stambaugh
Only use -O1 GCC optimization level for versions 4.7 and above for now.
134
        set(CMAKE_C_FLAGS_DEBUG "-Wall ${KICAD_GCC_DEBUG_BUILD_FLAGS} -g3 -ggdb3 -DDEBUG")
135
        set(CMAKE_CXX_FLAGS_DEBUG "-Wall ${KICAD_GCC_DEBUG_BUILD_FLAGS} -g3 -ggdb3 -DDEBUG")
3921 by acobo Aragunde Perez
Eeschema: Add "append schematic" feature. Fix bug 1101718 <Empty plot filename>
136
        set(CMAKE_MODULE_LINKER_FLAGS "-static-libgcc -static-libstdc++") # SWIG macros on Windows
3890 by Dick Hollenbeck
when linking a DSO, require all symbols to be resolved
137
3948 by Dick Hollenbeck
add -fPIC for all builds, even cross comiling to Windows from Linux, even non Debug and Release builds
138
    else()
3950 by Dick Hollenbeck
-fPIC only for non-MINGW. See http://mingw.5.n7.nabble.com/Option-fPIC-not-supported-td18480.html
139
        # We build DLL/DSOs from static libraries, so create position independent code
140
        # for all cases, since we do not have DLL/DSO specific static libraries.
141
        # This flag could be localized to any object file going into a DLL/DSO in the future.
142
        set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC" )
143
        set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC" )
144
3890 by Dick Hollenbeck
when linking a DSO, require all symbols to be resolved
145
        # Thou shalt not link vaporware and tell us it's a valid DSO:
146
        set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined")
147
        set(CMAKE_MODULE_LINKER_FLAGS "-Wl,--no-undefined") # needed by SWIG macros on linux
148
3649.1.1 by jean-pierre charras
Fix compil issues under mingw
149
        # Set default flags for Release build.
3948 by Dick Hollenbeck
add -fPIC for all builds, even cross comiling to Windows from Linux, even non Debug and Release builds
150
        set(CMAKE_C_FLAGS_RELEASE "${KICAD_GCC_RELEASE_BUILD_FLAGS} -Wall -DNDEBUG")
151
        set(CMAKE_CXX_FLAGS_RELEASE "${KICAD_GCC_RELEASE_BUILD_FLAGS} -Wall -DNDEBUG")
3649.1.1 by jean-pierre charras
Fix compil issues under mingw
152
        set(CMAKE_EXE_LINKER_FLAGS_RELEASE "-s")
153
154
        # Set default flags for Debug build.
3948 by Dick Hollenbeck
add -fPIC for all builds, even cross comiling to Windows from Linux, even non Debug and Release builds
155
        set(CMAKE_C_FLAGS_DEBUG "${KICAD_GCC_DEBUG_BUILD_FLAGS} -Wall  -g3 -ggdb3 -DDEBUG")
156
        set(CMAKE_CXX_FLAGS_DEBUG "${KICAD_GCC_DEBUG_BUILD_FLAGS} -Wall -g3 -ggdb3 -DDEBUG")
157
    endif()
3118 by jean-pierre charras
New icons: fix problems about .ico files (under Window)
158
4024.1.166 by Dick Hollenbeck
downloads-by-cmake now configurable, fix wx2.8 compiler errors
159
    # quiet GCC 4.8.1 while in boost
160
    if( GCC_VERSION VERSION_GREATER 4.8 OR GCC_VERSION VERSION_EQUAL 4.8 )
161
        set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-local-typedefs" )
162
    endif()
163
833 by f3nix
Lowercase CMake commands.
164
endif(CMAKE_COMPILER_IS_GNUCXX)
409 by f3nix
CMake build system for all apps. Usage in install.txt
165
1285 by faa
cyrillic font support, russian GOST support
166
if(wxUSE_UNICODE)
167
    add_definitions(-DwxUSE_UNICODE)
3948 by Dick Hollenbeck
add -fPIC for all builds, even cross comiling to Windows from Linux, even non Debug and Release builds
168
endif()
1285 by faa
cyrillic font support, russian GOST support
169
170
if(KICAD_GOST)
171
    add_definitions(-DKICAD_GOST)
3948 by Dick Hollenbeck
add -fPIC for all builds, even cross comiling to Windows from Linux, even non Debug and Release builds
172
endif()
1285 by faa
cyrillic font support, russian GOST support
173
2560 by Vovanium
Make option not uppercasing component names. I'm so bored with my Eeschema is convert ADuC, Si, component names to ADUC, SI etc., so I contribute this patch so anyone now may keep components
174
if(KICAD_KEEPCASE)
175
    add_definitions(-DKICAD_KEEPCASE)
3948 by Dick Hollenbeck
add -fPIC for all builds, even cross comiling to Windows from Linux, even non Debug and Release builds
176
endif()
2560 by Vovanium
Make option not uppercasing component names. I'm so bored with my Eeschema is convert ADuC, Si, component names to ADUC, SI etc., so I contribute this patch so anyone now may keep components
177
2530 by Marco Serantoni
Zones drawing optimization with WXGrapchisContext + Fix bug #612132
178
if(USE_WX_OVERLAY OR APPLE)
179
    add_definitions(-DUSE_WX_OVERLAY)
3948 by Dick Hollenbeck
add -fPIC for all builds, even cross comiling to Windows from Linux, even non Debug and Release builds
180
endif()
2530 by Marco Serantoni
Zones drawing optimization with WXGrapchisContext + Fix bug #612132
181
3656 by Miguel Angel Ajo
Adam Vašíček patches for WIN32 compilation of kicad scripting
182
if(KICAD_SCRIPTING)
183
    add_definitions(-DKICAD_SCRIPTING)
3948 by Dick Hollenbeck
add -fPIC for all builds, even cross comiling to Windows from Linux, even non Debug and Release builds
184
endif()
3656 by Miguel Angel Ajo
Adam Vašíček patches for WIN32 compilation of kicad scripting
185
186
if(KICAD_SCRIPTING_MODULES)
187
    add_definitions(-DKICAD_SCRIPTING_MODULES)
3948 by Dick Hollenbeck
add -fPIC for all builds, even cross comiling to Windows from Linux, even non Debug and Release builds
188
endif()
3662.1.1 by Miguel Angel Ajo
Double Python initialization fixed
189
3662.1.4 by Miguel Angel Ajo
pcbnew scripting: cleanup, renamed KICAD_SCRIPTING_EXPERIMENT to KICAD_SCRIPTING_WXPYTHON, now every flavour compiles
190
if(KICAD_SCRIPTING_WXPYTHON)
191
    add_definitions(-DKICAD_SCRIPTING_WXPYTHON)
3948 by Dick Hollenbeck
add -fPIC for all builds, even cross comiling to Windows from Linux, even non Debug and Release builds
192
endif()
2530 by Marco Serantoni
Zones drawing optimization with WXGrapchisContext + Fix bug #612132
193
2164 by stambaughw
Implement wxDC coordinate handling and wxGCDC.
194
if(USE_WX_GRAPHICS_CONTEXT)
195
    add_definitions(-DUSE_WX_GRAPHICS_CONTEXT)
3948 by Dick Hollenbeck
add -fPIC for all builds, even cross comiling to Windows from Linux, even non Debug and Release builds
196
endif()
2164 by stambaughw
Implement wxDC coordinate handling and wxGCDC.
197
3088 by Wayne Stambaugh
Add CMake code to enable or disable using images in menu items.
198
# Allow user to override the default settings for adding images to menu items.  By default
3767.1.1 by Wayne Stambaugh
Initial commit of footprint library table code.
199
# images in menu items are enabled on all platforms except OSX.  This can be over ridden by
3088 by Wayne Stambaugh
Add CMake code to enable or disable using images in menu items.
200
# defining -DUSE_IMAGES_IN_MENUS=ON/OFF to force the preferred behavior.
201
if(NOT DEFINED USE_IMAGES_IN_MENUS)
202
    if(NOT APPLE)
203
        set(USE_IMAGES_IN_MENUS ON)
3948 by Dick Hollenbeck
add -fPIC for all builds, even cross comiling to Windows from Linux, even non Debug and Release builds
204
    endif()
205
else()
3088 by Wayne Stambaugh
Add CMake code to enable or disable using images in menu items.
206
    if(USE_IMAGES_IN_MENUS)
207
        set(USE_IMAGES_IN_MENUS ON)
3948 by Dick Hollenbeck
add -fPIC for all builds, even cross comiling to Windows from Linux, even non Debug and Release builds
208
    endif()
209
endif()
3088 by Wayne Stambaugh
Add CMake code to enable or disable using images in menu items.
210
540 by f3nix
Small CMake cleanup.
211
# Locations for install targets.
1117 by jerryjacobs
Code comment clean, cmake file cleanup
212
set(KICAD_BIN bin
213
    CACHE PATH "Location of KiCad binaries.")
805 by plyatov
install.txt was corrected.
214
833 by f3nix
Lowercase CMake commands.
215
if(UNIX)
1071 by kintel
Mac OS X build system fixes
216
    # Everything without leading / is relative to CMAKE_INSTALL_PREFIX.
1117 by jerryjacobs
Code comment clean, cmake file cleanup
217
    set(KICAD_PLUGINS lib/kicad/plugins
218
        CACHE PATH "Location of KiCad plugins.")
219
    set(KICAD_DATA share/kicad
220
        CACHE PATH "Location of KiCad data files.")
221
    set(KICAD_DOCS share/doc/kicad
222
        CACHE PATH "Location of KiCad documentation files.")
3948 by Dick Hollenbeck
add -fPIC for all builds, even cross comiling to Windows from Linux, even non Debug and Release builds
223
endif()
415 by f3nix
CMake build: preliminary support for install targets under linux.
224
3948 by Dick Hollenbeck
add -fPIC for all builds, even cross comiling to Windows from Linux, even non Debug and Release builds
225
if(MINGW)
677 by f3nix
CMake:
226
    # Like all variables, CMAKE_INSTALL_PREFIX can be over-ridden on the command line.
1166 by f3nix
CMake:
227
    set(CMAKE_INSTALL_PREFIX c:/kicad
228
        CACHE PATH "")
904 by f3nix
CMake cleanup.
229
    # Everything without leading / is relative to CMAKE_INSTALL_PREFIX.
1166 by f3nix
CMake:
230
    set(KICAD_PLUGINS ${KICAD_BIN}/plugins
231
        CACHE PATH "Location of KiCad plugins.")
232
    set(KICAD_DATA share
233
        CACHE PATH "Location of KiCad data files.")
234
    set(KICAD_DOCS doc
235
        CACHE PATH "Location of KiCad documentation files.")
3948 by Dick Hollenbeck
add -fPIC for all builds, even cross comiling to Windows from Linux, even non Debug and Release builds
236
endif()
833 by f3nix
Lowercase CMake commands.
237
1166 by f3nix
CMake:
238
set(KICAD_DEMOS ${KICAD_DATA}/demos
1117 by jerryjacobs
Code comment clean, cmake file cleanup
239
    CACHE PATH "Location of KiCad demo files.")
240
set(KICAD_TEMPLATE ${KICAD_DATA}/template
241
    CACHE PATH "Location of KiCad template files.")
242
1166 by f3nix
CMake:
243
mark_as_advanced(KICAD_BIN
3948 by Dick Hollenbeck
add -fPIC for all builds, even cross comiling to Windows from Linux, even non Debug and Release builds
244
    KICAD_PLUGINS
245
    KICAD_DATA
246
    KICAD_DOCS
247
    KICAD_DEMOS
248
    KICAD_TEMPLATE)
1117 by jerryjacobs
Code comment clean, cmake file cleanup
249
2685.1.1 by Dick Hollenbeck
fill out more /new files
250
include(Functions)
1117 by jerryjacobs
Code comment clean, cmake file cleanup
251
4024.13.1 by Dick Hollenbeck
remove boost and make it an external project, so the procedure for upgrading is better documented
252
include( ExternalProject )
253
1117 by jerryjacobs
Code comment clean, cmake file cleanup
254
#================================================
929 by f3nix
CMake: add check_find_package_result macro.
255
# Find libraries that are needed to build KiCad.
1117 by jerryjacobs
Code comment clean, cmake file cleanup
256
#================================================
929 by f3nix
CMake: add check_find_package_result macro.
257
include(CheckFindPackageResult)
258
4025 by Maciej Suminski
Replacement of classes BOX2 and VECTOR2 with their extended versions
259
# Turn on wxWidgets compatibility mode for some classes 
260
add_definitions(-DWX_COMPATIBILITY)
261
1117 by jerryjacobs
Code comment clean, cmake file cleanup
262
#######################
263
# Find OpenGL library #
264
#######################
1166 by f3nix
CMake:
265
find_package(OpenGL QUIET)
929 by f3nix
CMake: add check_find_package_result macro.
266
check_find_package_result(OPENGL_FOUND "OpenGL")
833 by f3nix
Lowercase CMake commands.
267
4029 by Maciej Suminski
Introduction of Graphics Abstraction Layer based rendering for pcbnew.
268
#####################
269
# Find GLEW library #
270
#####################
271
find_package(GLEW)
272
check_find_package_result(GLEW_FOUND "GLEW")
273
274
######################
275
# Find Cairo library #
276
######################
277
find_package(Cairo 1.8.1 QUIET)
278
check_find_package_result(CAIRO_FOUND "Cairo")
279
4024.13.1 by Dick Hollenbeck
remove boost and make it an external project, so the procedure for upgrading is better documented
280
##########################
281
# Download Boost library #
282
##########################
283
include( download_boost )
284
677 by f3nix
CMake:
285
1117 by jerryjacobs
Code comment clean, cmake file cleanup
286
##########################
287
# Find wxWidgets library #
288
##########################
582 by f3nix
Debug build should be easier now. See how-to-build-kicad.txt. Tested on linux only.
289
# Here you can define what libraries of wxWidgets you need for your
290
# application. You can figure out what libraries you need here;
291
# http://www.wxwidgets.org/manuals/2.8/wx_librarieslist.html
1941 by dickelbeck
AUI support into topmost CMakeLists.txt
292
2125 by charras
Fixed a problem with aui lib (now mandatory) in CMakeList.txt (could be not included at link time)
293
# On Apple only wxwidgets 2.9 or higher doesn't need to find aui part of base
294
if(APPLE)
2424.1.1 by Dick Hollenbeck
++eeschema:
295
    find_package(wxWidgets COMPONENTS gl adv html core net base xml QUIET)
2125 by charras
Fixed a problem with aui lib (now mandatory) in CMakeList.txt (could be not included at link time)
296
else(APPLE)
2424.1.1 by Dick Hollenbeck
++eeschema:
297
    find_package(wxWidgets COMPONENTS gl aui adv html core net base xml QUIET)
2125 by charras
Fixed a problem with aui lib (now mandatory) in CMakeList.txt (could be not included at link time)
298
endif(APPLE)
929 by f3nix
CMake: add check_find_package_result macro.
299
check_find_package_result(wxWidgets_FOUND "wxWidgets")
415 by f3nix
CMake build: preliminary support for install targets under linux.
300
1117 by jerryjacobs
Code comment clean, cmake file cleanup
301
582 by f3nix
Debug build should be easier now. See how-to-build-kicad.txt. Tested on linux only.
302
# Include wxWidgets macros.
833 by f3nix
Lowercase CMake commands.
303
include(${wxWidgets_USE_FILE})
582 by f3nix
Debug build should be easier now. See how-to-build-kicad.txt. Tested on linux only.
304
930 by f3nix
CMake:
305
# Include MinGW resource compiler.
306
include(MinGWResourceCompiler)
307
1650 by stambaughw
Build improvements, compiler warning fixes and build fixes, and lots of clean up.
308
# Generate build system specific header file.
309
include(PerformFeatureChecks)
310
perform_feature_checks()
311
2164 by stambaughw
Implement wxDC coordinate handling and wxGCDC.
312
# Find GDI+ on windows if wxGraphicsContext is available.
3948 by Dick Hollenbeck
add -fPIC for all builds, even cross comiling to Windows from Linux, even non Debug and Release builds
313
if(MINGW AND USE_WX_GRAPHICS_CONTEXT)
2164 by stambaughw
Implement wxDC coordinate handling and wxGCDC.
314
    find_package(GdiPlus)
315
    check_find_package_result(GDI_PLUS_FOUND "GDI+")
3948 by Dick Hollenbeck
add -fPIC for all builds, even cross comiling to Windows from Linux, even non Debug and Release builds
316
endif()
2164 by stambaughw
Implement wxDC coordinate handling and wxGCDC.
317
3662.1.3 by Miguel Angel Ajo
scripting: fixed kicad compilation, cleanups
318
# Find Python and other scripting resources
3941 by Wayne Stambaugh
Configuration and compile documentation improvements.
319
if(KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES)
320
    set(PythonInterp_FIND_VERSION)
321
    find_package(PythonInterp)
322
    check_find_package_result(PYTHONINTERP_FOUND "Python Interpreter")
323
324
    # Get the correct Python site package install path from the Python interpreter found by
325
    # FindPythonInterp unless the user specifically defined a custom path.
326
    if(NOT PYTHON_SITE_PACKAGE_PATH)
327
        execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "import distutils.sysconfig;print\"%s\"%distutils.sysconfig.get_python_lib()"
328
            OUTPUT_VARIABLE PYTHON_SITE_PACKAGE_PATH
329
            OUTPUT_STRIP_TRAILING_WHITESPACE
330
            )
331
332
        if(NOT PYTHON_SITE_PACKAGE_PATH)
333
            message(FATAL_ERROR "Error occurred while attemping to find the Python site library path.")
3948 by Dick Hollenbeck
add -fPIC for all builds, even cross comiling to Windows from Linux, even non Debug and Release builds
334
        endif()
335
    endif()
3941 by Wayne Stambaugh
Configuration and compile documentation improvements.
336
337
    set(PYTHON_DEST "${PYTHON_SITE_PACKAGE_PATH}" CACHE PATH "Python module install path.")
338
    mark_as_advanced(PYTHON_DEST)
339
    message( STATUS "Python module install path: ${PYTHON_DEST}")
340
    find_package(PythonLibs)
4024.1.244 by Brian Sidebotham
* Added modified CMake FindPython... modules to support using Python-a-mingw-us distribution when building Windows scripting support using MinGW
341
    include_directories(${PYTHON_INCLUDE_DIRS}
3941 by Wayne Stambaugh
Configuration and compile documentation improvements.
342
                        ./scripting)
3662.1.3 by Miguel Angel Ajo
scripting: fixed kicad compilation, cleanups
343
endif(KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES)
344
345
346
1064 by f3nix
CMake files cleaning.
347
# Automagically create version header file.
2350.2.1 by Wayne Stambaugh
Update version header generator CMake script to use Bazaar.
348
include(CreateBzrVersionHeader)
349
create_bzr_version_header()
985 by stambaughw
Use Subversion to automatically generate date and version information when building with CMake.
350
1155 by raburton
allow build version to be set, while preserving program version
351
if(EXISTS ${CMAKE_SOURCE_DIR}/include/config.h)
1166 by f3nix
CMake:
352
    # This file may exist (created by an alternate process to the svn test above),
353
    # e.g. could be created by a checkout script that produces a source tar file.
354
    # This directive means the about box will have the svn date & revision in it,
355
    # but the hard coded release date (program version) will be preserved.
356
    add_definitions(-DHAVE_SVN_REVISION)
3948 by Dick Hollenbeck
add -fPIC for all builds, even cross comiling to Windows from Linux, even non Debug and Release builds
357
endif()
1155 by raburton
allow build version to be set, while preserving program version
358
3372.1.3 by Dick Hollenbeck
switch to <> for includes from "" per conversation with Jean-Pierre and Wayne, adjust search paths
359
# For include_directories(BEFORE ...), which _reverses_
360
# the order during insertion, so put first wanted last, which is
361
# ${CMAKE_SOURCE_DIR/include.  Use '.' for current source dir since
362
# we don't want expansion here and now, and don't need expansion of
363
# ${CMAKE_CURRENT_SOURCE_DIR}, '.' will work for any source directory.
364
set(INC_BEFORE
365
    .
366
    ${CMAKE_SOURCE_DIR}/include
367
    )
368
369
set(INC_AFTER
370
    #include <config.h>
371
    ${CMAKE_BINARY_DIR}
372
    )
1117 by jerryjacobs
Code comment clean, cmake file cleanup
373
374
#================================================
375
# Let CMake look in these directories for nested
376
# 'CMakeLists.txt' files to process
377
#================================================
378
4024.13.2 by Dick Hollenbeck
*) Refinements to ExternalProject_Add( boost )
379
############################
380
# Binaries (CMake targets) #
381
############################
3101.1.1 by Dick Hollenbeck
PNG bitmap support, initial implementation
382
3491.1.1 by jean-pierre charras
Remove old xpm icons files
383
add_subdirectory(bitmaps_png)
833 by f3nix
Lowercase CMake commands.
384
add_subdirectory(common)
3487 by Dick Hollenbeck
Remove g_PcbPlotOptions, use wxformbuilder to subclass DIALOG_SHIM on several dialogs
385
add_subdirectory(3d-viewer)
833 by f3nix
Lowercase CMake commands.
386
add_subdirectory(cvpcb)
387
add_subdirectory(eeschema)
388
add_subdirectory(gerbview)
389
add_subdirectory(kicad)
390
add_subdirectory(pcbnew)
3872 by Alexander Lunef
Pcbnew: Add pcad2kicad pcb plugin, to import PCAD boards ( .pcb ASCII data file PCad 2000 format ) from Alexander Lunef
391
add_subdirectory(pcbnew/pcad2kicadpcb_plugin)
833 by f3nix
Lowercase CMake commands.
392
add_subdirectory(polygon)
4024.17.1 by jean-pierre charras
Initial release of pl_editor, the page layout and title block editor.
393
add_subdirectory(pagelayout_editor)
2389.1.1 by jean-pierre charras
Added an experimental tool to create logos from .bmp bitmaps. Added Potrace library to convert bitmaps to polygons
394
add_subdirectory(potrace)
395
add_subdirectory(bitmap2component)
3057.1.1 by jean-pierre charras
Add a new utility: pcb_calculator (need of course wore work)
396
add_subdirectory(pcb_calculator)
3537 by Dick Hollenbeck
Add tools/parser_gen.cpp which is the beginnings of an s-expression parser
397
add_subdirectory(tools)
2578.2.9 by Dick Hollenbeck
implement some of the DIR_LIB_SOURCE Read*() functions
398
#add_subdirectory(new)
1117 by jerryjacobs
Code comment clean, cmake file cleanup
399
3311.1.4 by Dick Hollenbeck
remove page size globals from eeschema
400
4024.13.2 by Dick Hollenbeck
*) Refinements to ExternalProject_Add( boost )
401
# Make all libs and executables depend on ExternalProject_Add( boost ),
402
# except perhaps bitmap lib
403
add_dependencies( pcbnew boost )
404
add_dependencies( eeschema boost )
405
add_dependencies( cvpcb boost )
4229 by Camille Delbegue
Remove a Clang warning and add a missing dependency to boost in cmake file.
406
add_dependencies( gal boost )
4024.13.2 by Dick Hollenbeck
*) Refinements to ExternalProject_Add( boost )
407
add_dependencies( common boost )
408
add_dependencies( pcbcommon boost )
409
add_dependencies( 3d-viewer boost )
410
add_dependencies( pcad2kicadpcb boost )
411
add_dependencies( polygon boost )
4024.17.1 by jean-pierre charras
Initial release of pl_editor, the page layout and title block editor.
412
add_dependencies( pl_editor boost )
4024.13.2 by Dick Hollenbeck
*) Refinements to ExternalProject_Add( boost )
413
414
1117 by jerryjacobs
Code comment clean, cmake file cleanup
415
#############
416
# Resources #
417
#############
833 by f3nix
Lowercase CMake commands.
418
add_subdirectory(demos)
419
add_subdirectory(template)
860 by plyatov
Added icon and "kicad.desktop" for Gnome/KDE menu.
420
2394 by Dick Hollenbeck
add doxygen-docs target to build system
421
#================================================
422
# Doxygen Output
423
#================================================
424
find_package(Doxygen)
425
if(DOXYGEN_FOUND)
3286.1.1 by Dick Hollenbeck
more kicad_plugin work, make BOARD::m_NetInfo private
426
    add_custom_target( doxygen-docs
427
        ${CMAKE_COMMAND} -E remove_directory Documentation/doxygen
428
        COMMAND ${DOXYGEN_EXECUTABLE}
2394 by Dick Hollenbeck
add doxygen-docs target to build system
429
        WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
3286.1.1 by Dick Hollenbeck
more kicad_plugin work, make BOARD::m_NetInfo private
430
        DEPENDS Doxyfile
431
        COMMENT "building doxygen docs into directory Documentation/doxygen/html"
432
        )
3948 by Dick Hollenbeck
add -fPIC for all builds, even cross comiling to Windows from Linux, even non Debug and Release builds
433
else()
2394 by Dick Hollenbeck
add doxygen-docs target to build system
434
    message( STATUS "WARNING: Doxygen not found - doxygen-docs (Source Docs) target not created" )
435
endif()
436
1117 by jerryjacobs
Code comment clean, cmake file cleanup
437
438
#================================================
2535 by Fabio Varesano
add CMake rules to create an 'uninstall' make rule.
439
# make uninstall rules
440
#================================================
2538 by Dick Hollenbeck
move cmake_uninstall.cmake to CMakeModules directory
441
configure_file(
442
  "${CMAKE_MODULE_PATH}/cmake_uninstall.cmake.in"
2535 by Fabio Varesano
add CMake rules to create an 'uninstall' make rule.
443
  "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
444
  IMMEDIATE @ONLY)
445
2538 by Dick Hollenbeck
move cmake_uninstall.cmake to CMakeModules directory
446
add_custom_target(uninstall
2535 by Fabio Varesano
add CMake rules to create an 'uninstall' make rule.
447
  "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
448
449
450
#================================================
1117 by jerryjacobs
Code comment clean, cmake file cleanup
451
# Installation parameters
452
#================================================
1377 by faa
not build in linux
453
install(FILES INSTALL.txt
3948 by Dick Hollenbeck
add -fPIC for all builds, even cross comiling to Windows from Linux, even non Debug and Release builds
454
    DESTINATION ${KICAD_DOCS}
455
    COMPONENT resources)
456
1886 by jerryjacobs
Big cleanup of sourcetree root structure, added Documentation subfolder, moved packaging stuff for osx and windows (nsis) to packaging.
457
install(FILES resources/freeroute.jnlp
3948 by Dick Hollenbeck
add -fPIC for all builds, even cross comiling to Windows from Linux, even non Debug and Release builds
458
    DESTINATION ${KICAD_BIN}
459
    COMPONENT resources)
460
1680 by faa
correct path for mime in linux, add scripts in CMakeLists.txt
461
###
462
# Install scripts
463
###
464
if(UNIX)
1706 by f3nix
Clean some CMakeLists.txt files.
465
    install(DIRECTORY scripts
466
            DESTINATION ${KICAD_DOCS}
467
            COMPONENT resources
468
            PATTERN ".svn" EXCLUDE)
3948 by Dick Hollenbeck
add -fPIC for all builds, even cross comiling to Windows from Linux, even non Debug and Release builds
469
endif()
470
1679 by jerryjacobs
Added support for mime installation in CMakeLists.txt
471
###
472
# FreeDesktop .desktop and MIME resources
473
###
860 by plyatov
Added icon and "kicad.desktop" for Gnome/KDE menu.
474
if(UNIX)
1706 by f3nix
Clean some CMakeLists.txt files.
475
    # Set paths
476
    set(UNIX_MIME_DIR resources/linux/mime)
477
    set(UNIX_MIMELNK_FILES ${UNIX_MIME_DIR}/mimelnk)
478
    set(UNIX_MIME_FILES ${UNIX_MIME_DIR}/mime)
479
    set(UNIX_ICONS_FILES ${UNIX_MIME_DIR}/icons)
480
    set(UNIX_APPLICATIONS_FILES ${UNIX_MIME_DIR}/applications)
481
482
    # Install Mimelnk directory
483
    install(DIRECTORY ${UNIX_MIMELNK_FILES}
3948 by Dick Hollenbeck
add -fPIC for all builds, even cross comiling to Windows from Linux, even non Debug and Release builds
484
        DESTINATION ${CMAKE_INSTALL_PREFIX}/share
485
        COMPONENT resources
486
        PATTERN ".svn" EXCLUDE)
1706 by f3nix
Clean some CMakeLists.txt files.
487
488
    # Install Mime directory
489
    install(DIRECTORY ${UNIX_ICONS_FILES}
3948 by Dick Hollenbeck
add -fPIC for all builds, even cross comiling to Windows from Linux, even non Debug and Release builds
490
        DESTINATION ${CMAKE_INSTALL_PREFIX}/share
491
        COMPONENT resources
492
        PATTERN ".svn" EXCLUDE)
1706 by f3nix
Clean some CMakeLists.txt files.
493
494
    # Install Icons
495
    install(DIRECTORY ${UNIX_MIME_FILES}
3948 by Dick Hollenbeck
add -fPIC for all builds, even cross comiling to Windows from Linux, even non Debug and Release builds
496
        DESTINATION ${CMAKE_INSTALL_PREFIX}/share
497
        COMPONENT resources
498
        PATTERN ".svn" EXCLUDE)
1706 by f3nix
Clean some CMakeLists.txt files.
499
500
    # Install Applications directory (.desktop files)
501
    install(DIRECTORY ${UNIX_APPLICATIONS_FILES}
3948 by Dick Hollenbeck
add -fPIC for all builds, even cross comiling to Windows from Linux, even non Debug and Release builds
502
        DESTINATION ${CMAKE_INSTALL_PREFIX}/share
503
        COMPONENT resources
504
        PATTERN ".svn" EXCLUDE)
505
endif()
2184 by dickelbeck
patch from wafeliron@yahoo.com via pastbin.com
506
507
include(CTest)