forked from blupi-games/planetblupi-dev
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
510 lines (463 loc) · 13.5 KB
/
CMakeLists.txt
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
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
cmake_minimum_required (VERSION 3.2)
include (${CMAKE_ROOT}/Modules/ExternalProject.cmake)
include_directories (${CMAKE_BINARY_DIR}/include)
link_directories (${CMAKE_BINARY_DIR}/lib)
set (STATIC_BUILD true)
# It's an hack in order to be able to link statically planetblupi on darwin.
if (APPLE)
set (ISAPPLE 1)
set (CMD_LDFLAGS "-L${CMAKE_BINARY_DIR}/lib -framework AudioToolBox -framework AudioUnit -framework CoreAudio -framework CoreFoundation -framework Cocoa -framework OpenGL -framework IOKit -framework CoreVideo -framework Carbon")
if (OLD_SDK)
set (OSX_SDK_VERSION 10.9)
set (CMAKE_OSX_SYSROOT "/Developer/SDKs/MacOSX${OSX_SDK_VERSION}.sdk/")
set (CMAKE_OSX_DEPLOYMENT_TARGET ${OSX_SDK_VERSION})
set (CMD_CXXFLAGS "-isysroot ${CMAKE_OSX_SYSROOT} -mmacosx-version-min=${OSX_SDK_VERSION} ${CMAKE_CXX_FLAGS}")
set (CMD_CFLAGS "-isysroot ${CMAKE_OSX_SYSROOT} -mmacosx-version-min=${OSX_SDK_VERSION} ${CMAKE_C_FLAGS}")
endif ()
set (CMD_CPPFLAGS "-I${CMAKE_BINARY_DIR}/include")
endif ()
configure_file (cmd.sh.in cmd.sh @ONLY)
set (CMD ${CMAKE_BINARY_DIR}/cmd.sh)
#########
## zlib
#########
if (WIN32)
ExternalProject_Add (zlib_Project
URL http://www.zlib.net/zlib-1.2.11.tar.gz
PREFIX ${CMAKE_BINARY_DIR}
CONFIGURE_COMMAND
BUILD_COMMAND ${CMD} make -fwin32/Makefile.gcc
INSTALL_COMMAND ${CMD} make install -fwin32/Makefile.gcc
BUILD_IN_SOURCE 1
INSTALL_DIR ${CMAKE_BINARY_DIR}
)
else ()
ExternalProject_Add (zlib_Project
URL http://www.zlib.net/zlib-1.2.11.tar.gz
PREFIX ${CMAKE_BINARY_DIR}
CONFIGURE_COMMAND ${CMD} ./configure
--prefix=${CMAKE_BINARY_DIR}
--static
BUILD_COMMAND ${CMD} make
INSTALL_COMMAND ${CMD} make install
BUILD_IN_SOURCE 1
INSTALL_DIR ${CMAKE_BINARY_DIR}
)
endif ()
#########
## argagg
#########
ExternalProject_Add (argagg_Project
URL https://github.com/vietjtnguyen/argagg/archive/0.4.6.tar.gz
PREFIX ${CMAKE_BINARY_DIR}
CMAKE_ARGS "-DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_BINARY_DIR}"
)
##########
## libcurl
##########
ExternalProject_Add (libcurl_Project
URL https://curl.haxx.se/download/curl-7.55.0.tar.xz
PREFIX ${CMAKE_BINARY_DIR}
CONFIGURE_COMMAND ${CMD} ./configure
--prefix=${CMAKE_BINARY_DIR}
--disable-shared
--enable-static
--enable-http
--disable-ftp
--disable-file
--disable-ldap
--disable-ldaps
--disable-rtsp
--disable-proxy
--disable-dict
--disable-telnet
--disable-tftp
--disable-pop3
--disable-imap
--disable-smb
--disable-smtp
--disable-gopher
--disable-manual
--disable-libcurl-option
--enable-ipv6
--disable-sspi
--disable-ntlm-wb
--disable-unix-socket
--without-winssl
--without-darwinssl
--without-ssl
--without-gnutls
--without-polarssl
--without-mbedtls
--without-cyassl
--without-axtls
--without-libpsl
--without-libmetalink
--without-libssh2
--without-librtmp
--without-nghttp2
--without-libidn2
BUILD_COMMAND ${CMD} make
INSTALL_COMMAND ${CMD} make install
BUILD_IN_SOURCE 1
INSTALL_DIR ${CMAKE_BINARY_DIR}
DEPENDS zlib_Project
)
###########
## libiconv
###########
if (NOT APPLE)
ExternalProject_Add (libiconv_Project
URL https://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.15.tar.gz
PREFIX ${CMAKE_BINARY_DIR}
CONFIGURE_COMMAND ${CMD} ./configure
--prefix=${CMAKE_BINARY_DIR}
--disable-shared
--enable-static
BUILD_COMMAND ${CMD} make
INSTALL_COMMAND ${CMD} make install
BUILD_IN_SOURCE 1
INSTALL_DIR ${CMAKE_BINARY_DIR}
)
endif ()
##########
## gettext
##########
set (gettext_DEPENDS)
if (NOT APPLE)
set (gettext_DEPENDS ${gettext_DEPENDS} libiconv_Project)
endif ()
ExternalProject_Add (gettext_Project
URL http://mirror.switch.ch/ftp/mirror/gnu/gettext/gettext-0.19.8.1.tar.xz
PREFIX ${CMAKE_BINARY_DIR}
CONFIGURE_COMMAND cd gettext-runtime && ${CMD} ./configure
--prefix=${CMAKE_BINARY_DIR}
--disable-shared
--enable-static
BUILD_COMMAND ${CMD} make -C gettext-runtime
INSTALL_COMMAND ${CMD} make -C gettext-runtime install
BUILD_IN_SOURCE 1
INSTALL_DIR ${CMAKE_BINARY_DIR}
DEPENDS ${gettext_DEPENDS}
)
#########
## libpng
#########
ExternalProject_Add (libpng_Project
URL http://prdownloads.sourceforge.net/libpng/libpng-1.6.28.tar.xz
PREFIX ${CMAKE_BINARY_DIR}
CONFIGURE_COMMAND ${CMD} ./configure
--prefix=${CMAKE_BINARY_DIR}
--disable-shared
--enable-static
BUILD_COMMAND ${CMD} make
INSTALL_COMMAND ${CMD} make install
BUILD_IN_SOURCE 1
INSTALL_DIR ${CMAKE_BINARY_DIR}
DEPENDS zlib_Project
)
#########
## FFmpeg
#########
ExternalProject_Add (FFmpeg_Project
URL http://www.ffmpeg.org/releases/ffmpeg-3.2.4.tar.xz
PREFIX ${CMAKE_BINARY_DIR}
CONFIGURE_COMMAND ${CMD} ./configure
--prefix=${CMAKE_BINARY_DIR}
--disable-shared
--enable-static
--disable-iconv
--disable-programs
--disable-doc
--disable-yasm
--disable-avdevice
--disable-avfilter
--disable-network
--disable-everything
--enable-decoder=cinepak,msvideo1,vorbis
--enable-demuxer=matroska
--enable-protocol=file
--disable-crystalhd
--disable-xvmc
--disable-vaapi
--disable-videotoolbox
--disable-vdpau
--disable-vda
--disable-nvenc
--disable-dxva2
--disable-d3d11va
--disable-audiotoolbox
--disable-zlib
--disable-bzlib
--disable-lzma
--disable-xlib
--disable-sdl2
--disable-libxcb
--disable-libxcb-shm
--disable-libxcb-xfixes
--disable-libxcb-shape
BUILD_COMMAND ${CMD} make
INSTALL_COMMAND ${CMD} make install
BUILD_IN_SOURCE 1
INSTALL_DIR ${CMAKE_BINARY_DIR}
)
############
## libasound
############
if (UNIX AND NOT APPLE)
ExternalProject_Add (libasound_Project
URL ftp://ftp.alsa-project.org/pub/lib/alsa-lib-1.1.4.1.tar.bz2
PREFIX ${CMAKE_BINARY_DIR}
CONFIGURE_COMMAND ${CMD} ./configure
--prefix=${CMAKE_BINARY_DIR}
--disable-shared
--enable-static
--disable-old-symbols
--disable-python
BUILD_COMMAND ${CMD} make
INSTALL_COMMAND ${CMD} make install
BUILD_IN_SOURCE 1
INSTALL_DIR ${CMAKE_BINARY_DIR}
)
endif ()
###########
## libpulse
###########
if (UNIX AND NOT APPLE)
ExternalProject_Add (libpulse_Project
URL https://freedesktop.org/software/pulseaudio/releases/pulseaudio-11.0.tar.xz
PREFIX ${CMAKE_BINARY_DIR}
CONFIGURE_COMMAND ${CMD} ./configure
--prefix=${CMAKE_BINARY_DIR}
--disable-shared
--enable-static
--enable-alsa
--disable-nls
--disable-x11
--disable-tests
--disable-esound
--disable-waveout
--disable-gconf
--disable-glib2
--disable-gtk3
--disable-jack
--disable-asyncns
--disable-avahi
--disable-openssl
--disable-tcpwrap
--disable-lirc
--disable-dbus
--disable-udev
--disable-bluez4
--disable-bluez5
--disable-hal-compat
--disable-ipv6
--disable-webrtc-aec
--disable-systemd-daemon
--disable-systemd-login
--disable-systemd-journal
--disable-manpages
--disable-default-build-tests
--disable-legacy-database-entry-format
--enable-static-bins
--without-caps
--without-fftw
--without-speex
--without-soxr
--with-database=simple
BUILD_COMMAND ${CMD} make
INSTALL_COMMAND ${CMD} make install INSTALLDIR=${CMAKE_BINARY_DIR}
BUILD_IN_SOURCE 1
INSTALL_DIR ${CMAKE_BINARY_DIR}
DEPENDS libasound_Project
)
endif ()
#######
## SDL2
#######
if (UNIX AND NOT APPLE)
set (SDL2_CONFIGURE --enable-video-x11
--enable-x11-shared
--enable-video-wayland
--enable-wayland-shared
--enable-video-opengl
--enable-oss
--enable-alsa
--disable-alsa-shared
--disable-sndio
--disable-sndio-shared
--enable-pulseaudio
--disable-pulseaudio-shared)
elseif (MINGW)
set (SDL2_CONFIGURE --enable-directx
--enable-render-d3d
--enable-video-opengl)
elseif (APPLE)
set (SDL2_CONFIGURE --enable-video-opengl
--enable-video-cocoa)
endif ()
set (SDL2_DEPENDS zlib_Project)
if (UNIX AND NOT APPLE)
set (SDL2_DEPENDS ${SDL2_DEPENDS} libasound_Project libpulse_Project)
endif ()
ExternalProject_Add (SDL2_Project
URL http://hg.libsdl.org/SDL/archive/3d0bbfe683a8.tar.bz2
PREFIX ${CMAKE_BINARY_DIR}
CONFIGURE_COMMAND ${CMD} ./configure
--prefix=${CMAKE_BINARY_DIR}
--disable-shared
--enable-static
--disable-joystick
--disable-haptic
${SDL2_CONFIGURE}
BUILD_COMMAND ${CMD} make
INSTALL_COMMAND ${CMD} make install
BUILD_IN_SOURCE 1
INSTALL_DIR ${CMAKE_BINARY_DIR}
DEPENDS ${SDL2_DEPENDS}
)
#############
## SDL2_image
#############
ExternalProject_Add (SDL2_image_Project
URL https://www.libsdl.org/projects/SDL_image/release/SDL2_image-2.0.1.tar.gz
PREFIX ${CMAKE_BINARY_DIR}
CONFIGURE_COMMAND ${CMD} ./configure
--prefix=${CMAKE_BINARY_DIR}
--disable-shared
--enable-static
--disable-sdl-test
--disable-bmp
--disable-gif
--disable-jpg
--disable-jpg-shared
--disable-lbm
--disable-pcx
--enable-png
--disable-png-shared
--disable-pnm
--disable-tga
--disable-tif
--disable-tif-shared
--disable-xcf
--disable-xpm
--disable-xv
--disable-webp
--disable-webp-shared
BUILD_COMMAND ${CMD} make
INSTALL_COMMAND ${CMD} make install
BUILD_IN_SOURCE 1
INSTALL_DIR ${CMAKE_BINARY_DIR}
DEPENDS SDL2_Project libpng_Project
)
#############
## SDL2_mixer
#############
set (SDL2_mixer_DEPENDS SDL2_Project)
if (NOT APPLE)
set (SDL2_mixer_DEPENDS ${SDL2_mixer_DEPENDS} libiconv_Project)
endif ()
ExternalProject_Add (SDL2_mixer_Project
URL https://www.libsdl.org/projects/SDL_mixer/release/SDL2_mixer-2.0.1.tar.gz
PREFIX ${CMAKE_BINARY_DIR}
CONFIGURE_COMMAND ${CMD} ./configure
--prefix=${CMAKE_BINARY_DIR}
--disable-shared
--enable-static
--disable-sdltest
--disable-music-cmd
--enable-music-wave
--disable-music-mod
--disable-music-mod-modplug
--disable-music-mod-modplug-shared
--disable-music-mod-mikmod
--disable-music-mod-mikmod-shared
--enable-music-midi
--enable-music-midi-timidity
--enable-music-midi-native
--disable-music-midi-fluidsynth
--disable-music-midi-fluidsynth-shared
--disable-music-ogg
--disable-music-ogg-tremor
--disable-music-ogg-shared
--disable-music-flac
--disable-music-flac-shared
--disable-music-mp3
--disable-music-mp3-smpeg
--disable-music-mp3-smpeg-shared
--disable-smpegtest
--disable-music-mp3-mad-gpl
BUILD_COMMAND ${CMD} make
INSTALL_COMMAND ${CMD} make install
BUILD_IN_SOURCE 1
INSTALL_DIR ${CMAKE_BINARY_DIR}
DEPENDS ${SDL2_mixer_DEPENDS}
)
##################
## SDL_kitchensink
##################
ExternalProject_Add (SDL_kitchensink_Project
URL ${CMAKE_SOURCE_DIR}/SDL_kitchensink
DOWNLOAD_COMMAND ""
SOURCE_DIR ${CMAKE_SOURCE_DIR}/SDL_kitchensink
PREFIX ${CMAKE_BINARY_DIR}
CMAKE_COMMAND ${CMD} cmake
CMAKE_ARGS -DDISABLE_SHARED=true
-DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
INSTALL_DIR ${CMAKE_BINARY_DIR}
BUILD_ALWAYS 1
DEPENDS SDL2_Project FFmpeg_Project
)
##############
## planetblupi
##############
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
set (APPIMAGE_APPRUN_BIN "AppRun-x86_64")
set (APPIMAGE_APPRUN_URL "https://github.com/probonopd/AppImageKit/releases/download/continuous/${APPIMAGE_APPRUN_BIN}")
set (APPIMAGE_APPRUN_PROGRAM "${CMAKE_BINARY_DIR}/bin/${APPIMAGE_APPRUN_BIN}")
set (APPIMAGE_TOOL_BIN "appimagetool-x86_64.AppImage")
set (APPIMAGE_TOOL_URL "https://github.com/probonopd/AppImageKit/releases/download/continuous/${APPIMAGE_TOOL_BIN}")
set (APPIMAGE_TOOL_PROGRAM "${CMAKE_BINARY_DIR}/bin/${APPIMAGE_TOOL_BIN}")
if (NOT EXISTS "${APPIMAGE_APPRUN_PROGRAM}")
file (DOWNLOAD "${APPIMAGE_APPRUN_URL}" "${APPIMAGE_APPRUN_PROGRAM}")
endif ()
if (NOT EXISTS "${APPIMAGE_TOOL_PROGRAM}")
file (DOWNLOAD "${APPIMAGE_TOOL_URL}" "${APPIMAGE_TOOL_PROGRAM}")
endif ()
execute_process (COMMAND /bin/chmod 0755 "${APPIMAGE_APPRUN_PROGRAM}")
execute_process (COMMAND /bin/chmod 0755 "${APPIMAGE_TOOL_PROGRAM}")
endif ()
set (planetblupi_DEPS
argagg_Project
libcurl_Project
SDL2_Project
SDL2_image_Project
SDL2_mixer_Project
SDL_kitchensink_Project
libpng_Project
gettext_Project
)
if (UNIX AND NOT APPLE)
list (APPEND planetblupi_DEPS libasound_Project libpulse_Project)
endif ()
ExternalProject_Add (planetblupi_Project
URL ${CMAKE_SOURCE_DIR}/planetblupi
DOWNLOAD_COMMAND ""
SOURCE_DIR ${CMAKE_SOURCE_DIR}/planetblupi
PREFIX ${CMAKE_BINARY_DIR}
CMAKE_COMMAND ${CMD} cmake
CMAKE_ARGS -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DAPPIMAGE_APPRUN_PROGRAM=${APPIMAGE_APPRUN_PROGRAM}
-DAPPIMAGE_ASSISTANT_PROGRAM=${APPIMAGE_TOOL_PROGRAM}
-DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
-DSTATIC_BUILD=${STATIC_BUILD}
-DSIGN_APP=${SIGN_APP}
INSTALL_DIR ${CMAKE_BINARY_DIR}
BUILD_ALWAYS 1
DEPENDS ${planetblupi_DEPS}
)
add_custom_target (dist COMMAND ${CMAKE_MAKE_PROGRAM} package_source)
set (CPACK_SOURCE_GENERATOR "TBZ2")
set (CPACK_SOURCE_PACKAGE_FILE_NAME "planetblupi-dev")
set (CPACK_SOURCE_IGNORE_FILES "/build/;/Debug/;/Release/;/.git/;~$;${CPACK_SOURCE_IGNORE_FILES}")
include (CPack)