-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathCMakeLists.txt
856 lines (764 loc) · 23.9 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
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
cmake_minimum_required (VERSION 3.2)
set (CMAKE_GENERATOR "Unix Makefiles" CACHE INTERNAL "" FORCE)
include (${CMAKE_ROOT}/Modules/ExternalProject.cmake)
include_directories (${CMAKE_BINARY_DIR}/include)
link_directories (${CMAKE_BINARY_DIR}/lib)
option (STATIC_BUILD "Build Planet Blupi statically" ON)
option (EMSCRIPTEN "Build Planet Blupi for emscripten toolchain" OFF)
option (ASMJS "Build for asm.js instead of WebAssembly (slower)" OFF)
option (DISABLE_APPIMAGE "Disable AppImage generation" OFF)
option (SIGN_APP "Sign the executables" OFF)
if (EMSCRIPTEN)
set (BUILD_JS ON)
set (PLATFORM emscripten)
elseif (APPLE)
set (BUILD_DARWIN ON)
set (PLATFORM darwin)
elseif (UNIX)
set (BUILD_LINUX ON)
set (PLATFORM linux)
elseif (MINGW OR WIN32)
set (BUILD_WINDOWS ON)
set (PLATFORM windows)
endif ()
# It's an hack in order to be able to link statically planetblupi on darwin.
if (BUILD_DARWIN)
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.13)
set (CMAKE_OSX_DEPLOYMENT_TARGET ${OSX_SDK_VERSION})
set (CMD_CXXFLAGS "-mmacosx-version-min=${OSX_SDK_VERSION} ${CMAKE_CXX_FLAGS}")
set (CMD_CFLAGS "-mmacosx-version-min=${OSX_SDK_VERSION} ${CMAKE_C_FLAGS}")
endif ()
set (CMD_CPPFLAGS "-I${CMAKE_BINARY_DIR}/include")
elseif (BUILD_JS)
set (EMSCRIPTEN_FLAGS
"-s USE_ZLIB=1 -s USE_LIBPNG=1 -s USE_OGG=1 -s USE_VORBIS=1 -s USE_SDL=2 -s USE_SDL_IMAGE=2 -s SDL2_IMAGE_FORMATS=['png'] -s USE_SDL_MIXER=2 -s TOTAL_MEMORY=256MB"
)
if (ASMJS)
set (EMSCRIPTEN_FLAGS "${EMSCRIPTEN_FLAGS} -s WASM=0")
else ()
set (EMSCRIPTEN_FLAGS "${EMSCRIPTEN_FLAGS} -s WASM=1")
endif ()
set (CMD_CXXFLAGS ${EMSCRIPTEN_FLAGS})
set (CMD_CFLAGS ${EMSCRIPTEN_FLAGS})
set (CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} ${EMSCRIPTEN_FLAGS})
set (CMAKE_C_FLAGS ${CMAKE_C_FLAGS} ${EMSCRIPTEN_FLAGS})
endif ()
configure_file (cmd.sh.in cmd.sh @ONLY)
set (CMD ${CMAKE_BINARY_DIR}/cmd.sh)
###############
## Dependencies
###############
macro (DLEXT in out)
if (NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/externals/${out}")
file (DOWNLOAD "${in}" "${CMAKE_CURRENT_SOURCE_DIR}/externals/${out}" SHOW_PROGRESS)
endif ()
endmacro (DLEXT)
set (HAS_KITCHENSINK ON)
set (HAS_ARGAGG ON)
set (ARGAGG_VER 0.4.6)
DLEXT (https://github.com/vietjtnguyen/argagg/archive/${ARGAGG_VER}.tar.gz argagg-${ARGAGG_VER}.tar.gz)
set (HAS_FFMPEG ON)
set (FFMPEG_VER 5.1.4)
DLEXT (http://www.ffmpeg.org/releases/ffmpeg-${FFMPEG_VER}.tar.xz ffmpeg-${FFMPEG_VER}.tar.xz)
if (NOT BUILD_JS)
set (HAS_SDLMIXER ON)
set (SDLMIXER_VER 2.6.3)
DLEXT (https://github.com/libsdl-org/SDL_mixer/releases/download/release-${SDLMIXER_VER}/SDL2_mixer-${SDLMIXER_VER}.tar.gz SDL2_mixer-${SDLMIXER_VER}.tar.gz)
set (HAS_ZLIB ON)
set (ZLIB_VER 1.2.13)
DLEXT (http://www.zlib.net/fossils/zlib-${ZLIB_VER}.tar.gz zlib-${ZLIB_VER}.tar.gz)
set (HAS_CURL ON)
set (CURL_VER 7.64.0)
DLEXT (https://curl.haxx.se/download/curl-${CURL_VER}.tar.xz curl-${CURL_VER}.tar.xz)
set (HAS_GETTEXT ON)
set (GETTEXT_VER 0.21.1)
DLEXT (http://ftp.gnu.org/pub/gnu/gettext/gettext-${GETTEXT_VER}.tar.xz gettext-${GETTEXT_VER}.tar.xz)
set (HAS_PNG ON)
set (PNG_VER 1.6.36)
DLEXT (https://download.sourceforge.net/libpng/libpng-${PNG_VER}.tar.xz libpng-${PNG_VER}.tar.xz)
set (HAS_OGG ON)
set (OGG_VER 1.3.3)
DLEXT (http://downloads.xiph.org/releases/ogg/libogg-${OGG_VER}.tar.xz libogg-${OGG_VER}.tar.xz)
set (HAS_VORBIS ON)
set (VORBIS_VER 1.3.7)
DLEXT (http://downloads.xiph.org/releases/vorbis/libvorbis-${VORBIS_VER}.tar.xz libvorbis-${VORBIS_VER}.tar.xz)
set (HAS_SDL ON)
set (SDL_VER 2.28.5)
DLEXT (https://www.libsdl.org/release/SDL2-${SDL_VER}.tar.gz SDL2-${SDL_VER}.tar.bz2)
set (HAS_SDLIMAGE ON)
set (SDLIMAGE_VER 2.6.3)
DLEXT (https://github.com/libsdl-org/SDL_image/releases/download/release-${SDLIMAGE_VER}/SDL2_image-${SDLIMAGE_VER}.tar.gz SDL2_image-${SDLIMAGE_VER}.tar.gz)
set (HAS_SDLTTF ON)
set (SDLTTF_VER 2.20.1)
DLEXT (https://github.com/libsdl-org/SDL_ttf/releases/download/release-${SDLTTF_VER}/SDL2_ttf-${SDLTTF_VER}.tar.gz SDL2_ttf-${SDLTTF_VER}.tar.gz)
endif ()
if (BUILD_LINUX OR BUILD_WINDOWS)
set (HAS_ICONV ON)
set (ICONV_VER 1.15)
DLEXT (https://ftp.gnu.org/pub/gnu/libiconv/libiconv-${ICONV_VER}.tar.gz libiconv-${ICONV_VER}.tar.gz)
endif ()
if (BUILD_LINUX)
set (HAS_ALSA ON)
set (ALSA_VER 1.1.8)
DLEXT (ftp://ftp.alsa-project.org/pub/lib/alsa-lib-${ALSA_VER}.tar.bz2 alsa-lib-${ALSA_VER}.tar.bz2)
set (HAS_SNDFILE ON)
set (SNDFILE_VER 1.0.28)
DLEXT (http://www.mega-nerd.com/libsndfile/files/libsndfile-${SNDFILE_VER}.tar.gz libsndfile-${SNDFILE_VER}.tar.gz)
set (HAS_PULSEAUDIO ON)
set (PULSEAUDIO_VER 12.2)
DLEXT (https://freedesktop.org/software/pulseaudio/releases/pulseaudio-${PULSEAUDIO_VER}.tar.xz pulseaudio-${PULSEAUDIO_VER}.tar.xz)
endif ()
message (STATUS "Build projects for ${PLATFORM}")
if (HAS_ZLIB)
message (STATUS " * zlib (${ZLIB_VER})")
endif ()
if (HAS_GETTEXT)
message (STATUS " * gettext (${GETTEXT_VER})")
endif ()
if (HAS_ARGAGG)
message (STATUS " * argagg (${ARGAGG_VER})")
endif ()
if (HAS_CURL)
message (STATUS " * libcurl (${CURL_VER})")
endif ()
if (HAS_ICONV)
message (STATUS " * libiconv (${ICONV_VER})")
endif ()
if (HAS_PNG)
message (STATUS " * libpng (${PNG_VER})")
endif ()
if (HAS_FFMPEG)
message (STATUS " * FFmpeg (${FFMPEG_VER})")
endif ()
if (HAS_SDL)
message (STATUS " * SDL2 (${SDL_VER})")
endif ()
if (HAS_SDLIMAGE)
message (STATUS " * SDL2_image (${SDLIMAGE_VER})")
endif ()
if (HAS_SDLMIXER)
message (STATUS " * SDL2_mixer (${SDLMIXER_VER})")
endif ()
if (HAS_SDLTTF)
message (STATUS " * SDL2_ttf (${SDLTTF_VER})")
endif ()
if (HAS_KITCHENSINK)
message (STATUS " * SDL_kitchensink")
endif ()
if (HAS_ALSA)
message (STATUS " * libasound (${ALSA_VER})")
endif ()
if (HAS_SNDFILE)
message (STATUS " * libsndfile (${SNDFILE_VER})")
endif ()
if (HAS_PULSEAUDIO)
message (STATUS " * libpulse (${PULSEAUDIO_VER})")
endif ()
if (HAS_OGG)
message (STATUS " * libogg (${OGG_VER})")
endif ()
if (HAS_VORBIS)
message (STATUS " * libvorbis (${VORBIS_VER})")
endif ()
set (planetblupi_DEPS)
#######
## zlib
#######
if (HAS_ZLIB)
if (BUILD_WINDOWS)
ExternalProject_Add (zlib_Project
URL ${CMAKE_CURRENT_SOURCE_DIR}/externals/zlib-${ZLIB_VER}.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 ${CMAKE_CURRENT_SOURCE_DIR}/externals/zlib-${ZLIB_VER}.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 ()
endif ()
#########
## argagg
#########
if (HAS_ARGAGG)
ExternalProject_Add (argagg_Project
URL ${CMAKE_CURRENT_SOURCE_DIR}/externals/argagg-${ARGAGG_VER}.tar.gz
PREFIX ${CMAKE_BINARY_DIR}
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_BINARY_DIR}
-DARGAGG_BUILD_EXAMPLES=off
-DARGAGG_BUILD_TESTS=off
-DARGAGG_BUILD_DOCS=off
)
set (planetblupi_DEPS ${planetblupi_DEPS} argagg_Project)
endif ()
##########
## libcurl
##########
if (HAS_CURL)
set (libcurl_DEPENDS)
if (HAS_ZLIB)
set (libcurl_DEPENDS ${libcurl_DEPENDS} zlib_Project)
endif ()
ExternalProject_Add (libcurl_Project
URL ${CMAKE_CURRENT_SOURCE_DIR}/externals/curl-${CURL_VER}.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-brotli
--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 ${libcurl_DEPENDS}
)
set (planetblupi_DEPS ${planetblupi_DEPS} libcurl_Project)
endif ()
###########
## libiconv
###########
if (HAS_ICONV)
ExternalProject_Add (libiconv_Project
URL ${CMAKE_CURRENT_SOURCE_DIR}/externals/libiconv-${ICONV_VER}.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
##########
if (HAS_GETTEXT)
set (gettext_DEPENDS)
if (HAS_ICONV)
set (gettext_DEPENDS ${gettext_DEPENDS} libiconv_Project)
endif ()
ExternalProject_Add (gettext_Project
URL ${CMAKE_CURRENT_SOURCE_DIR}/externals/gettext-${GETTEXT_VER}.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}
)
set (planetblupi_DEPS ${planetblupi_DEPS} gettext_Project)
endif ()
#########
## libpng
#########
if (HAS_PNG)
ExternalProject_Add (libpng_Project
URL ${CMAKE_CURRENT_SOURCE_DIR}/externals/libpng-${PNG_VER}.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
)
set (planetblupi_DEPS ${planetblupi_DEPS} libpng_Project)
endif ()
#########
## FFmpeg
#########
if (HAS_FFMPEG)
set (FFMPEG_CONFIGURE)
if (BUILD_JS)
set (FFMPEG_CONFIGURE
--cc=emcc
--enable-cross-compile
--target-os=none
--arch=x86_64
--disable-asm
--disable-pthreads
)
endif ()
ExternalProject_Add (FFmpeg_Project
URL ${CMAKE_CURRENT_SOURCE_DIR}/externals/ffmpeg-${FFMPEG_VER}.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-x86asm
--disable-avdevice
--disable-avfilter
--disable-network
--disable-everything
--enable-decoder=cinepak,msvideo1,vorbis
--enable-demuxer=matroska
--enable-protocol=file
--disable-crystalhd
--disable-vaapi
--disable-videotoolbox
--disable-vdpau
--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
--disable-sndio
${FFMPEG_CONFIGURE}
BUILD_COMMAND ${CMD} make
INSTALL_COMMAND ${CMD} make install
BUILD_IN_SOURCE 1
INSTALL_DIR ${CMAKE_BINARY_DIR}
)
endif ()
############
## libasound
############
if (HAS_ALSA)
ExternalProject_Add (libasound_Project
URL ${CMAKE_CURRENT_SOURCE_DIR}/externals/alsa-lib-${ALSA_VER}.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}
)
set (planetblupi_DEPS ${planetblupi_DEPS} libasound_Project)
endif ()
#########
## libogg
#########
if (HAS_OGG)
ExternalProject_Add (libogg_Project
URL ${CMAKE_CURRENT_SOURCE_DIR}/externals/libogg-${OGG_VER}.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 INSTALLDIR=${CMAKE_BINARY_DIR}
BUILD_IN_SOURCE 1
INSTALL_DIR ${CMAKE_BINARY_DIR}
)
endif ()
############
## libvorbis
############
if (HAS_VORBIS)
ExternalProject_Add (libvorbis_Project
URL ${CMAKE_CURRENT_SOURCE_DIR}/externals/libvorbis-${VORBIS_VER}.tar.xz
PATCH_COMMAND patch -p1 < ${CMAKE_CURRENT_SOURCE_DIR}/externals/patches/libvorbis-${VORBIS_VER}.patch
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 INSTALLDIR=${CMAKE_BINARY_DIR}
BUILD_IN_SOURCE 1
INSTALL_DIR ${CMAKE_BINARY_DIR}
DEPENDS libogg_Project
)
set (planetblupi_DEPS ${planetblupi_DEPS} libvorbis_Project)
endif ()
#############
## libsndfile
#############
if (HAS_SNDFILE)
ExternalProject_Add (libsndfile_Project
URL ${CMAKE_CURRENT_SOURCE_DIR}/externals/libsndfile-${SNDFILE_VER}.tar.gz
PREFIX ${CMAKE_BINARY_DIR}
CONFIGURE_COMMAND ${CMD} ./configure
--prefix=${CMAKE_BINARY_DIR}
--disable-shared
--enable-static
--enable-alsa
--disable-sqlite
--disable-octave
--disable-full-suite
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 libogg_Project libvorbis_Project
)
endif ()
###########
## libpulse
###########
if (HAS_PULSEAUDIO)
ExternalProject_Add (libpulse_Project
URL ${CMAKE_CURRENT_SOURCE_DIR}/externals/pulseaudio-${PULSEAUDIO_VER}.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 libsndfile_Project
)
set (planetblupi_DEPS ${planetblupi_DEPS} libpulse_Project)
endif ()
#######
## SDL2
#######
if (HAS_SDL)
if (BUILD_LINUX)
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
--disable-jack
--disable-jack-shared
)
elseif (BUILD_WINDOWS)
set (SDL2_CONFIGURE
--enable-directx
--enable-render-d3d
--enable-video-opengl
)
elseif (BUILD_DARWIN)
set (SDL2_CONFIGURE
--enable-video-opengl
--enable-video-cocoa
)
endif ()
set (SDL2_DEPENDS)
if (HAS_ZLIB)
set (SDL2_DEPENDS zlib_Project)
endif ()
if (HAS_ALSA)
set (SDL2_DEPENDS ${SDL2_DEPENDS} libasound_Project)
endif ()
if (HAS_PULSEAUDIO)
set (SDL2_DEPENDS ${SDL2_DEPENDS} libpulse_Project)
endif ()
ExternalProject_Add (SDL2_Project
URL ${CMAKE_CURRENT_SOURCE_DIR}/externals/SDL2-${SDL_VER}.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}
)
endif ()
#############
## SDL2_image
#############
if (HAS_SDLIMAGE)
ExternalProject_Add (SDL2_image_Project
URL ${CMAKE_CURRENT_SOURCE_DIR}/externals/SDL2_image-${SDLIMAGE_VER}.tar.gz
PREFIX ${CMAKE_BINARY_DIR}
CONFIGURE_COMMAND ${CMD} ./configure
--prefix=${CMAKE_BINARY_DIR}
--disable-shared
--enable-static
--disable-sdltest
--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
)
set (planetblupi_DEPS ${planetblupi_DEPS} SDL2_image_Project)
endif ()
#############
## SDL2_mixer
#############
if (HAS_SDLMIXER)
set (SDL2_mixer_DEPENDS)
if (HAS_SDL)
set (SDL2_mixer_DEPENDS ${SDL2_mixer_DEPENDS} SDL2_Project)
endif ()
if (HAS_OGG)
set (SDL2_mixer_DEPENDS ${SDL2_mixer_DEPENDS} libogg_Project)
endif ()
if (HAS_VORBIS)
set (SDL2_mixer_DEPENDS ${SDL2_mixer_DEPENDS} libvorbis_Project)
endif ()
if (HAS_ICONV)
set (SDL2_mixer_DEPENDS ${SDL2_mixer_DEPENDS} libiconv_Project)
endif ()
ExternalProject_Add (SDL2_mixer_Project
URL ${CMAKE_CURRENT_SOURCE_DIR}/externals/SDL2_mixer-${SDLMIXER_VER}.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
--enable-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}
)
set (planetblupi_DEPS ${planetblupi_DEPS} SDL2_mixer_Project)
endif ()
###########
## SDL2_ttf
###########
if (HAS_SDLTTF)
ExternalProject_Add (SDL2_ttf_Project
URL ${CMAKE_CURRENT_SOURCE_DIR}/externals/SDL2_ttf-${SDLTTF_VER}.tar.gz
PATCH_COMMAND patch -p1 < ${CMAKE_CURRENT_SOURCE_DIR}/externals/patches/SDL2_ttf-${SDLTTF_VER}.patch
PREFIX ${CMAKE_BINARY_DIR}
CMAKE_COMMAND ${CMD} cmake
CMAKE_ARGS -DBUILD_SHARED_LIBS=OFF
-DSDL2TTF_SAMPLES=OFF
-DSDL2TTF_FREETYPE=ON
-DSDL2TTF_HARFBUZZ=ON
-DSDL2TTF_VENDORED=ON
-DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
INSTALL_DIR ${CMAKE_BINARY_DIR}
BUILD_ALWAYS 1
DEPENDS SDL2_Project
)
set (planetblupi_DEPS ${planetblupi_DEPS} SDL2_ttf_Project)
endif ()
##################
## SDL_kitchensink
##################
if (HAS_KITCHENSINK)
set (SDL_kitchensink_DEPENDS FFmpeg_Project)
if (HAS_SDL)
set (SDL_kitchensink_DEPENDS ${SDL_kitchensink_DEPENDS} SDL2_Project)
endif ()
if (BUILD_DARWIN AND OLD_SDK)
set (KITCHENSINK_FLAGS "-mmacosx-version-min=${OSX_SDK_VERSION}")
set (KITCHENSINK_CMAKE "-DOSX_SDK_VERSION=${OSX_SDK_VERSION} -DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}")
set (CMAKE_C_FLAGS "${KITCHENSINK_FLAGS} ${CMAKE_C_FLAGS}")
endif ()
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 -DBUILD_SHARED=false
-DBUILD_STATIC=true
-DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
${KITCHENSINK_CMAKE}
INSTALL_DIR ${CMAKE_BINARY_DIR}
BUILD_ALWAYS 1
DEPENDS ${SDL_kitchensink_DEPENDS}
)
set (planetblupi_DEPS ${planetblupi_DEPS} SDL_kitchensink_Project)
endif ()
##############
## planetblupi
##############
if (BUILD_LINUX AND NOT DISABLE_APPIMAGE)
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_CURRENT_SOURCE_DIR}/externals/${APPIMAGE_APPRUN_BIN}")
set (APPIMAGE_TOOL_BIN "appimagetool-x86_64.AppImage")
set (APPIMAGE_TOOL_URL "https://github.com/AppImage/appimagetool/releases/download/continuous/${APPIMAGE_TOOL_BIN}")
set (APPIMAGE_TOOL_PROGRAM "${CMAKE_CURRENT_SOURCE_DIR}/externals/${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 ()
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>
-DPB_HTTP_VERSION_CHECK=${HAS_CURL}
-DSTATIC_BUILD=${STATIC_BUILD}
-DSIGN_APP=${SIGN_APP}
-DEMSCRIPTEN_FLAGS=${EMSCRIPTEN_FLAGS}
-DBUILD_JS=${BUILD_JS}
-DBUILD_LINUX=${BUILD_LINUX}
-DBUILD_DARWIN=${BUILD_DARWIN}
-DBUILD_WINDOWS=${BUILD_WINDOWS}
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 "TXZ")
set (CPACK_SOURCE_PACKAGE_FILE_NAME "planetblupi-dev")
set (CPACK_SOURCE_IGNORE_FILES "/build/;/Debug/;/Release/;/planetblupi-data/;/.git/;.git;.directory;~$;${CPACK_SOURCE_IGNORE_FILES}")
include (CPack)