/
BuildParameters.cmake
493 lines (428 loc) · 19.6 KB
/
BuildParameters.cmake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
### TODO
# Hardcode GAMEINDEX_DIR, if default is fine for everybody
### Select the build type
# Use Release/Devel/Debug : -DCMAKE_BUILD_TYPE=Release|Devel|Debug
# Enable/disable the stripping : -DCMAKE_BUILD_STRIP=TRUE|FALSE
# generation .po based on src : -DCMAKE_BUILD_PO=TRUE|FALSE
### GCC optimization options
# control C flags : -DUSER_CMAKE_C_FLAGS="cflags"
# control C++ flags : -DUSER_CMAKE_CXX_FLAGS="cxxflags"
# control link flags : -DUSER_CMAKE_LD_FLAGS="ldflags"
### Packaging options
# Plugin installation path : -DPLUGIN_DIR="/usr/lib/pcsx2"
# GL Shader installation path : -DGLSL_SHADER_DIR="/usr/share/games/pcsx2"
# Game DB installation path : -DGAMEINDEX_DIR="/usr/share/games/pcsx2"
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# Misc option
#-------------------------------------------------------------------------------
option(DISABLE_BUILD_DATE "Disable including the binary compile date")
if(DISABLE_BUILD_DATE OR openSUSE)
message(STATUS "Disabling the inclusion of the binary compile date.")
add_definitions(-DDISABLE_BUILD_DATE)
endif()
option(USE_VTUNE "Plug VTUNE to profile GSdx JIT.")
#-------------------------------------------------------------------------------
# Graphical option
#-------------------------------------------------------------------------------
option(GLSL_API "Replace ZZogl CG backend by GLSL (experimental option)")
option(EGL_API "Use EGL on ZZogl/GSdx (experimental/developer option)")
option(OPENCL_API "Add OpenCL support on GSdx")
option(REBUILD_SHADER "Rebuild GLSL/CG shader (developer option)")
option(BUILD_REPLAY_LOADERS "Build GS replayer to ease testing (developer option)")
option(GSDX_LEGACY "Build a GSdx legacy plugin compatible with GL3.3")
#-------------------------------------------------------------------------------
# Path and lib option
#-------------------------------------------------------------------------------
option(PACKAGE_MODE "Use this option to ease packaging of PCSX2 (developer/distribution option)")
option(DISABLE_CHEATS_ZIP "Disable including the cheats_ws.zip file")
option(DISABLE_PCSX2_WRAPPER "Disable including the PCSX2-linux.sh file")
option(XDG_STD "Use XDG standard path instead of the standard PCSX2 path")
option(EXTRA_PLUGINS "Build various 'extra' plugins")
option(PORTAUDIO_API "Build portaudio support on spu2x" ON)
option(SDL2_API "Use SDL2 on spu2x and onepad (wxWidget mustn't be built with SDL1.2 support" ON)
option(GTK3_API "Use GTK3 api (experimental/wxWidget must be built with GTK3 support)")
if(PACKAGE_MODE)
if(NOT DEFINED PLUGIN_DIR)
set(PLUGIN_DIR "${CMAKE_INSTALL_PREFIX}/lib/games/PCSX2")
endif()
if(NOT DEFINED GAMEINDEX_DIR)
set(GAMEINDEX_DIR "${CMAKE_INSTALL_PREFIX}/share/games/PCSX2")
endif()
if(NOT DEFINED BIN_DIR)
set(BIN_DIR "${CMAKE_INSTALL_PREFIX}/bin")
endif()
if(NOT DEFINED DOC_DIR)
set(DOC_DIR "${CMAKE_INSTALL_PREFIX}/share/doc/PCSX2")
endif()
if(NOT DEFINED MAN_DIR)
set(MAN_DIR "${CMAKE_INSTALL_PREFIX}/share/man")
endif()
# Compile all source codes with those defines
add_definitions(-DPLUGIN_DIR_COMPILATION=${PLUGIN_DIR} -DGAMEINDEX_DIR_COMPILATION=${GAMEINDEX_DIR} -DDOC_DIR_COMPILATION=${DOC_DIR})
endif()
if(APPLE)
option(OSX_USE_DEFAULT_SEARCH_PATH "Don't prioritize system library paths" OFF)
option(SKIP_POSTPROCESS_BUNDLE "Skip postprocessing bundle for redistributability" OFF)
endif()
#-------------------------------------------------------------------------------
# Compiler extra
#-------------------------------------------------------------------------------
option(USE_ASAN "Enable address sanitizer")
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
set(USE_CLANG TRUE)
message(STATUS "Building with Clang/LLVM.")
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
set(USE_ICC TRUE)
message(STATUS "Building with Intel's ICC.")
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(USE_GCC TRUE)
message(STATUS "Building with GNU GCC")
else()
message(FATAL_ERROR "Unknown compiler: ${CMAKE_CXX_COMPILER_ID}")
endif()
#-------------------------------------------------------------------------------
# Select the support of plugin
#-------------------------------------------------------------------------------
option(BUILTIN_GS "Disable support of GS plugin (developer option)")
option(BUILTIN_PAD "Disable support of PAD plugin (developer option)")
option(BUILTIN_SPU2 "Disable support of SPU2 plugin (developer option)")
option(BUILTIN_USB "Disable support of USB plugin (developer option)")
option(BUILTIN_FW "Disable support of FW plugin (developer option)")
option(BUILTIN_DEV9 "Disable support of DEV9 plugin (developer option)")
option(BUILTIN_CDVD "Disable support of CDVD plugin (developer option)")
set(PLUGIN_SUPPORT "")
if(BUILTIN_GS)
set(PLUGIN_SUPPORT "${PLUGIN_SUPPORT} -DBUILTIN_GS_PLUGIN")
endif()
if(BUILTIN_PAD)
set(PLUGIN_SUPPORT "${PLUGIN_SUPPORT} -DBUILTIN_PAD_PLUGIN")
endif()
if(BUILTIN_SPU2)
set(PLUGIN_SUPPORT "${PLUGIN_SUPPORT} -DBUILTIN_SPU2_PLUGIN")
endif()
if(BUILTIN_USB)
set(PLUGIN_SUPPORT "${PLUGIN_SUPPORT} -DBUILTIN_USB_PLUGIN")
endif()
if(BUILTIN_FW)
set(PLUGIN_SUPPORT "${PLUGIN_SUPPORT} -DBUILTIN_FW_PLUGIN")
endif()
if(BUILTIN_DEV)
set(PLUGIN_SUPPORT "${PLUGIN_SUPPORT} -DBUILTIN_DEV_PLUGIN")
endif()
if(BUILTIN_CDVD)
set(PLUGIN_SUPPORT "${PLUGIN_SUPPORT} -DBUILTIN_CDVD_PLUGIN")
endif()
#-------------------------------------------------------------------------------
# if no build type is set, use Devel as default
# Note without the CMAKE_BUILD_TYPE options the value is still defined to ""
# Ensure that the value set by the User is correct to avoid some bad behavior later
#-------------------------------------------------------------------------------
if(NOT CMAKE_BUILD_TYPE MATCHES "Debug|Devel|Release|Prof")
set(CMAKE_BUILD_TYPE Devel)
message(STATUS "BuildType set to ${CMAKE_BUILD_TYPE} by default")
endif()
# AVX2 doesn't play well with gdb
if(CMAKE_BUILD_TYPE MATCHES "Debug")
SET(DISABLE_ADVANCE_SIMD ON)
endif()
# Initially strip was disabled on release build but it is not stackstrace friendly!
# It only cost several MB so disbable it by default
option(CMAKE_BUILD_STRIP "Srip binaries to save a couple of MB (developer option)")
if(NOT DEFINED CMAKE_BUILD_PO)
if(CMAKE_BUILD_TYPE STREQUAL "Release")
set(CMAKE_BUILD_PO TRUE)
message(STATUS "Enable the building of po files by default in ${CMAKE_BUILD_TYPE} build !!!")
else()
set(CMAKE_BUILD_PO FALSE)
message(STATUS "Disable the building of po files by default in ${CMAKE_BUILD_TYPE} build !!!")
endif()
endif()
#-------------------------------------------------------------------------------
# Select the architecture
#-------------------------------------------------------------------------------
option(DISABLE_ADVANCE_SIMD "Disable advance use of SIMD (SSE2+ & AVX)" OFF)
# Print if we are cross compiling.
if(CMAKE_CROSSCOMPILING)
message(STATUS "Cross compilation is enabled.")
else()
message(STATUS "Cross compilation is disabled.")
endif()
# Architecture bitness detection
include(TargetArch)
target_architecture(PCSX2_TARGET_ARCHITECTURES)
if(${PCSX2_TARGET_ARCHITECTURES} MATCHES "x86_64" OR ${PCSX2_TARGET_ARCHITECTURES} MATCHES "i386")
if(${PCSX2_TARGET_ARCHITECTURES} MATCHES "x86_64" AND (CMAKE_BUILD_TYPE MATCHES "Release" OR PACKAGE_MODE))
message(FATAL_ERROR "
The code for ${PCSX2_TARGET_ARCHITECTURES} support is not ready yet.
For now compile with -DCMAKE_TOOLCHAIN_FILE=cmake/linux-compiler-i386-multilib.cmake
or with
--cross-multilib passed to build.sh")
endif()
message(STATUS "Compiling a ${PCSX2_TARGET_ARCHITECTURES} build on a ${CMAKE_HOST_SYSTEM_PROCESSOR} host.")
else()
message(FATAL_ERROR "Unsupported architecture: ${PCSX2_TARGET_ARCHITECTURES}")
endif()
# Print a clear message that most architectures are not supported
if(NOT (${PCSX2_TARGET_ARCHITECTURES} MATCHES "i386"))
message(WARNING "
PCSX2 does not support the ${PCSX2_TARGET_ARCHITECTURES} architecture and has no plans yet to support it.
It would need a complete rewrite of the core emulator and a lot of time.
You can still run a i386 binary if you install all the i386 libraries (runtime and dev).")
endif()
if(${PCSX2_TARGET_ARCHITECTURES} MATCHES "i386")
# * -fPIC option was removed for multiple reasons.
# - Code only supports the x86 architecture.
# - code uses the ebx register so it's not compliant with PIC.
# - Impacts the performance too much.
# - Only plugins. No package will link to them.
set(CMAKE_POSITION_INDEPENDENT_CODE OFF)
if(NOT DEFINED ARCH_FLAG)
if (DISABLE_ADVANCE_SIMD)
if (USE_ICC)
set(ARCH_FLAG "-msse2")
else()
set(ARCH_FLAG "-msse -msse2 -mfxsr -mxsave -march=i686")
endif()
else()
# AVX requires some fix of the ABI (mangling) (default 2)
# Note: V6 requires GCC 4.7
#set(ARCH_FLAG "-march=native -fabi-version=6")
set(ARCH_FLAG "-mfxsr -mxsave -march=native")
endif()
endif()
add_definitions(-D_ARCH_32=1 -D_M_X86=1 -D_M_X86_32=1)
set(_ARCH_32 1)
set(_M_X86 1)
set(_M_X86_32 1)
elseif(${PCSX2_TARGET_ARCHITECTURES} MATCHES "x86_64")
# x86_64 requires -fPIC
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
if(NOT DEFINED ARCH_FLAG)
if (DISABLE_ADVANCE_SIMD)
if (USE_ICC)
set(ARCH_FLAG "-msse2")
else()
set(ARCH_FLAG "-msse -msse2 -mfxsr")
endif()
else()
#set(ARCH_FLAG "-march=native -fabi-version=6")
set(ARCH_FLAG "-march=native")
endif()
endif()
add_definitions(-D_ARCH_64=1 -D_M_X86=1 -D_M_X86_64=1)
set(_ARCH_64 1)
set(_M_X86 1)
set(_M_X86_64 1)
else()
# All but i386 requires -fPIC
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
message(FATAL_ERROR "Unsupported architecture: ${PCSX2_TARGET_ARCHITECTURES}")
endif()
#-------------------------------------------------------------------------------
# Control GCC flags
#-------------------------------------------------------------------------------
### Cmake set default value for various compilation variable
### Here the list of default value for documentation purpose
# ${CMAKE_SHARED_LIBRARY_CXX_FLAGS} = "-fPIC"
# ${CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS} = "-rdynamic"
#
# ${CMAKE_C_FLAGS} = "-g -O2"
# ${CMAKE_CXX_FLAGS} = "-g -O2"
# Use in debug mode
# ${CMAKE_CXX_FLAGS_DEBUG} = "-g"
# Use in release mode
# ${CMAKE_CXX_FLAGS_RELEASE} = "-O3 -DNDEBUG"
#-------------------------------------------------------------------------------
# Do not use default cmake flags
#-------------------------------------------------------------------------------
set(CMAKE_C_FLAGS_DEBUG "")
set(CMAKE_CXX_FLAGS_DEBUG "")
set(CMAKE_C_FLAGS_DEVEL "")
set(CMAKE_CXX_FLAGS_DEVEL "")
set(CMAKE_C_FLAGS_RELEASE "")
set(CMAKE_CXX_FLAGS_RELEASE "")
#-------------------------------------------------------------------------------
# Remove bad default option
#-------------------------------------------------------------------------------
# Remove -rdynamic option that can some segmentation fault when openining pcsx2 plugins
set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "")
if(${PCSX2_TARGET_ARCHITECTURES} MATCHES "i386")
# Remove -fPIC option on 32bit architectures.
# No good reason to use it for plugins, also it impacts performance.
set(CMAKE_SHARED_LIBRARY_C_FLAGS "")
set(CMAKE_SHARED_LIBRARY_CXX_FLAGS "")
endif()
#-------------------------------------------------------------------------------
# Set some default compiler flags
#-------------------------------------------------------------------------------
option(USE_LTO "Enable LTO optimization")
option(USE_PGO_GENERATE "Enable PGO optimization (generate profile)")
option(USE_PGO_OPTIMIZE "Enable PGO optimization (use profile)")
# Note1: Builtin strcmp/memcmp was proved to be slower on Mesa than stdlib version.
# Note2: float operation SSE is impacted by the PCSX2 SSE configuration. In particular, flush to zero denormal.
set(COMMON_FLAG "-pipe -fvisibility=hidden -pthread -fno-builtin-strcmp -fno-builtin-memcmp -mfpmath=sse")
if(USE_VTUNE)
set(COMMON_FLAG "${COMMON_FLAG} -DENABLE_VTUNE")
endif()
# Remove FORTIFY_SOURCE when compiling as debug, because it spams a lot of warnings on clang due to no optimization.
# Should probably be checked on gcc as well, as the USE_CLANG might not be needed.
if (USE_CLANG AND CMAKE_BUILD_TYPE MATCHES "Debug")
set(HARDENING_FLAG "-Wformat -Wformat-security")
else()
set(HARDENING_FLAG "-D_FORTIFY_SOURCE=2 -Wformat -Wformat-security")
endif()
# -Wno-attributes: "always_inline function might not be inlinable" <= real spam (thousand of warnings!!!)
# -Wno-missing-field-initializers: standard allow to init only the begin of struct/array in static init. Just a silly warning.
# Note: future GCC (aka GCC 5.1.1) has less false positive so warning could maybe put back
# -Wno-unused-function: warn for function not used in release build
# -Wno-unused-value: lots of warning for this kind of statements "0 && ...". There are used to disable some parts of code in release/dev build.
# -Wno-overloaded-virtual: Gives a fair number of warnings under clang over in the wxwidget gui section of the code.
set(DEFAULT_WARNINGS "-Wall -Wextra -Wno-attributes -Wno-unused-function -Wno-unused-parameter -Wno-missing-field-initializers -Wno-overloaded-virtual")
if (NOT USE_ICC)
set(DEFAULT_WARNINGS "${DEFAULT_WARNINGS} -Wno-unused-value ")
endif()
# -Wstrict-aliasing=n: to fix one day aliasing issue. n=1/2/3
if (USE_ICC)
set(AGGRESSIVE_WARNING "-Wstrict-aliasing ")
else()
set(AGGRESSIVE_WARNING "-Wstrict-aliasing -Wstrict-overflow=1 ")
endif()
if (USE_CLANG)
# -Wno-deprecated-register: glib issue...
set(DEFAULT_WARNINGS "${DEFAULT_WARNINGS} -Wno-deprecated-register -Wno-c++14-extensions")
set(DBG "-g -fno-omit-frame-pointer")
elseif (USE_ICC)
set(DBG "-g -fno-omit-frame-pointer")
elseif (USE_GCC)
set(DBG "-ggdb3 -fno-omit-frame-pointer")
endif()
if (USE_LTO)
include(ProcessorCount)
ProcessorCount(ncpu)
set(LTO_FLAGS "-fuse-linker-plugin -flto=${ncpu}")
set(DBG "") # not supported with LTO
set(CMAKE_AR /usr/bin/gcc-ar CACHE STRING "Archiver" FORCE)
set(CMAKE_RANLIB /usr/bin/gcc-ranlib CACHE STRING "ranlib" FORCE)
set(CMAKE_NM /usr/bin/gcc-nm CACHE STRING "nm" FORCE)
else()
set(LTO_FLAGS "")
endif()
if (USE_PGO_GENERATE OR USE_PGO_OPTIMIZE)
set(PGO_FLAGS "-fprofile-dir=${CMAKE_SOURCE_DIR}/profile")
endif()
if (USE_PGO_GENERATE)
set(PGO_FLAGS "${PGO_FLAGS} -fprofile-generate")
endif()
if(USE_PGO_OPTIMIZE)
set(PGO_FLAGS "${PGO_FLAGS} -fprofile-use")
endif()
if(CMAKE_BUILD_TYPE MATCHES "Debug")
set(DEBUG_FLAG "${DBG} -DPCSX2_DEVBUILD -DPCSX2_DEBUG -D_DEBUG")
elseif(CMAKE_BUILD_TYPE MATCHES "Devel")
set(DEBUG_FLAG "${DBG} -DNDEBUG -DPCSX2_DEVBUILD -D_DEVEL")
elseif(CMAKE_BUILD_TYPE MATCHES "Release")
set(DEBUG_FLAG "-DNDEBUG")
elseif(CMAKE_BUILD_TYPE MATCHES "Prof")
# Keep frame pointer and debug information for profiler tool
set(DEBUG_FLAG "-g -fno-omit-frame-pointer -DNDEBUG")
endif()
if (USE_ASAN)
set(ASAN_FLAG "-fsanitize=address ${DBG} -DASAN_WORKAROUND")
else()
set(ASAN_FLAG "")
endif()
if(NOT DEFINED OPTIMIZATION_FLAG)
if (CMAKE_BUILD_TYPE STREQUAL Debug)
if (USE_GCC)
set(OPTIMIZATION_FLAG -Og)
else()
set(OPTIMIZATION_FLAG -O0)
endif()
else()
set(OPTIMIZATION_FLAG -O2)
endif()
endif()
if (NOT DEFINED PGO)
set(PGO "none")
set(GCOV_LIBRARIES "")
else()
set(GCOV_LIBRARIES "-lgcov")
endif()
if(USE_CLANG)
if(TIMETRACE)
set(COMMON_FLAG "${COMMON_FLAG} -ftime-trace ")
endif()
endif()
# Note: -DGTK_DISABLE_DEPRECATED can be used to test a build without gtk deprecated feature. It could be useful to port to a newer API
set(DEFAULT_GCC_FLAG "${ARCH_FLAG} ${COMMON_FLAG} ${DEFAULT_WARNINGS} ${AGGRESSIVE_WARNING} ${HARDENING_FLAG} ${DEBUG_FLAG} ${ASAN_FLAG} ${OPTIMIZATION_FLAG} ${LTO_FLAGS} ${PGO_FLAGS} ${PLUGIN_SUPPORT}")
# c++ only flags
set(DEFAULT_CPP_FLAG "${DEFAULT_GCC_FLAG} -std=c++11 -Wno-invalid-offsetof")
#-------------------------------------------------------------------------------
# Allow user to set some default flags
# Note: string STRIP must be used to remove trailing and leading spaces.
# See policy CMP0004
#-------------------------------------------------------------------------------
# TODO: once we completely clean all flags management, this mess could be cleaned ;)
### linker flags
if(DEFINED USER_CMAKE_LD_FLAGS)
message(STATUS "Pcsx2 is very sensible with gcc flags, so use USER_CMAKE_LD_FLAGS at your own risk !!!")
string(STRIP "${USER_CMAKE_LD_FLAGS}" USER_CMAKE_LD_FLAGS)
else()
set(USER_CMAKE_LD_FLAGS "")
endif()
# ask the linker to strip the binary
if(CMAKE_BUILD_STRIP)
string(STRIP "${USER_CMAKE_LD_FLAGS} -s" USER_CMAKE_LD_FLAGS)
endif()
### c flags
# Note CMAKE_C_FLAGS is also send to the linker.
# By default allow build on amd64 machine
if(DEFINED USER_CMAKE_C_FLAGS)
message(STATUS "Pcsx2 is very sensible with gcc flags, so use USER_CMAKE_C_FLAGS at your own risk !!!")
string(STRIP "${USER_CMAKE_C_FLAGS}" CMAKE_C_FLAGS)
endif()
# Use some default machine flags
string(STRIP "${CMAKE_C_FLAGS} ${DEFAULT_GCC_FLAG}" CMAKE_C_FLAGS)
### C++ flags
# Note CMAKE_CXX_FLAGS is also send to the linker.
# By default allow build on amd64 machine
if(DEFINED USER_CMAKE_CXX_FLAGS)
message(STATUS "Pcsx2 is very sensible with gcc flags, so use USER_CMAKE_CXX_FLAGS at your own risk !!!")
string(STRIP "${USER_CMAKE_CXX_FLAGS}" CMAKE_CXX_FLAGS)
endif()
# Use some default machine flags
string(STRIP "${CMAKE_CXX_FLAGS} ${DEFAULT_CPP_FLAG}" CMAKE_CXX_FLAGS)
#-------------------------------------------------------------------------------
# Too much user/packager use experimental flags as release flags
#-------------------------------------------------------------------------------
if(CMAKE_BUILD_TYPE MATCHES "Release" OR PACKAGE_MODE)
if (GTK3_API)
message(WARNING "GTK3 is highly experimental besides it requires a wxWidget built with __WXGTK3__ support !!!")
endif()
endif()
#-------------------------------------------------------------------------------
# MacOS-specific things
#-------------------------------------------------------------------------------
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.9)
# CMake defaults the suffix for modules to .so on macOS but wx tells us that the
# extension is .dylib (so that's what we search for)
if(APPLE)
set(CMAKE_SHARED_MODULE_SUFFIX ".dylib")
endif()
if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
if(NOT OSX_USE_DEFAULT_SEARCH_PATH)
# Hack up the path to prioritize the path to built-in OS libraries to
# increase the chance of not depending on a bunch of copies of them
# installed by MacPorts, Fink, Homebrew, etc, and ending up copying
# them into the bundle. Since we depend on libraries which are not
# part of OS X (wx, etc.), however, don't remove the default path
# entirely. This is still kinda evil, since it defeats the user's
# path settings...
# See http://www.cmake.org/cmake/help/v3.0/command/find_program.html
list(APPEND CMAKE_PREFIX_PATH "/usr")
endif()
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-dead_strip,-dead_strip_dylibs")
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,-dead_strip,-dead_strip_dylibs")
endif()