forked from etlegacy/etlegacy-libs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
798 lines (700 loc) · 31.3 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
include(ExternalProject)
include(CheckIncludeFile)
set(LIBS_BINARYDIR_DIR ${PROJECT_BINARY_DIR}/libs)
set(LIBS_DOWNLOAD_DIR ${PROJECT_BINARY_DIR}/downloads)
# note/FIXME/clarify:
# when features are disabled this script is still
# adding the related targets? F.e. LUA_FEATURE is Off and BUNDLED_LUA On
# see usage of BUNDLED_LUA below (BUNDLED_OPENSSL, BUNDLED OPENAL ...)
#CMAKE_DEBUG_POSTFIX
# Force the BUNDLED_<name> to OFF if the FEATURE_<name> is OFF. No more unwanted stuff being built.
get_cmake_property(_variableNames VARIABLES)
list (SORT _variableNames)
foreach (_variableName ${_variableNames})
string(REGEX MATCH "^FEATURE_.*" _featureName "${_variableName}")
string(LENGTH "${_featureName}" _variableLen)
# message(STATUS "${_variableName}=${${_variableName}}")
if(${_variableLen})
if(NOT (${_variableName}))
string(FIND ${_variableName} "_" wsloc)
string(SUBSTRING ${_variableName} ${wsloc} -1 _featureName)
string(PREPEND _featureName "BUNDLED")
if((${_featureName}))
set(${_featureName} OFF)
endif()
endif()
endif()
endforeach()
if(WIN32)
# moved for now until linux BUNDLED_OPENSSL is done
if(BUNDLED_OPENSSL)
find_program(NASM_EXECUTABLE nasm)
if(NOT NASM_EXECUTABLE)
message(FATAL_ERROR "NASM not found")
endif()
# FIXME: there is no findPerl cmake script in project?! (at least for *NIX)
FIND_PACKAGE(perl REQUIRED)
if(NOT PERL_FOUND)
message(FATAL_ERROR "Perl not found")
endif()
if(WIN32)
if(64BITS)
set(openssl_plat VC-WIN64)
# set(curl_plat x64)
else()
set(openssl_plat VC-WIN32)
# set(curl_plat x86)
endif()
endif()
endif()
if(BUNDLED_OPENSSL AND (BUILD_CLIENT OR BUILD_SERVER))
set(OPENSSL_PREFIX "${CMAKE_BINARY_DIR}/openssl/build")
set(OPENSSL_CONFIGURE "${PERL_EXECUTABLE}" Configure "${openssl_plat}" "--prefix=${OPENSSL_PREFIX}" "--openssldir=${OPENSSL_PREFIX}" no-shared no-unit-test -static)
set(OPENSSL_BUILD nmake)
set(OPENSSL_INSTALL nmake install)
set(OPENSSL_BUNDLED_LIBRARY "${OPENSSL_PREFIX}/lib/libcrypto.lib" "${OPENSSL_PREFIX}/lib/libssl.lib")
ExternalProject_Add(bundled_openssl
# Use github archive instead of the one hosted on openssl.org because of CMake bug #13251
#URL_MD5 "76766e98997660138cdaf13a187bd234"
#GIT_REPOSITORY "https://github.com/openssl/openssl.git"
DOWNLOAD_DIR ${LIBS_DOWNLOAD_DIR}/openssl
URL https://github.com/openssl/openssl/archive/OpenSSL_1_1_1g.tar.gz
SOURCE_DIR "${CMAKE_BINARY_DIR}/openssl"
BUILD_IN_SOURCE 1
CONFIGURE_COMMAND ${OPENSSL_CONFIGURE}
BUILD_COMMAND ${OPENSSL_BUILD}
INSTALL_COMMAND ${OPENSSL_INSTALL}
BUILD_BYPRODUCTS ${OPENSSL_BUNDLED_LIBRARY}
)
set(OPENSSL_BUNDLED_INCLUDE_DIR "${OPENSSL_PREFIX}/include")
set_target_properties(bundled_openssl PROPERTIES FOLDER ${BUNDLED_TARGETS_FOLDER})
else()
add_custom_target(bundled_openssl)
set_target_properties(bundled_openssl PROPERTIES FOLDER ${BUNDLED_TARGETS_FOLDER})
endif()
#-----------------------------------------------------------------
# Build bundled cURL library
#-----------------------------------------------------------------
if(BUNDLED_CURL AND (BUILD_CLIENT OR BUILD_SERVER))
set(binary_dir "${LIBS_BINARYDIR_DIR}/curl")
if(VSTUDIO)
set(CURL_BUNDLED_LIBRARY optimized "${binary_dir}/lib/Release/libcurl${CMAKE_STATIC_LIBRARY_SUFFIX}" debug "${binary_dir}/lib/Debug/libcurl-d${CMAKE_STATIC_LIBRARY_SUFFIX}")
elseif(MINGW OR VS_BUILD)
set(CURL_BUNDLED_LIBRARY optimized "${binary_dir}/lib/libcurl${CMAKE_STATIC_LIBRARY_SUFFIX}" debug "${binary_dir}/lib/libcurl-d${CMAKE_STATIC_LIBRARY_SUFFIX}")
else(VSTUDIO)
set(CURL_BUNDLED_LIBRARY "${binary_dir}/libcurl${CMAKE_STATIC_LIBRARY_SUFFIX}")
endif(VSTUDIO)
# -DHTTP_ONLY=1
ExternalProject_Add(bundled_curl
DEPENDS bundled_openssl
SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/curl
BINARY_DIR ${binary_dir}
BUILD_BYPRODUCTS ${CURL_BUNDLED_LIBRARY}
CMAKE_ARGS -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}
-DCMAKE_CXX_FLAGS_DEBUG=${CMAKE_CXX_FLAGS_DEBUG} -DCMAKE_CXX_FLAGS_RELEASE=${CMAKE_CXX_FLAGS_RELEASE}
-DBUILD_CURL_EXE=0 -DBUILD_SHARED_LIBS=0 -DENABLE_ARES=0 -DENABLE_THREADED_RESOLVER=1 -DENABLE_DEBUG=0
-DENABLE_CURLDEBUG=0 -DBUILD_TESTING=0 -DENABLE_IPV6=1 -DENABLE_MANUAL=0 -DCMAKE_USE_LIBSSH2=0
-DUSE_NGHTTP2=0 -DCURL_WINDOWS_SSPI=0 -DCURL_ZLIB=1 -DCMAKE_USE_GSSAPI=0
-DCURL_DISABLE_LDAP=1 -DCURL_DISABLE_LDAPS=1 -DCURL_DISABLE_TELNET=1 -DCURL_DISABLE_DICT=1
-DCURL_DISABLE_FILE=1 -DCURL_DISABLE_TFTP=1 -DCURL_DISABLE_RTSP=1 -DCURL_DISABLE_POP3=1 -DCURL_DISABLE_IMAP=1
-DCURL_DISABLE_SMTP=1 -DCURL_DISABLE_GOPHER=1
-DOPENSSL_ROOT_DIR=${OPENSSL_PREFIX} -DCMAKE_USE_OPENSSL=${FEATURE_OPENSSL}
-DENABLE_UNIX_SOCKETS=1 -DCMAKE_INSTALL_PREFIX=${PROJECT_BINARY_DIR}/curl
INSTALL_COMMAND ""
)
set(CURL_BUNDLED_INCLUDE_DIR "${CMAKE_CURRENT_LIST_DIR}/curl/include")
set_target_properties(bundled_curl PROPERTIES FOLDER ${BUNDLED_TARGETS_FOLDER})
endif()
#-----------------------------------------------------------------
# Build bundled Lua library
#-----------------------------------------------------------------
if(BUNDLED_LUA AND BUILD_MOD)
set(LUA_LIB "${CMAKE_CURRENT_LIST_DIR}/lua/src")
FILE(GLOB LUA_LIB_SRC
${LUA_LIB}/*.c
)
FILE(GLOB LUA_LIB_HEADERS
${LUA_LIB}/*.h
)
add_library(bundled_lua STATIC ${LUA_LIB_SRC} ${LUA_LIB_HEADERS})
set_target_properties(bundled_lua PROPERTIES FOLDER ${BUNDLED_TARGETS_FOLDER})
set(LUA_BUNDLED_LIBRARIES bundled_lua)
set(LUA_BUNDLED_INCLUDE_DIR "${CMAKE_CURRENT_LIST_DIR}/lua/src")
endif()
#-----------------------------------------------------------------
# Build bundled OGG and Vorbis file library
#-----------------------------------------------------------------
if(BUNDLED_OGG_VORBIS AND BUILD_CLIENT)
# OGG
SET(OPATH "${CMAKE_CURRENT_LIST_DIR}/ogg")
SET(OGG_SRC ${OPATH}/src/bitwise.c ${OPATH}/src/framing.c)
SET(OGG_HEADERS ${OPATH}/include/ogg/ogg.h ${OPATH}/include/ogg/os_types.h)
INCLUDE_DIRECTORIES("${OPATH}/include")
IF(MSVC)
#ADD_DEFINITIONS(/D_UNICODE /DUNICODE)
LIST(APPEND OGG_SRC ${OPATH}/win32/ogg.def)
ENDIF(MSVC)
IF("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
# libogg expects configure to be called on linux to
# generate config_types.h
LIST(APPEND OGG_HEADERS ${OPATH}/include/ogg/config_types.h)
add_custom_command(OUTPUT ${OPATH}/include/ogg/config_types.h
COMMAND ${OPATH}/configure
DEPENDS ${OPATH}/include/ogg/ogg.h # Hopefully if the libogg version changes, so does this file
# so configure_types.h will be regenerated.
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
ENDIF()
add_library(bundled_ogg STATIC ${OGG_SRC} ${OGG_HEADERS})
SET(VPATH "${CMAKE_CURRENT_LIST_DIR}/vorbis")
SET(VORBIS_SRC
${VPATH}/lib/analysis.c
${VPATH}/lib/bitrate.c
${VPATH}/lib/block.c
${VPATH}/lib/codebook.c
${VPATH}/lib/envelope.c
${VPATH}/lib/floor0.c
${VPATH}/lib/floor1.c
${VPATH}/lib/info.c
${VPATH}/lib/lookup.c
${VPATH}/lib/lpc.c
${VPATH}/lib/lsp.c
${VPATH}/lib/mapping0.c
${VPATH}/lib/mdct.c
${VPATH}/lib/psy.c
${VPATH}/lib/registry.c
${VPATH}/lib/res0.c
${VPATH}/lib/sharedbook.c
${VPATH}/lib/smallft.c
${VPATH}/lib/synthesis.c
${VPATH}/lib/vorbisenc.c
${VPATH}/lib/window.c
)
SET(VORBIS_HEADERS
${VPATH}/lib/backends.h
${VPATH}/lib/bitrate.h
${VPATH}/lib/codebook.h
${VPATH}/lib/codec_internal.h
${VPATH}/lib/envelope.h
${VPATH}/lib/modes/floor_all.h
${VPATH}/lib/books/floor/floor_books.h
${VPATH}/lib/highlevel.h
${VPATH}/lib/lookup.h
${VPATH}/lib/lookup_data.h
${VPATH}/lib/lpc.h
${VPATH}/lib/lsp.h
${VPATH}/lib/masking.h
${VPATH}/lib/mdct.h
${VPATH}/lib/misc.h
${VPATH}/lib/os.h
${VPATH}/lib/psy.h
${VPATH}/lib/modes/psych_11.h
${VPATH}/lib/modes/psych_16.h
${VPATH}/lib/modes/psych_44.h
${VPATH}/lib/modes/psych_8.h
${VPATH}/lib/registry.h
${VPATH}/lib/books/coupled/res_books_stereo.h
${VPATH}/lib/books/uncoupled/res_books_uncoupled.h
${VPATH}/lib/modes/residue_16.h
${VPATH}/lib/modes/residue_44.h
${VPATH}/lib/modes/residue_44u.h
${VPATH}/lib/modes/residue_8.h
${VPATH}/lib/scales.h
${VPATH}/lib/modes/setup_11.h
${VPATH}/lib/modes/setup_16.h
${VPATH}/lib/modes/setup_22.h
${VPATH}/lib/modes/setup_32.h
${VPATH}/lib/modes/setup_44.h
${VPATH}/lib/modes/setup_44u.h
${VPATH}/lib/modes/setup_8.h
${VPATH}/lib/modes/setup_X.h
${VPATH}/lib/smallft.h
${VPATH}/lib/window.h
)
SET(VORBIS_PUB_HEADERS
${VPATH}/include/vorbis/codec.h
${VPATH}/include/vorbis/vorbisenc.h
${VPATH}/include/vorbis/vorbisfile.h
)
INCLUDE_DIRECTORIES("${VPATH}/include" "${VPATH}/lib")
IF(MSVC)
#ADD_DEFINITIONS(/D_UNICODE /DUNICODE)
LIST(APPEND VORBIS_SRC ${VPATH}/win32/vorbis.def)
ENDIF(MSVC)
add_library(bundled_ogg_vorbis STATIC ${VORBIS_SRC} ${VORBIS_HEADERS} ${VORBIS_PUB_HEADERS})
target_link_libraries(bundled_ogg_vorbis bundled_ogg)
add_library(bundled_ogg_vorbis_file STATIC ${VPATH}/lib/vorbisfile.c ${VPATH}/include/vorbis/vorbisfile.h)
target_link_libraries(bundled_ogg_vorbis_file bundled_ogg bundled_ogg_vorbis)
if(MSVC)
set(VORB_UNI "_UNICODE;UNICODE")
set_target_properties(bundled_ogg PROPERTIES
COMPILE_DEFINITIONS "${VORB_UNI}"
)
set_target_properties(bundled_ogg_vorbis PROPERTIES
COMPILE_DEFINITIONS "${VORB_UNI}"
)
set_target_properties(bundled_ogg_vorbis_file PROPERTIES
COMPILE_DEFINITIONS "${VORB_UNI}"
)
endif(MSVC)
set_target_properties(bundled_ogg PROPERTIES FOLDER ${BUNDLED_TARGETS_FOLDER})
set_target_properties(bundled_ogg_vorbis PROPERTIES FOLDER ${BUNDLED_TARGETS_FOLDER})
set_target_properties(bundled_ogg_vorbis_file PROPERTIES FOLDER ${BUNDLED_TARGETS_FOLDER})
set(OGG_BUNDLED_LIBRARIES bundled_ogg)
set(OGG_BUNDLED_INCLUDE_DIR "${CMAKE_CURRENT_LIST_DIR}/ogg/include")
set(OGG_VORBIS_BUNDLED_LIBRARIES bundled_ogg_vorbis bundled_ogg_vorbis_file)
set(OGG_VORBIS_BUNDLED_INCLUDE_DIR "${CMAKE_CURRENT_LIST_DIR}/vorbis/include")
endif()
#-----------------------------------------------------------------
# Build bundled OpenAL library
#-----------------------------------------------------------------
if(BUNDLED_OPENAL AND BUILD_CLIENT)
set(binary_dir "${LIBS_BINARYDIR_DIR}/openal")
if(VSTUDIO)
set(OPENAL_BUNDLED_LIBRARIES optimized "${binary_dir}/Release/OpenAL32${CMAKE_STATIC_LIBRARY_SUFFIX}" debug "${binary_dir}/Debug/OpenAL32${CMAKE_STATIC_LIBRARY_SUFFIX}")
elseif(VS_BUILD)
set(OPENAL_BUNDLED_LIBRARIES "${binary_dir}/OpenAL32${CMAKE_STATIC_LIBRARY_SUFFIX}")
else()
set(OPENAL_BUNDLED_LIBRARIES "${binary_dir}/libOpenAL32${CMAKE_STATIC_LIBRARY_SUFFIX}")
endif()
ExternalProject_Add(bundled_openal
SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/openal
BINARY_DIR ${binary_dir}
BUILD_BYPRODUCTS ${OPENAL_BUNDLED_LIBRARIES}
CMAKE_ARGS -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}
-DCMAKE_CXX_FLAGS_DEBUG=${CMAKE_CXX_FLAGS_DEBUG} -DCMAKE_CXX_FLAGS_RELEASE=${CMAKE_CXX_FLAGS_RELEASE}
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS} -DCMAKE_INSTALL_PREFIX=${PROJECT_BINARY_DIR}/openal
-DLIBTYPE=STATIC -DFORCE_STATIC_VCRT=1
-DALSOFT_UTILS=0 -DALSOFT_NO_CONFIG_UTIL=1 -DALSOFT_EXAMPLES=0 -DALSOFT_TESTS=0
-DALSOFT_CONFIG=0 -DALSOFT_HRTF_DEFS=0 -DALSOFT_AMBDEC_PRESETS=0
INSTALL_COMMAND ""
)
#ExternalProject_Get_Property(bundled_openal binary_dir)
set(OPENAL_BUNDLED_INCLUDE_DIR "${CMAKE_CURRENT_LIST_DIR}/openal/include")
set_target_properties(bundled_openal PROPERTIES FOLDER ${BUNDLED_TARGETS_FOLDER})
endif()
elseif(UNIX)
if(CROSS_COMPILE32)
if(APPLE)
set(CROSS_COMPILE32_FLAGS CFLAGS=-mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}\ -O3\ -m32 LDFLAGS=-mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}\ -m32)
else()
set(CROSS_COMPILE32_FLAGS CFLAGS=-m32 LDFLAGS=-m32)
endif()
else(CROSS_COMPILE32)
# when we don't cross compile we have to enable position independant code '-fPIC' for all bundled libs
# see http://stackoverflow.com/questions/7216244/why-is-fpic-absolutely-necessary-on-64-and-not-on-32bit-platforms
# let's misuse CROSS_COMPILE32_FLAGS var (for 64bit) to set our flag. FIXME: rename to CROSS_COMPILE_OPTIONAL_FLAGS?
# notes: - cflag -mcmodel=large might be an option too
# - this has to be done in all dependant CMakeLists-txt files see glew/CMakeLists.txt
if(APPLE)
set(CROSS_COMPILE32_FLAGS CFLAGS=-mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}\ -O3\ -fPIC LDFLAGS=-mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET})
else()
set(CROSS_COMPILE32_FLAGS "CFLAGS=-fPIC")
endif()
endif(CROSS_COMPILE32)
if (BUNDLED_OPENSSL AND (BUILD_CLIENT OR BUILD_SERVER))
# FIXME: check flags
if(CROSS_COMPILE32)
if(APPLE)
SET(OPENSSL_BUILD ./Configure darwin-i386-cc ${CROSS_COMPILE32_FLAGS})
else()
SET(OPENSSL_BUILD ./Configure linux-x86 ${CROSS_COMPILE32_FLAGS})
endif()
else(CROSS_COMPILE32)
if(APPLE)
SET(OPENSSL_BUILD ./Configure darwin64-x86_64-cc ${CROSS_COMPILE32_FLAGS})
else()
#SET(OPENSSL_BUILD ./Configure linux-x86_64 ${CROSS_COMPILE32_FLAGS})
# better use ./config here?! (..and not the CROSS_COMPILE32_FLAGS?!)
SET(OPENSSL_BUILD ./Configure ${CROSS_COMPILE32_FLAGS})
endif()
endif()
# FIXME:
# check all the locations of the files (runtime files?!)
# and enable ssl in CURL
ExternalProject_Add(
bundled_openssl
SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/openssl
CONFIGURE_COMMAND ${OPENSSL_BUILD} --prefix=${CMAKE_CURRENT_BINARY_DIR}/libs/openssl
--openssldir=${CMAKE_CURRENT_BINARY_DIR}/libs/openssl
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/libs/openssl
BUILD_COMMAND make
INSTALL_COMMAND make install
BUILD_IN_SOURCE 1
)
# also generates libcrypto.a
set(OPENSSL_BUNDLED_LIBRARIES "${CMAKE_CURRENT_BINARY_DIR}/libs/openssl/lib/libssl.a")
set(OPENSSL_BUNDLED_INCLUDE_DIR "${CMAKE_CURRENT_BINARY_DIR}/libs/openssl/include")
endif()
#-----------------------------------------------------------------
# Build bundled cURL library
#-----------------------------------------------------------------
if(BUNDLED_CURL AND (BUILD_CLIENT OR BUILD_SERVER))
# FIXME: add openssl lib to project
# set --with-ssl / remove --without-ssl
ExternalProject_Add(
bundled_curl
SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/curl
CONFIGURE_COMMAND ./configure --prefix=${CMAKE_CURRENT_BINARY_DIR}/libs/curl
--enable-shared=no --enable-static=yes
--enable-http --enable-ftp --disable-file
--disable-ldap --disable-ldaps --disable-rtsp
--enable-proxy --disable-dict --disable-telnet
--disable-tftp --disable-pop3 --disable-imap
--disable-smb --disable-smtp --disable-gopher
--without-libssh2 --without-nghttp2
--without-gssapi --with-zlib --without-brotli
--disable-ares --enable-threaded-resolver
--enable-ipv6 --enable-unix-sockets
--without-libidn2 --disable-manual
--disable-sspi --enable-libgcc
--without-libmetalink --without-libpsl
--without-librtmp ${CROSS_COMPILE32_FLAGS}
--without-ssl
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/libs/curl
BUILD_COMMAND make
INSTALL_COMMAND make install
BUILD_IN_SOURCE 1
)
set(CURL_BUNDLED_LIBRARY "${CMAKE_CURRENT_BINARY_DIR}/libs/curl/lib/libcurl.a")
set(CURL_BUNDLED_INCLUDE_DIR "${CMAKE_CURRENT_BINARY_DIR}/libs/curl/include")
endif()
#-----------------------------------------------------------------
# Build bundled Lua library
#-----------------------------------------------------------------
# NOTE: the posix32bit target was added into the Lua Makefiles
if(BUNDLED_LUA AND BUILD_MOD)
if(CMAKE_SYSTEM MATCHES "OpenBSD*")
set(LUA_MAKE_TARGET "bsd")
elseif(CMAKE_SYSTEM MATCHES "Darwin")
set(LUA_MAKE_TARGET "macosx")
else()
if(NOT CROSS_COMPILE32)
set(LUA_MAKE_TARGET "posix")
else()
set(LUA_MAKE_TARGET "posix32bit")
endif()
endif()
# MacOS X requires a different flag order to succeed,
# but io.popen support requires the initial order
if(NOT CMAKE_SYSTEM MATCHES "Darwin")
add_custom_command(OUTPUT ${CMAKE_CURRENT_LIST_DIR}/lua/src/liblua.a
COMMAND make clean || true
COMMAND ${CROSS_COMPILE32_FLAGS} make ${LUA_MAKE_TARGET}
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/lua/src
)
else()
if(CROSS_COMPILE32)
set(LUA_BUILD CFLAGS=-mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}\ -O3\ -m32\ -DLUA_USE_MACOSX LDFLAGS=-mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}\ -m32)
else()
set(LUA_BUILD CFLAGS=-mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}\ -O3\ -DLUA_USE_MACOSX LDFLAGS=-mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET})
endif()
add_custom_command(OUTPUT ${CMAKE_CURRENT_LIST_DIR}/lua/src/liblua.a
COMMAND make clean || true
COMMAND make ${LUA_MAKE_TARGET} ${LUA_BUILD}
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/lua/src
)
endif()
set(LUA_BUNDLED_LIBRARIES "${CMAKE_CURRENT_LIST_DIR}/lua/src/liblua.a")
set(LUA_BUNDLED_INCLUDE_DIR "${CMAKE_CURRENT_LIST_DIR}/lua/src")
add_custom_target(bundled_lua
DEPENDS ${CMAKE_CURRENT_LIST_DIR}/lua/src/liblua.a
)
endif()
#-----------------------------------------------------------------
# Build bundled OGG and Vorbis file library
#-----------------------------------------------------------------
if(BUNDLED_OGG_VORBIS AND BUILD_CLIENT)
ExternalProject_Add(
bundled_ogg
SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/ogg
PATCH_COMMAND autoreconf -fiv
CONFIGURE_COMMAND ./configure --prefix=${CMAKE_CURRENT_BINARY_DIR}/libs/ogg ${CROSS_COMPILE32_FLAGS}
--enable-silent-rules --disable-dependency-tracking --enable-shared=no
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/libs/ogg
BUILD_COMMAND make
INSTALL_COMMAND make install
BUILD_IN_SOURCE 1
)
set(OGG_BUNDLED_LIBRARIES "${CMAKE_CURRENT_BINARY_DIR}/libs/ogg/lib/libogg.a")
set(OGG_BUNDLED_INCLUDE_DIR "${CMAKE_CURRENT_BINARY_DIR}/libs/ogg/include")
# OGG Vorbis File
set(CFLAGS "${CFLAGS} -I${CMAKE_CURRENT_BINARY_DIR}/libs/ogg/include")
set(LDFLAGS "${LDFLAGS} -L${CMAKE_CURRENT_BINARY_DIR}/libs/ogg/lib")
# the above set of CFLAGS and LDFLAGS don't trigger on some systems
# ensure vorbis configure uses our bundled ogg see --with-ogg-includes & --with-ogg-libraries
ExternalProject_Add(
bundled_ogg_vorbis
DEPENDS bundled_ogg
SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/vorbis
#PATCH_COMMAND ./autogen.sh
CONFIGURE_COMMAND ./configure --prefix=${CMAKE_CURRENT_BINARY_DIR}/libs/vorbis
--disable-oggtest --with-ogg-includes=${CMAKE_CURRENT_BINARY_DIR}/libs/ogg/include
--with-ogg-libraries=${CMAKE_CURRENT_BINARY_DIR}/libs/ogg/lib ${CROSS_COMPILE32_FLAGS}
--disable-dependency-tracking --enable-silent-rules --enable-shared=no
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/libs/vorbis
BUILD_COMMAND make
INSTALL_COMMAND make install
BUILD_IN_SOURCE 1
)
add_custom_target(bundled_ogg_vorbis_file)
set(OGG_VORBIS_BUNDLED_LIBRARIES "${CMAKE_CURRENT_BINARY_DIR}/libs/vorbis/lib/libvorbisfile.a" "${CMAKE_CURRENT_BINARY_DIR}/libs/vorbis/lib/libvorbis.a")
set(OGG_VORBIS_BUNDLED_INCLUDE_DIR "${CMAKE_CURRENT_BINARY_DIR}/libs/vorbis/include")
endif()
#-----------------------------------------------------------------
# Build bundled OpenAL library
#-----------------------------------------------------------------
if(BUNDLED_OPENAL AND BUILD_CLIENT)
ExternalProject_Add(bundled_openal
SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/openal
BINARY_DIR ${LIBS_BINARYDIR_DIR}/openal
CMAKE_ARGS -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}
-DCMAKE_CXX_FLAGS_DEBUG=${CMAKE_CXX_FLAGS_DEBUG} -DCMAKE_CXX_FLAGS_RELEASE=${CMAKE_CXX_FLAGS_RELEASE}
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS} -DCMAKE_INSTALL_PREFIX=${PROJECT_BINARY_DIR}/openal
-DCMAKE_OSX_DEPLOYMENT_TARGET="${CMAKE_OSX_DEPLOYMENT_TARGET}" -DLIBTYPE=STATIC
-DALSOFT_UTILS=0 -DALSOFT_NO_CONFIG_UTIL=1 -DALSOFT_EXAMPLES=0 -DALSOFT_TESTS=0
-DALSOFT_CONFIG=0 -DALSOFT_HRTF_DEFS=0 -DALSOFT_AMBDEC_PRESETS=0 -DALSOFT_BACKEND_SNDIO=OFF
INSTALL_COMMAND ""
)
ExternalProject_Get_Property(bundled_openal binary_dir)
set(OPENAL_BUNDLED_LIBRARIES "${binary_dir}/libopenal${CMAKE_STATIC_LIBRARY_SUFFIX}")
set(OPENAL_BUNDLED_INCLUDE_DIR "${CMAKE_CURRENT_LIST_DIR}/openal/include")
elseif(BUNDLED_OPENAL_INCLUDE AND BUILD_CLIENT)
include_directories(SYSTEM "${CMAKE_CURRENT_LIST_DIR}/openal/include")
endif()
endif()
#-----------------------------------------------------------------
# Copy bundled SDL library to the etl.exe location
#-----------------------------------------------------------------
if(BUNDLED_SDL AND BUILD_CLIENT)
# GL render builds (not GLES) for RPI require VIDEO_OPENGLES=1
if(ARM AND NOT FEATURE_RENDERER_GLES)
set(SDL_WITH_GLES "ON")
else()
set(SDL_WITH_GLES "${FEATURE_RENDERER_GLES}")
endif()
if(CMAKE_SYSTEM MATCHES "Darwin" OR WIN32)
set(SDL32_BUNDLED_LIBRARIES optimized "${LIBS_BINARYDIR_DIR}/sdl2/lib/${CMAKE_STATIC_LIBRARY_PREFIX}SDL2main${CMAKE_STATIC_LIBRARY_SUFFIX}" debug "${LIBS_BINARYDIR_DIR}/sdl2/lib/${CMAKE_STATIC_LIBRARY_PREFIX}SDL2maind${CMAKE_STATIC_LIBRARY_SUFFIX}")
endif()
set(SDL32_BUNDLED_LIBRARIES ${SDL32_BUNDLED_LIBRARIES} optimized "${LIBS_BINARYDIR_DIR}/sdl2/lib/${CMAKE_STATIC_LIBRARY_PREFIX}SDL2${CMAKE_STATIC_LIBRARY_SUFFIX}" debug "${LIBS_BINARYDIR_DIR}/sdl2/lib/${CMAKE_STATIC_LIBRARY_PREFIX}SDL2d${CMAKE_STATIC_LIBRARY_SUFFIX}")
ExternalProject_Add(bundled_sdl
SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/sdl2
# DOWNLOAD_DIR ${LIBS_DOWNLOAD_DIR}/sdl2
# URL https://www.libsdl.org/release/SDL2-2.0.12.tar.gz
BINARY_DIR ${LIBS_BINARYDIR_DIR}/sdl2
BUILD_BYPRODUCTS ${SDL32_BUNDLED_LIBRARIES}
CMAKE_ARGS -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS} -DCMAKE_CXX_FLAGS_DEBUG=${CMAKE_CXX_FLAGS_DEBUG}
-DCMAKE_CXX_FLAGS_RELEASE=${CMAKE_CXX_FLAGS_RELEASE} -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS} -DCMAKE_OSX_DEPLOYMENT_TARGET="${CMAKE_OSX_DEPLOYMENT_TARGET}"
-DRENDER_D3D=OFF -DRENDER_METAL=OFF -DSDL_RENDER=OFF
-DVIDEO_DUMMY=OFF -DVIDEO_OPENGL=ON -DVIDEO_OPENGLES=${SDL_WITH_GLES} -DVIDEO_VULKAN=OFF -DVIDEO_METAL=OFF
-DVIDEO_KMSDRM=OFF -DVIDEO_WAYLAND=OFF -DVIDEO_X11_XINPUT=OFF
-DSDL_SHARED=OFF -DFORCE_STATIC_VCRT=ON -DSNDIO=OFF
-DCMAKE_INSTALL_PREFIX=${LIBS_BINARYDIR_DIR}/sdl2
PREFIX ${LIBS_BINARYDIR_DIR}/sdl2
)
#ExternalProject_Get_Property(bundled_sdl binary_dir)
set(SDL32_BUNDLED_INCLUDE_DIR "${LIBS_BINARYDIR_DIR}/sdl2/include")
set_target_properties(bundled_sdl PROPERTIES FOLDER ${BUNDLED_TARGETS_FOLDER})
endif()
#-----------------------------------------------------------------
# Build bundled ZLib library
#-----------------------------------------------------------------
if(BUNDLED_ZLIB AND (BUILD_CLIENT OR BUILD_SERVER))
set(ZLIB_LIB "${CMAKE_CURRENT_LIST_DIR}/zlib")
FILE(GLOB ZLIB_LIB_HEADERS
${ZLIB_LIB}/crc32.h
${ZLIB_LIB}/deflate.h
${ZLIB_LIB}/gzguts.h
${ZLIB_LIB}/inffast.h
${ZLIB_LIB}/inffixed.h
${ZLIB_LIB}/inflate.h
${ZLIB_LIB}/inftrees.h
${ZLIB_LIB}/trees.h
${ZLIB_LIB}/zconf.h
${ZLIB_LIB}/zlib.h
${ZLIB_LIB}/zutil.h
)
FILE(GLOB ZLIB_LIB_SRC
${ZLIB_LIB}/adler32.c
${ZLIB_LIB}/compress.c
${ZLIB_LIB}/crc32.c
${ZLIB_LIB}/deflate.c
${ZLIB_LIB}/inffast.c
${ZLIB_LIB}/inflate.c
${ZLIB_LIB}/inftrees.c
${ZLIB_LIB}/trees.c
${ZLIB_LIB}/zutil.c
)
add_library(bundled_zlib STATIC ${ZLIB_LIB_SRC} ${ZLIB_LIB_HEADERS})
set(ZLIB_BUNDLED_LIBRARIES bundled_zlib)
set(ZLIB_BUNDLED_INCLUDE_DIR "${CMAKE_CURRENT_LIST_DIR}/zlib")
set_target_properties(bundled_zlib PROPERTIES FOLDER ${BUNDLED_TARGETS_FOLDER})
endif()
#-----------------------------------------------------------------
# Build bundled MiniZip library
#-----------------------------------------------------------------
if(BUNDLED_MINIZIP AND (BUILD_CLIENT OR BUILD_SERVER))
set(MINIZIP_LIB "${CMAKE_CURRENT_LIST_DIR}/minizip")
FILE(GLOB MINIZIP_LIB_HEADERS
${MINIZIP_LIB}/crypt.h
${MINIZIP_LIB}/ioapi.h
${MINIZIP_LIB}/unzip.h
)
FILE(GLOB MINIZIP_LIB_SRC
${MINIZIP_LIB}/ioapi.c
${MINIZIP_LIB}/unzip.c
)
add_library(bundled_minizip STATIC ${MINIZIP_LIB_SRC} ${MINIZIP_LIB_HEADERS})
if(BUNDLED_ZLIB)
target_link_libraries(bundled_minizip bundled_zlib)
endif(BUNDLED_ZLIB)
set(MINIZIP_BUNDLED_LIBRARIES bundled_minizip)
set(MINIZIP_BUNDLED_INCLUDE_DIR "${CMAKE_CURRENT_LIST_DIR}/minizip")
set_target_properties(bundled_minizip PROPERTIES FOLDER ${BUNDLED_TARGETS_FOLDER})
endif()
#-----------------------------------------------------------------
# Build bundled GLEW library
#-----------------------------------------------------------------
if(BUNDLED_GLEW AND BUILD_CLIENT)
include(${CMAKE_CURRENT_LIST_DIR}/glew/CMakeLists.txt)
set(BUNDLED_GLEW_LIBRARIES bundled_glew)
set(BUNDLED_GLEW_INCLUDE_DIR "${CMAKE_CURRENT_LIST_DIR}/glew/include")
set_target_properties(bundled_glew PROPERTIES FOLDER ${BUNDLED_TARGETS_FOLDER})
endif()
#-----------------------------------------------------------------
# Build bundled SQLITE3 library
#-----------------------------------------------------------------
if(BUNDLED_SQLITE3 AND (BUILD_CLIENT OR BUILD_SERVER OR BUILD_MOD))
include(${CMAKE_CURRENT_LIST_DIR}/sqlite3/CMakeLists.txt)
set(SQLITE3_BUNDLED_LIBRARIES bundled_sqlite3)
set(SQLITE3_BUNDLED_INCLUDE_DIR "${CMAKE_CURRENT_LIST_DIR}/sqlite3/src")
set_target_properties(bundled_sqlite3 PROPERTIES FOLDER ${BUNDLED_TARGETS_FOLDER})
endif()
#-----------------------------------------------------------------
# Build bundled JPEG library
#-----------------------------------------------------------------
if(BUNDLED_JPEG AND BUILD_CLIENT)
check_include_file(stddef.h HAVE_STDDEF_H)
check_include_file(stdlib.h HAVE_STDLIB_H)
set(binary_dir "${LIBS_BINARYDIR_DIR}/jpegturbo")
if(VSTUDIO)
set(JPEG_BUNDLED_LIBRARIES optimized "${binary_dir}/Release/turbojpeg-static${CMAKE_STATIC_LIBRARY_SUFFIX}" debug "${binary_dir}/Debug/turbojpeg-static${CMAKE_STATIC_LIBRARY_SUFFIX}")
elseif(VS_BUILD)
set(JPEG_BUNDLED_LIBRARIES "${binary_dir}/turbojpeg-static${CMAKE_STATIC_LIBRARY_SUFFIX}")
else()
set(JPEG_BUNDLED_LIBRARIES "${binary_dir}/libturbojpeg${CMAKE_STATIC_LIBRARY_SUFFIX}")
endif()
# Set SIZEOF_SIZE_T @SIZE_T@ for 64 or 32 bit
if(CMAKE_SIZEOF_VOID_P EQUAL 8 AND NOT CROSS_COMPILE32)
set(SIZEOF_SIZE_T 8)
else()
set(SIZEOF_SIZE_T 4)
endif()
set(JPEG_LIB "${CMAKE_CURRENT_LIST_DIR}/jpegturbo")
configure_file(${JPEG_LIB}/jconfig.h.cmake ${JPEG_LIB}/jconfig.h)
configure_file(${JPEG_LIB}/jconfigint.h.cmake ${JPEG_LIB}/jconfigint.h)
ExternalProject_Add(bundled_jpeg
SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/jpegturbo
BINARY_DIR ${LIBS_BINARYDIR_DIR}/jpegturbo
BUILD_BYPRODUCTS ${JPEG_BUNDLED_LIBRARIES}
CMAKE_ARGS -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}
-DCMAKE_CXX_FLAGS_DEBUG=${CMAKE_CXX_FLAGS_DEBUG} -DCMAKE_CXX_FLAGS_RELEASE=${CMAKE_CXX_FLAGS_RELEASE}
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS} -DENABLE_SHARED=OFF -DENABLE_STATIC=ON -DREQUIRE_SIMD=OFF -DWITH_12BIT=OFF
-DWITH_ARITH_DEC=ON -DWITH_ARITH_ENC=ON -DWITH_JAVA=OFF -DWITH_JPEG7=OFF -DWITH_JPEG8=ON
-DWITH_MEM_SRCDST=ON -DWITH_SIMD=OFF -DWITH_TURBOJPEG=ON
-DCMAKE_OSX_DEPLOYMENT_TARGET="${CMAKE_OSX_DEPLOYMENT_TARGET}"
INSTALL_COMMAND ""
)
#ExternalProject_Get_Property(bundled_jpeg binary_dir)
set(JPEG_BUNDLED_INCLUDE_DIR "${CMAKE_CURRENT_LIST_DIR}/jpegturbo")
set_target_properties(bundled_jpeg PROPERTIES FOLDER ${BUNDLED_TARGETS_FOLDER})
endif()
#-----------------------------------------------------------------
# Build bundled PNG library
#-----------------------------------------------------------------
if(BUNDLED_PNG AND BUILD_CLIENT)
set(binary_dir "${LIBS_BINARYDIR_DIR}/libpng")
if(VSTUDIO)
set(PNG_BUNDLED_LIBRARIES optimized "${binary_dir}/Release/libpng${CMAKE_STATIC_LIBRARY_SUFFIX}" debug "${binary_dir}/Debug/libpng${CMAKE_STATIC_LIBRARY_SUFFIX}")
elseif(VS_BUILD)
set(PNG_BUNDLED_LIBRARIES "${binary_dir}/libpng${CMAKE_STATIC_LIBRARY_SUFFIX}")
else()
set(PNG_BUNDLED_LIBRARIES "${binary_dir}/libpng${CMAKE_STATIC_LIBRARY_SUFFIX}")
endif()
if(BUNDLED_ZLIB)
set(ZLIB_INCLUDE_DIR "${CMAKE_CURRENT_LIST_DIR}/zlib")
endif()
ExternalProject_Add(bundled_png
SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/libpng
BINARY_DIR ${LIBS_BINARYDIR_DIR}/libpng
BUILD_BYPRODUCTS ${PNG_BUNDLED_LIBRARIES}
CMAKE_ARGS -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}
-DCMAKE_CXX_FLAGS_DEBUG=${CMAKE_CXX_FLAGS_DEBUG} -DCMAKE_CXX_FLAGS_RELEASE=${CMAKE_CXX_FLAGS_RELEASE}
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS} -DPNG_SHARED=OFF -DPNG_STATIC=ON -DPNG_BUILD_ZLIB=ON -DZLIB_INCLUDE_DIR=${ZLIB_INCLUDE_DIR}
-DPNG_TESTS=OFF -DPNG_FRAMEWORK=OFF -DPNG_DEBUG=OFF -DPNG_HARDWARE_OPTIMIZATIONS=ON
INSTALL_COMMAND ""
)
#ExternalProject_Get_Property(bundled_png binary_dir)
set(PNG_BUNDLED_INCLUDE_DIR "${CMAKE_CURRENT_LIST_DIR}/libpng/include")
set_target_properties(bundled_png PROPERTIES FOLDER ${BUNDLED_TARGETS_FOLDER})
endif()
#-----------------------------------------------------------------
# Build bundled Freetype library
#-----------------------------------------------------------------
if(BUNDLED_FREETYPE AND BUILD_CLIENT)
set(binary_dir "${LIBS_BINARYDIR_DIR}/freetype")
if(VSTUDIO)
set(BUNDLED_FREETYPE_LIBRARIES optimized "${binary_dir}/Release/freetype${CMAKE_STATIC_LIBRARY_SUFFIX}" debug "${binary_dir}/Debug/freetype${CMAKE_STATIC_LIBRARY_SUFFIX}")
elseif(VS_BUILD)
set(BUNDLED_FREETYPE_LIBRARIES "${binary_dir}/freetype${CMAKE_STATIC_LIBRARY_SUFFIX}")
else()
set(BUNDLED_FREETYPE_LIBRARIES "${binary_dir}/libfreetype${CMAKE_SHARED_LIBRARY_SUFFIX}")
endif()
ExternalProject_Add(bundled_freetype
SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/freetype
BINARY_DIR ${binary_dir}
BUILD_BYPRODUCTS ${BUNDLED_FREETYPE_LIBRARIES}
CMAKE_ARGS -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}
-DCMAKE_CXX_FLAGS_DEBUG=${CMAKE_CXX_FLAGS_DEBUG} -DCMAKE_CXX_FLAGS_RELEASE=${CMAKE_CXX_FLAGS_RELEASE}
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS} -DCMAKE_OSX_DEPLOYMENT_TARGET="${CMAKE_OSX_DEPLOYMENT_TARGET}"
-DCMAKE_DISABLE_FIND_PACKAGE_ZLIB=ON -DCMAKE_DISABLE_FIND_PACKAGE_BZip2=ON -DCMAKE_DISABLE_FIND_PACKAGE_PNG=ON
-DCMAKE_DISABLE_FIND_PACKAGE_HarfBuzz=ON -DCMAKE_DISABLE_FIND_PACKAGE_BrotliDec=ON
-DFT_WITH_ZLIB=OFF -DFT_WITH_BZIP2=OFF -DFT_WITH_PNG=OFF -DFT_WITH_HARFBUZZ=OFF -DFT_WITH_BROTLI=OFF -DDISABLE_FORCE_DEBUG_POSTFIX=ON
-DBUILD_SHARED_LIBS=TRUE
INSTALL_COMMAND ""
)
# ExternalProject_Get_Property(bundled_freetype binary_dir)
set(BUNDLED_FREETYPE_INCLUDE_DIR "${CMAKE_CURRENT_LIST_DIR}/freetype/include")
set_target_properties(bundled_freetype PROPERTIES FOLDER ${BUNDLED_TARGETS_FOLDER})
endif()
#-----------------------------------------------------------------
# Build bundled Theora library
#-----------------------------------------------------------------
if(BUNDLED_THEORA AND BUILD_CLIENT)
FILE(GLOB THEORA_SRC
"${CMAKE_CURRENT_LIST_DIR}/theora/lib/*.c"
"${CMAKE_CURRENT_LIST_DIR}/theora/lib/*.h"
)
# This makes the MSVC build a happier camper
LIST(REMOVE_ITEM THEORA_SRC ${CMAKE_CURRENT_LIST_DIR}/theora/lib/encoder_disabled.c)
if(32BITS)
add_definitions("-DOC_X86_ASM")
if(MSVC)
FILE(GLOB THEORA_ASM_SRC
"${CMAKE_CURRENT_LIST_DIR}/theora/lib/x86_vc/*.c"
"${CMAKE_CURRENT_LIST_DIR}/theora/lib/x86_vc/*.h"
)
else()
FILE(GLOB THEORA_ASM_SRC
"${CMAKE_CURRENT_LIST_DIR}/theora/lib/x86/*.c"
"${CMAKE_CURRENT_LIST_DIR}/theora/lib/x86/*.h"
)
endif()
LIST(APPEND THEORA_SRC ${THEORA_ASM_SRC})
endif()
include_directories("${CMAKE_CURRENT_LIST_DIR}/theora/include")
add_library(bundled_theora STATIC ${THEORA_SRC})
set(THEORA_BUNDLED_LIBRARIES bundled_theora)
set(THEORA_BUNDLED_INCLUDE_DIR "${CMAKE_CURRENT_LIST_DIR}/theora/include")
set_target_properties(bundled_theora PROPERTIES FOLDER ${BUNDLED_TARGETS_FOLDER})
endif()