-
Notifications
You must be signed in to change notification settings - Fork 27
/
CMakeLists.txt
1074 lines (929 loc) · 37.8 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
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# Many of this is based on the scripts in the Polycode project. Many thanks
# to the respective authors for going through the work of figuring this out!
cmake_minimum_required(VERSION 3.3)
# Set defaults. Must be before project().
if(APPLE)
set(CMAKE_OSX_ARCHITECTURES "x86_64;arm64" CACHE STRING "")
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.9" CACHE STRING "")
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++")
endif()
project(panda3d-thirdparty)
include(ExternalProject)
set(DEFAULT_ENABLE ON)
if(DISABLE_ALL)
set(DEFAULT_ENABLE OFF)
endif()
if(NOT ANDROID)
option(BUILD_ZLIB "Build zlib" ${DEFAULT_ENABLE})
endif()
option(BUILD_PNG "Build libpng (requires zlib)" ${DEFAULT_ENABLE})
option(BUILD_ASSIMP "Build assimp (requires zlib)" ${DEFAULT_ENABLE})
option(BUILD_BULLET "Build bullet" ${DEFAULT_ENABLE})
option(BUILD_HARFBUZZ "Build harfbuzz (requires freetype)" ${DEFAULT_ENABLE})
option(BUILD_FREETYPE "Build freetype (requires harfbuzz, zlib and png)" ${DEFAULT_ENABLE})
option(BUILD_VORBIS "Build vorbis" ${DEFAULT_ENABLE})
option(BUILD_OPUS "Build opus" ${DEFAULT_ENABLE})
option(BUILD_OPENAL "Build OpenAL" ${DEFAULT_ENABLE})
option(BUILD_JPEG "Build libjpeg" ${DEFAULT_ENABLE})
option(BUILD_SQUISH "Build libsquish" ${DEFAULT_ENABLE})
option(BUILD_FCOLLADA "Build FCollada" ${DEFAULT_ENABLE})
option(BUILD_VRPN "Build VRPN" ${DEFAULT_ENABLE})
option(BUILD_TIFF "Build TIFF (requires zlib and jpeg)" ${DEFAULT_ENABLE})
option(BUILD_EIGEN "Copy Eigen headers" ${DEFAULT_ENABLE})
option(BUILD_ODE "Build ODE physics engine" ${DEFAULT_ENABLE})
option(BUILD_ARTOOLKIT "Build ARToolKit" ${DEFAULT_ENABLE})
option(BUILD_NVIDIACG "Copy NVIDIA Cg Toolkit binaries" ${DEFAULT_ENABLE})
option(BUILD_OPENSSL "Build OpenSSL" ${DEFAULT_ENABLE})
option(BUILD_OPENEXR "Build OpenEXR" ${DEFAULT_ENABLE})
option(BUILD_FFMPEG "Build FFMpeg (requires vorbis, freetype and zlib)" ${DEFAULT_ENABLE})
option(BUILD_GLSLANG "Build glslang" ${DEFAULT_ENABLE})
option(BUILD_SPIRV_CROSS "Build spirv-cross" ${DEFAULT_ENABLE})
option(BUILD_SPIRV_TOOLS "Build spirv-tools" ${DEFAULT_ENABLE})
option(BUILD_OPENCV "Build OpenCV" OFF)
option(BUILD_MIMALLOC "Build mimalloc" ${DEFAULT_ENABLE})
option(BUILD_RECAST "Build Recast Navigation" ${DEFAULT_ENABLE})
function(add_lipo_target)
set(libs ${ARGV})
list(POP_FRONT libs target)
list(LENGTH CMAKE_OSX_ARCHITECTURES num_archs)
list(GET CMAKE_OSX_ARCHITECTURES 0 first_arch)
set(commands "")
foreach(lib ${libs})
if(num_archs EQUAL 1)
set(commands ${commands} COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_BINARY_DIR}/${target}-${first_arch}-prefix/lib/${lib}" "${THIRDPARTY_DIR}/${target}/lib/${lib}")
else()
set(commands ${commands} COMMAND lipo -create -output "${THIRDPARTY_DIR}/${target}/lib/${lib}")
foreach(arch ${CMAKE_OSX_ARCHITECTURES})
set(commands ${commands} -arch ${arch} "${CMAKE_CURRENT_BINARY_DIR}/${target}-${arch}-prefix/lib/${lib}")
endforeach()
endif()
endforeach()
add_custom_target(${target} ALL
COMMAND ${CMAKE_COMMAND} -E make_directory "${THIRDPARTY_DIR}/${target}/lib"
COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_CURRENT_BINARY_DIR}/${target}-${first_arch}-prefix/include" "${THIRDPARTY_DIR}/${target}/include"
${commands}
)
foreach(arch ${CMAKE_OSX_ARCHITECTURES})
add_dependencies(${target} ${target}-${arch})
endforeach()
endfunction()
if(CMAKE_GENERATOR MATCHES "^Visual Studio [0-9]+ ")
if(MSVC_TOOLSET_VERSION)
math(EXPR VCVER "${MSVC_TOOLSET_VERSION} / 10" OUTPUT_FORMAT DECIMAL)
elseif(NOT (MSVC_VERSION LESS 1900))
set(VCVER 14)
else()
string(REPLACE " " ";" WORDS ${CMAKE_GENERATOR})
list(GET WORDS 2 VCVER)
endif()
set(THIRDPARTY_DIR ${CMAKE_SOURCE_DIR}/win-libs-vc${VCVER})
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(THIRDPARTY_DIR "${THIRDPARTY_DIR}-x64")
endif()
elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
set(THIRDPARTY_DIR ${CMAKE_SOURCE_DIR}/darwin-libs-a)
elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64")
set(THIRDPARTY_DIR ${CMAKE_SOURCE_DIR}/linux-libs-arm64)
elseif(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(THIRDPARTY_DIR ${CMAKE_SOURCE_DIR}/linux-libs-x64)
else()
set(THIRDPARTY_DIR ${CMAKE_SOURCE_DIR}/linux-libs-a)
endif()
elseif(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64")
set(THIRDPARTY_DIR ${CMAKE_SOURCE_DIR}/freebsd-libs-arm64)
elseif(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(THIRDPARTY_DIR ${CMAKE_SOURCE_DIR}/freebsd-libs-x64)
else()
set(THIRDPARTY_DIR ${CMAKE_SOURCE_DIR}/freebsd-libs-a)
endif()
elseif(CMAKE_SYSTEM_NAME STREQUAL "Android")
set(THIRDPARTY_DIR ${CMAKE_SOURCE_DIR}/android-libs-${CMAKE_ANDROID_ARCH})
else()
message(FATAL_ERROR "Unknown platform.")
endif()
if(NOT MSVC)
set(CMAKE_C_FLAGS "-fpic -Wno-error=deprecated-declarations -DHB_NO_PRAGMA_GCC_DIAGNOSTIC_ERROR")
set(CMAKE_CXX_FLAGS "-fpic -Wno-error=deprecated-declarations -DHB_NO_PRAGMA_GCC_DIAGNOSTIC_ERROR")
endif()
message("thirdparty packages will be installed to ${THIRDPARTY_DIR}")
set(COMMON_CMAKE_ARGS
-DCMAKE_SYSTEM_VERSION=${CMAKE_SYSTEM_VERSION}
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
-DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}
-DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
-DCMAKE_LINKER=${CMAKE_LINKER}
-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}
-DCMAKE_INSTALL_LIBDIR=lib
-DCMAKE_ANDROID_ARCH=${CMAKE_ANDROID_ARCH}
-DCMAKE_ANDROID_ARCH_ABI=${CMAKE_ANDROID_ARCH_ABI}
#-DCMAKE_ANDROID_ARCH_TRIPLE=${CMAKE_ANDROID_ARCH_TRIPLE}
#-DCMAKE_ANDROID_ARCH_LLVM_TRIPLE=${CMAKE_ANDROID_ARCH_LLVM_TRIPLE}
-DANDROID_ABI=${CMAKE_ANDROID_ARCH_ABI}
-DANDROID_PLATFORM=${ANDROID_PLATFORM}
-DBUILD_SHARED_LIBS=OFF
-DSKIP_INSTALL_EXECUTABLES=ON
-DSKIP_INSTALL_FILES=ON
-Wno-dev
)
if(WIN32)
# Add tools like patch.exe and nasm.exe to the PATH
list(APPEND CMAKE_MSVCIDE_RUN_PATH "${CMAKE_CURRENT_LIST_DIR}/win-util")
endif()
if(APPLE)
# Prevent the semicolon from becoming a space in the command.
string(REPLACE ";" "$<SEMICOLON>" archs "${CMAKE_OSX_ARCHITECTURES}")
set(COMMON_CMAKE_ARGS ${COMMON_CMAKE_ARGS}
-DCMAKE_OSX_ARCHITECTURES=${archs}
-DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}
-DCMAKE_OSX_SYSROOT=${CMAKE_OSX_SYSROOT}
)
endif(APPLE)
if(BUILD_ZLIB)
ExternalProject_Add(
zlib
GIT_REPOSITORY https://github.com/madler/zlib.git
GIT_TAG cacf7f1d4e3d44d871b605da3b647f07d718623f #v1.2.11
#URL https://github.com/madler/zlib/archive/v1.2.11.tar.gz
#URL_HASH SHA256=629380c90a77b964d896ed37163f5c3a34f6e6d897311f1df2a7016355c45eff
CMAKE_ARGS ${COMMON_CMAKE_ARGS}
-DZLIB_TESTS=OFF
INSTALL_DIR ${THIRDPARTY_DIR}/zlib
)
# Remove the shared libraries, which cannot be disabled in the CMake file.
if(WIN32)
ExternalProject_Add_Step(zlib remove_extras
COMMAND ${CMAKE_COMMAND} -E remove_directory "<INSTALL_DIR>/bin"
COMMAND ${CMAKE_COMMAND} -E remove_directory "<INSTALL_DIR>/share"
COMMAND ${CMAKE_COMMAND} -E remove "<INSTALL_DIR>/lib/zlib.lib"
DEPENDEES install
)
set(ZLIB_LIBRARY ${THIRDPARTY_DIR}/zlib/lib/zlibstatic.lib)
elseif(APPLE)
ExternalProject_Add_Step(zlib remove_extras
COMMAND ${CMAKE_COMMAND} -E remove "<INSTALL_DIR>/lib/libz.dylib"
"<INSTALL_DIR>/lib/libz.1.dylib"
"<INSTALL_DIR>/lib/libz.1.2.11.dylib"
DEPENDEES install
)
set(ZLIB_LIBRARY ${THIRDPARTY_DIR}/zlib/lib/libz.a)
else()
ExternalProject_Add_Step(zlib remove_extras
COMMAND ${CMAKE_COMMAND} -E remove "<INSTALL_DIR>/lib/libz.so"
"<INSTALL_DIR>/lib/libz.so.1"
"<INSTALL_DIR>/lib/libz.so.1.2.11"
DEPENDEES install
)
set(ZLIB_LIBRARY ${THIRDPARTY_DIR}/zlib/lib/libz.a)
endif()
else()
# Assume zlib is present on the system.
add_custom_target(zlib)
find_library(ZLIB_LIBRARY z)
endif()
if(BUILD_PNG)
set(png_extra_flags)
if(APPLE)
set(png_extra_flags -DPNG_ARM_NEON=on)
endif()
ExternalProject_Add(
png
DEPENDS zlib
# Please note that libpng 1.6.32+ requires CMake 3.0.2
GIT_REPOSITORY https://github.com/glennrp/libpng.git
GIT_TAG 9fcb846402d8692d25cb5286777a832ca852fa44 #v1.6.31
#URL https://github.com/glennrp/libpng/archive/v1.6.31.tar.gz
#URL_HASH SHA256=79c0391804c83a6e0b722c20be7c3a27aeb2fe09afbc3028abad243444c98aa0
CMAKE_ARGS ${COMMON_CMAKE_ARGS}
-DCMAKE_PREFIX_PATH=${THIRDPARTY_DIR}/zlib
-DPNG_SHARED=OFF
-DPNG_STATIC=ON
-DPNG_TESTS=OFF
-DPNG_DEBUG=OFF
${png_extra_flags}
-DAWK= # Needed for multi-arch build on macOS
INSTALL_DIR ${THIRDPARTY_DIR}/png
)
ExternalProject_Add_Step(png remove_extras
COMMAND ${CMAKE_COMMAND} -E remove_directory "<INSTALL_DIR>/lib/libpng"
DEPENDEES install
)
elseif(BUILD_SQUISH)
add_custom_target(png)
endif()
if(BUILD_ASSIMP)
ExternalProject_Add(
assimp
DEPENDS zlib
GIT_REPOSITORY https://github.com/assimp/assimp.git
GIT_TAG 8134cae998ec0e3a44a6ec8330b681f3981107b7 #v5.1.6
PATCH_COMMAND patch -p1 < ${CMAKE_CURRENT_LIST_DIR}/patches/assimp-5.1.6-no-werror.patch
CMAKE_ARGS ${COMMON_CMAKE_ARGS}
-DCMAKE_PREFIX_PATH=${THIRDPARTY_DIR}/zlib
-DASSIMP_BUILD_TESTS=OFF
-DASSIMP_BUILD_ASSIMP_TOOLS=OFF
-DASSIMP_NO_EXPORT=ON
-DASSIMP_WARNINGS_AS_ERRORS=OFF
-DLIBRARY_SUFFIX=
-DZLIB_LIBRARY_DBG=${ZLIB_LIBRARY}
-DZLIB_LIBRARY_REL=${ZLIB_LIBRARY}
INSTALL_DIR ${THIRDPARTY_DIR}/assimp
)
ExternalProject_Add_Step(assimp remove_extras
COMMAND ${CMAKE_COMMAND} -E remove_directory "<INSTALL_DIR>/lib/cmake"
COMMAND ${CMAKE_COMMAND} -E remove_directory "<INSTALL_DIR>/lib/pkgconfig"
DEPENDEES install
)
endif()
if(BUILD_BULLET)
ExternalProject_Add(
bullet
GIT_REPOSITORY https://github.com/bulletphysics/bullet3.git
GIT_TAG 2fb92bc40c16e4da5a9018479d4a8e1899702ab8 #v2.83.7
#URL https://github.com/bulletphysics/bullet3/archive/2.83.7.tar.gz
#URL_HASH SHA256=919087c764d0e93555c6ef0830c8951a9caafea99f52ac8b366e96adbe0112ed
PATCH_COMMAND patch -p1 < ${CMAKE_CURRENT_LIST_DIR}/patches/bullet-btvector3-shuffle.patch
CMAKE_ARGS ${COMMON_CMAKE_ARGS}
-DINSTALL_LIBS=ON
-DUSE_MSVC_RUNTIME_LIBRARY_DLL=ON
-DBUILD_DEMOS=OFF
-DBUILD_CPU_DEMOS=OFF
-DBUILD_OPENGL3_DEMOS=OFF
-DBUILD_BULLET2_DEMOS=OFF
-DBUILD_BULLET3=OFF
-DBUILD_EXTRAS=OFF
-DBUILD_UNIT_TESTS=OFF
-DINCLUDE_INSTALL_DIR:STRING=include/
INSTALL_DIR ${THIRDPARTY_DIR}/bullet
)
ExternalProject_Add_Step(bullet remove_extras
COMMAND ${CMAKE_COMMAND} -E remove_directory "<INSTALL_DIR>/lib/cmake"
COMMAND ${CMAKE_COMMAND} -E remove_directory "<INSTALL_DIR>/lib/pkgconfig"
DEPENDEES install
)
endif()
if(BUILD_HARFBUZZ)
# Ugh, freetype and harfbuzz depend on each other?! Madness. Well, we'll
# have to make a temporary build of freetype so we can build HarfBuzz.
ExternalProject_Add(
freetype-nohb
DEPENDS zlib
URL http://www.panda3d.org/download/noversion/freetype-2.7.1.tar.gz
URL_HASH SHA256=162ef25aa64480b1189cdb261228e6c5c44f212aac4b4621e28cf2157efb59f5
CMAKE_ARGS ${COMMON_CMAKE_ARGS}
-DCMAKE_PREFIX_PATH=${THIRDPARTY_DIR}/zlib
-DWITH_HarfBuzz=OFF
-DWITH_BZip2=OFF
-DWITH_PNG=OFF
INSTALL_DIR ${CMAKE_CURRENT_BINARY_DIR}/freetype-nohb
)
# Use the tarball instead of git repo in order to avoid the need for ragel.
ExternalProject_Add(
harfbuzz
DEPENDS freetype-nohb
URL https://www.freedesktop.org/software/harfbuzz/release/harfbuzz-2.6.7.tar.xz
URL_HASH SHA256=49e481d06cdff97bf68d99fa26bdf785331f411614485d892ea4c78eb479b218
PATCH_COMMAND patch -p1 < ${CMAKE_CURRENT_LIST_DIR}/patches/harfbuzz-2.6-remove-dead-code.patch
CMAKE_ARGS ${COMMON_CMAKE_ARGS}
-DCMAKE_PREFIX_PATH=${CMAKE_CURRENT_BINARY_DIR}/freetype-nohb
-DHB_HAVE_FREETYPE=ON
-DHB_BUILD_TESTS=OFF
-DHB_BUILD_UTILS=OFF
-DHB_BUILD_SUBSET=OFF
-DHB_HAVE_INTROSPECTION=OFF
-DFREETYPE_LIBRARY=${CMAKE_CURRENT_BINARY_DIR}/freetype-nohb/lib/${CMAKE_STATIC_LIBRARY_PREFIX}freetype${CMAKE_STATIC_LIBRARY_SUFFIX}
-DFREETYPE_INCLUDE_DIR_freetype2=${CMAKE_CURRENT_BINARY_DIR}/freetype-nohb/include/freetype2
-DFREETYPE_INCLUDE_DIR_ft2build=${CMAKE_CURRENT_BINARY_DIR}/freetype-nohb/include/freetype2
INSTALL_DIR ${THIRDPARTY_DIR}/harfbuzz
)
ExternalProject_Add_Step(harfbuzz move_headers
COMMAND ${CMAKE_COMMAND} -E rename "<INSTALL_DIR>/include/harfbuzz" "<INSTALL_DIR>/include-tmp"
COMMAND ${CMAKE_COMMAND} -E remove_directory "<INSTALL_DIR>/include"
COMMAND ${CMAKE_COMMAND} -E rename "<INSTALL_DIR>/include-tmp" "<INSTALL_DIR>/include"
COMMAND ${CMAKE_COMMAND} -E remove_directory "<INSTALL_DIR>/lib/cmake"
DEPENDEES install
)
endif()
if(BUILD_FREETYPE)
ExternalProject_Add(
freetype
DEPENDS zlib harfbuzz
URL http://www.panda3d.org/download/noversion/freetype-2.7.1.tar.gz
URL_HASH SHA256=162ef25aa64480b1189cdb261228e6c5c44f212aac4b4621e28cf2157efb59f5
PATCH_COMMAND patch -p1 < ${CMAKE_CURRENT_LIST_DIR}/patches/freetype-2.7.1-harfbuzz-icu.patch
CMAKE_ARGS ${COMMON_CMAKE_ARGS}
-DCMAKE_PREFIX_PATH=${THIRDPARTY_DIR}/zlib;${THIRDPARTY_DIR}/harfbuzz
-DWITH_HarfBuzz=ON
-DWITH_BZip2=OFF
-DWITH_PNG=OFF
-DHARFBUZZ_INCLUDE_DIRS=${THIRDPARTY_DIR}/harfbuzz/include
-DHARFBUZZ_LIBRARIES=${THIRDPARTY_DIR}/harfbuzz/lib/${CMAKE_STATIC_LIBRARY_PREFIX}harfbuzz${CMAKE_STATIC_LIBRARY_SUFFIX}
-DHARFBUZZ_ICU_LIBRARIES=${THIRDPARTY_DIR}/harfbuzz/lib/${CMAKE_STATIC_LIBRARY_PREFIX}harfbuzz${CMAKE_STATIC_LIBRARY_SUFFIX}
-DPC_HARFBUZZ_INCLUDEDIR=${THIRDPARTY_DIR}/harfbuzz/include
-DPC_HARFBUZZ_LIBDIR=${THIRDPARTY_DIR}/harfbuzz/lib
INSTALL_DIR ${THIRDPARTY_DIR}/freetype
)
endif()
if(BUILD_VORBIS)
ExternalProject_Add(
ogg
GIT_REPOSITORY https://github.com/xiph/ogg.git
GIT_TAG dd85929dbe38be4b3876c9c0d6d5dcb7a128f388
CMAKE_ARGS ${COMMON_CMAKE_ARGS}
INSTALL_DIR ${THIRDPARTY_DIR}/vorbis
)
ExternalProject_Add(
vorbis
DEPENDS ogg
GIT_REPOSITORY https://github.com/xiph/vorbis.git
GIT_TAG 8ef0f8058854b2ef55d2d42bbe84487a9aadae12
CMAKE_ARGS ${COMMON_CMAKE_ARGS}
-DOGG_ROOT=${THIRDPARTY_DIR}/vorbis
-DOGG_INCLUDE_DIRS=${THIRDPARTY_DIR}/vorbis/include
-DOGG_LIBRARIES=${THIRDPARTY_DIR}/vorbis/lib/${CMAKE_STATIC_LIBRARY_PREFIX}ogg${CMAKE_STATIC_LIBRARY_SUFFIX}
INSTALL_DIR ${THIRDPARTY_DIR}/vorbis
)
ExternalProject_Add_Step(vorbis remove_extras
COMMAND ${CMAKE_COMMAND} -E remove_directory "<INSTALL_DIR>/lib/pkgconfig"
DEPENDEES install
)
endif()
if(BUILD_OPUS)
ExternalProject_Add(
ogg-opus
GIT_REPOSITORY https://github.com/xiph/ogg.git
GIT_TAG dd85929dbe38be4b3876c9c0d6d5dcb7a128f388
CMAKE_ARGS ${COMMON_CMAKE_ARGS}
INSTALL_DIR ${THIRDPARTY_DIR}/opus
)
ExternalProject_Add(
opus
GIT_REPOSITORY https://github.com/xiph/opus.git
GIT_TAG ddbe48383984d56acd9e1ab6a090c54ca6b735a6 # v1.5.2
CMAKE_ARGS ${COMMON_CMAKE_ARGS}
INSTALL_DIR ${THIRDPARTY_DIR}/opus
)
ExternalProject_Add(
opusfile
DEPENDS ogg-opus opus
GIT_REPOSITORY https://github.com/xiph/opusfile.git
GIT_TAG a55c164e9891a9326188b7d4d216ec9a88373739 # v0.12
PATCH_COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_LIST_DIR}/libopusfile.cmake <SOURCE_DIR>/CMakeLists.txt
CMAKE_ARGS ${COMMON_CMAKE_ARGS}
-DOGG_ROOT=${THIRDPARTY_DIR}/opus
-DOGG_INCLUDE_DIRS=${THIRDPARTY_DIR}/opus/include
-DOGG_LIBRARIES=${THIRDPARTY_DIR}/opus/lib/${CMAKE_STATIC_LIBRARY_PREFIX}ogg${CMAKE_STATIC_LIBRARY_SUFFIX}
-DOPUS_ROOT=${THIRDPARTY_DIR}/opus
-DOPUS_INCLUDE_DIRS=${THIRDPARTY_DIR}/opus/include/opus
-DOPUS_LIBRARIES=${THIRDPARTY_DIR}/opus/lib/${CMAKE_STATIC_LIBRARY_PREFIX}opus${CMAKE_STATIC_LIBRARY_SUFFIX}
INSTALL_DIR ${THIRDPARTY_DIR}/opus
)
ExternalProject_Add_Step(ogg-opus remove_extras
COMMAND ${CMAKE_COMMAND} -E remove_directory "<INSTALL_DIR>/lib/pkgconfig"
DEPENDEES install
)
endif()
if(BUILD_OPENAL)
ExternalProject_Add(
openal
GIT_REPOSITORY https://github.com/kcat/openal-soft.git
GIT_TAG ae4eacf147e2c2340cc4e02a790df04c793ed0a9 # 1.21.1
CMAKE_ARGS ${COMMON_CMAKE_ARGS}
-DLIBTYPE=STATIC
-DALSOFT_HRTF_DEFS=OFF
-DALSOFT_AMBDEC_PRESETS=OFF
-DALSOFT_CONFIG=OFF
-DALSOFT_NO_CONFIG_UTIL=ON
-DALSOFT_EXAMPLES=OFF
-DALSOFT_TESTS=OFF
-DALSOFT_UTILS=OFF
-DALSOFT_ENABLE_SSE2_CODEGEN=OFF # for only 32-bit
INSTALL_DIR ${THIRDPARTY_DIR}/openal
)
ExternalProject_Add_Step(openal remove_extras
COMMAND ${CMAKE_COMMAND} -E remove_directory "<INSTALL_DIR>/lib/cmake"
COMMAND ${CMAKE_COMMAND} -E remove_directory "<INSTALL_DIR>/lib/pkgconfig"
DEPENDEES install
)
endif()
if(BUILD_JPEG)
ExternalProject_Add(
jpeg
URL http://www.panda3d.org/download/noversion/jpegsrc.v9b.tar.gz
URL_HASH SHA256=566241ad815df935390b341a5d3d15a73a4000e5aab40c58505324c2855cbbb8
PATCH_COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_LIST_DIR}/libjpeg.cmake <SOURCE_DIR>/CMakeLists.txt
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_LIST_DIR}/libjpeg-jconfig.h.cmake <SOURCE_DIR>/jconfig.h.cmake
CMAKE_ARGS ${COMMON_CMAKE_ARGS}
-DBUILD_STATIC=ON
-DBUILD_EXECUTABLES=OFF
-DBUILD_TESTS=OFF
INSTALL_DIR ${THIRDPARTY_DIR}/jpeg
)
if(WIN32)
set(JPEG_LIBRARY ${THIRDPARTY_DIR}/jpeg/lib/jpeg-static.lib)
else()
set(JPEG_LIBRARY ${THIRDPARTY_DIR}/jpeg/lib/libjpeg.a)
endif()
else()
set(JPEG_LIBRARY JPEG_LIBRARY-NOTFOUND)
endif()
if(BUILD_SQUISH)
ExternalProject_Add(
squish
DEPENDS png
URL https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/libsquish/squish-1.10.tar.gz
URL_HASH SHA256=aec3428badafdbb3b0ed1ea3a385a8029e65694282459f61b4a538963e8cada3
PATCH_COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_LIST_DIR}/libsquish.cmake <SOURCE_DIR>/CMakeLists.txt
COMMAND patch -p1 < ${CMAKE_CURRENT_LIST_DIR}/patches/squish-1.10-sse.patch
CMAKE_ARGS ${COMMON_CMAKE_ARGS}
-DCMAKE_PREFIX_PATH=${THIRDPARTY_DIR}/png
INSTALL_DIR ${THIRDPARTY_DIR}/squish
)
endif()
if(BUILD_FCOLLADA)
ExternalProject_Add(
fcollada
GIT_REPOSITORY https://github.com/rdb/fcollada.git
GIT_TAG af049cf61c79357627ae669eab1106c4056de3b8
CMAKE_ARGS ${COMMON_CMAKE_ARGS}
-DBUILD_UNICODE=OFF
-DBUILD_TESTS=OFF
INSTALL_DIR ${THIRDPARTY_DIR}/fcollada
)
ExternalProject_Add_Step(fcollada remove_extras
COMMAND ${CMAKE_COMMAND} -E remove_directory "<INSTALL_DIR>/lib/pkgconfig"
DEPENDEES install
)
endif()
if(BUILD_VRPN)
ExternalProject_Add(
vrpn
# Pull from git since 7.33 has some compile issues
GIT_REPOSITORY https://github.com/vrpn/vrpn.git
GIT_TAG 9cfc1a536f39e8815066c39a1cef0f8a515a2860
CMAKE_ARGS ${COMMON_CMAKE_ARGS}
-DQUATLIB_BUILD_EXAMPLES=OFF
-DVRPN_BUILD_CLIENTS=OFF
-DVRPN_BUILD_CLIENT_LIBRARY=ON
-DVRPN_BUILD_JAVA=OFF
-DVRPN_BUILD_PYTHON=OFF
-DVRPN_BUILD_PYTHON_HANDCODED_2X=OFF
-DVRPN_BUILD_PYTHON_HANDCODED_3X=OFF
-DVRPN_BUILD_SERVERS=OFF
-DVRPN_BUILD_SERVER_LIBRARY=OFF
-DBUILD_TESTING=FALSE
INSTALL_DIR ${THIRDPARTY_DIR}/vrpn
)
endif()
if(BUILD_TIFF)
ExternalProject_Add(
tiff
DEPENDS zlib jpeg
URL http://download.osgeo.org/libtiff/tiff-4.0.6.tar.gz
URL_HASH SHA256=4d57a50907b510e3049a4bba0d7888930fdfc16ce49f1bf693e5b6247370d68c
CMAKE_ARGS ${COMMON_CMAKE_ARGS}
-DCMAKE_PREFIX_PATH=${THIRDPARTY_DIR}/zlib;${THIRDPARTY_DIR}/jpeg
-DJPEG_INCLUDE_DIR=${THIRDPARTY_DIR}/jpeg/include
-DJPEG_LIBRARY=${JPEG_LIBRARY}
-Dzlib=ON -Djpeg=ON -Dlzma=OFF -Dcxx=OFF
INSTALL_DIR ${THIRDPARTY_DIR}/tiff
)
# Remove the extra bin and share directories it created.
ExternalProject_Add_Step(tiff remove_extras
COMMAND ${CMAKE_COMMAND} -E remove_directory "<INSTALL_DIR>/bin"
COMMAND ${CMAKE_COMMAND} -E remove_directory "<INSTALL_DIR>/share"
DEPENDEES install
)
endif()
if(BUILD_EIGEN)
ExternalProject_Add(
eigen
URL https://www.panda3d.org/download/noversion/eigen-3.3.9.tar.gz
URL_HASH SHA256=7985975b787340124786f092b3a07d594b2e9cd53bbfe5f3d9b1daee7d55f56f
# Suppresses warning on MSVC
PATCH_COMMAND patch -p1 < ${CMAKE_CURRENT_LIST_DIR}/patches/eigen-3.3.9-bad-alloc.patch
# No need to build anything; just copy over the Eigen directory.
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_directory <SOURCE_DIR>/Eigen <INSTALL_DIR>/include/Eigen
COMMAND ${CMAKE_COMMAND} -E copy_if_different <SOURCE_DIR>/signature_of_eigen3_matrix_library <INSTALL_DIR>/include/signature_of_eigen3_matrix_library
INSTALL_DIR ${THIRDPARTY_DIR}/eigen
)
endif()
if(BUILD_ODE)
ExternalProject_Add(
ode
URL https://bitbucket.org/odedevs/ode/downloads/ode-0.13.1.tar.gz
URL_HASH SHA256=35e55e05c6c6ebb813a546017285a7aceedb3e8e55c8ff102e80e26bd84c5658
PATCH_COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_LIST_DIR}/libode.cmake <SOURCE_DIR>/CMakeLists.txt
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_LIST_DIR}/libode-config.h.cmake <SOURCE_DIR>/ode/src/config.h.cmake
CMAKE_ARGS ${COMMON_CMAKE_ARGS}
INSTALL_DIR ${THIRDPARTY_DIR}/ode
)
endif()
if(BUILD_ARTOOLKIT)
ExternalProject_Add(
artoolkit
URL http://www.panda3d.org/download/noversion/ARToolKit-2.72.1.tgz
URL_HASH SHA256=1a49a67c6e196b0e9990e90255ce840287ac47b5a53371a68a6dd93a5425d259
PATCH_COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_LIST_DIR}/artoolkit.cmake <SOURCE_DIR>/CMakeLists.txt
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_LIST_DIR}/artoolkit-config.h.cmake <SOURCE_DIR>/include/AR/config.h.cmake
CMAKE_ARGS ${COMMON_CMAKE_ARGS} -DCMAKE_OSX_ARCHITECTURES=x86_64
INSTALL_DIR ${THIRDPARTY_DIR}/artoolkit
)
endif()
if(BUILD_NVIDIACG AND CMAKE_SYSTEM_NAME STREQUAL "Windows")
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
ExternalProject_Add(
nvidiacg
URL http://www.panda3d.org/download/noversion/nvidiacg-win64.zip
URL_HASH SHA256=955d6e38bcba7a48e0efc8f2f0f7d5de39901788806e411744c63b55c83edfe2
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_directory <SOURCE_DIR>/lib <INSTALL_DIR>/lib
COMMAND ${CMAKE_COMMAND} -E copy_directory <SOURCE_DIR>/bin <INSTALL_DIR>/bin
COMMAND ${CMAKE_COMMAND} -E copy_directory <SOURCE_DIR>/include <INSTALL_DIR>/include
INSTALL_DIR ${THIRDPARTY_DIR}/nvidiacg
)
else()
ExternalProject_Add(
nvidiacg
URL http://www.panda3d.org/download/noversion/nvidiacg-win32.zip
URL_HASH SHA256=602ae301f3b68953a56a81ba89db0f53c0e10e8350faeb27842c5b827d9783a3
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_directory <SOURCE_DIR>/lib <INSTALL_DIR>/lib
COMMAND ${CMAKE_COMMAND} -E copy_directory <SOURCE_DIR>/bin <INSTALL_DIR>/bin
COMMAND ${CMAKE_COMMAND} -E copy_directory <SOURCE_DIR>/include <INSTALL_DIR>/include
INSTALL_DIR ${THIRDPARTY_DIR}/nvidiacg
)
endif()
elseif(BUILD_NVIDIACG AND CMAKE_SYSTEM_NAME STREQUAL "Darwin")
ExternalProject_Add(
nvidiacg
URL http://www.panda3d.org/download/noversion/NVIDIA_Cg.tgz
URL_HASH SHA256=cd6b12cca647749101b0286353095c7435251097d1aed0171cfc8afdcededd29
CONFIGURE_COMMAND chmod -R u+w <SOURCE_DIR>
BUILD_COMMAND install_name_tool -id @loader_path/../Frameworks/Cg.framework/Cg <SOURCE_DIR>/Library/Frameworks/Cg.framework/Cg
INSTALL_COMMAND rm -rf "<INSTALL_DIR>/Cg.framework"
COMMAND cp -R <SOURCE_DIR>/Library/Frameworks/Cg.framework <INSTALL_DIR>/Cg.framework
INSTALL_DIR ${THIRDPARTY_DIR}/nvidiacg
)
elseif(BUILD_NVIDIACG AND CMAKE_SYSTEM_NAME STREQUAL "Linux")
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
ExternalProject_Add(
nvidiacg
URL http://developer.download.nvidia.com/cg/Cg_3.1/Cg-3.1_April2012_x86_64.tgz
URL_HASH SHA256=e8ff01e6cc38d1b3fd56a083f5860737dbd2f319a39037528fb1a74a89ae9878
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_directory <SOURCE_DIR>/lib64 <INSTALL_DIR>/lib
COMMAND ${CMAKE_COMMAND} -E copy_directory <SOURCE_DIR>/include <INSTALL_DIR>/include
INSTALL_DIR ${THIRDPARTY_DIR}/nvidiacg
)
else()
ExternalProject_Add(
nvidiacg
URL http://developer.download.nvidia.com/cg/Cg_3.1/Cg-3.1_April2012_x86.tgz
URL_HASH SHA256=cef3591e436f528852db0e8c145d3842f920e0c89bcfb219c466797cb7b18879
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_directory <SOURCE_DIR>/lib <INSTALL_DIR>/lib
COMMAND ${CMAKE_COMMAND} -E copy_directory <SOURCE_DIR>/include <INSTALL_DIR>/include
INSTALL_DIR ${THIRDPARTY_DIR}/nvidiacg
)
endif()
endif()
if(BUILD_OPENSSL AND MSVC)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(ssl_config VC-WIN64A)
else()
set(ssl_config VC-WIN32)
endif()
ExternalProject_Add(
openssl
URL https://www.openssl.org/source/openssl-1.1.1m.tar.gz
URL_HASH SHA256=f89199be8b23ca45fc7cb9f1d8d3ee67312318286ad030f5316aca6462db6c96
CONFIGURE_COMMAND perl Configure ${ssl_config} no-shared --prefix=<INSTALL_DIR>
BUILD_COMMAND nmake build_libs
BUILD_IN_SOURCE 1
PATCH_COMMAND patch -p1 < ${CMAKE_CURRENT_LIST_DIR}/patches/openssl-1.1.1-no-pdb.patch
INSTALL_COMMAND nmake install_dev
INSTALL_DIR ${THIRDPARTY_DIR}/openssl
)
ExternalProject_Add_Step(openssl remove_extras
COMMAND ${CMAKE_COMMAND} -E remove_directory "<INSTALL_DIR>/bin"
DEPENDEES install
)
elseif(BUILD_OPENSSL AND NOT APPLE)
ExternalProject_Add(
openssl
URL https://www.openssl.org/source/openssl-1.1.1m.tar.gz
URL_HASH SHA256=f89199be8b23ca45fc7cb9f1d8d3ee67312318286ad030f5316aca6462db6c96
CONFIGURE_COMMAND ./config no-shared --prefix=<INSTALL_DIR> ${CMAKE_C_FLAGS}
BUILD_COMMAND ${MAKE}
BUILD_IN_SOURCE 1
INSTALL_DIR ${THIRDPARTY_DIR}/openssl
)
ExternalProject_Add_Step(openssl remove_extras
COMMAND ${CMAKE_COMMAND} -E remove_directory "<INSTALL_DIR>/bin"
COMMAND ${CMAKE_COMMAND} -E remove_directory "<INSTALL_DIR>/ssl"
COMMAND ${CMAKE_COMMAND} -E remove_directory "<INSTALL_DIR>/lib/pkgconfig"
DEPENDEES install
)
elseif(BUILD_OPENSSL AND APPLE)
set(ssl_flags ${CMAKE_C_FLAGS}
no-shared no-dso
-mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}
-Wno-nullability-completeness -Wno-expansion-to-defined)
if(CMAKE_OSX_SYSROOT)
set(ssl_flags ${ssl_flags} -isysroot${CMAKE_OSX_SYSROOT} -I/usr/include -Wl,-syslibroot,${CMAKE_OSX_SYSROOT})
endif()
if("arm64" IN_LIST CMAKE_OSX_ARCHITECTURES)
ExternalProject_Add(
openssl-arm64
URL https://www.openssl.org/source/openssl-1.1.1m.tar.gz
URL_HASH SHA256=f89199be8b23ca45fc7cb9f1d8d3ee67312318286ad030f5316aca6462db6c96
CONFIGURE_COMMAND /usr/bin/perl ./Configure darwin64-arm64-cc --prefix=<INSTALL_DIR> --openssldir=<INSTALL_DIR> ${ssl_flags}
BUILD_COMMAND ${MAKE}
BUILD_IN_SOURCE 1
)
endif()
if("x86_64" IN_LIST CMAKE_OSX_ARCHITECTURES)
ExternalProject_Add(
openssl-x86_64
URL https://www.openssl.org/source/openssl-1.1.1m.tar.gz
URL_HASH SHA256=f89199be8b23ca45fc7cb9f1d8d3ee67312318286ad030f5316aca6462db6c96
CONFIGURE_COMMAND /usr/bin/perl ./Configure darwin64-x86_64-cc --prefix=<INSTALL_DIR> --openssldir=<INSTALL_DIR> ${ssl_flags}
BUILD_COMMAND ${MAKE}
BUILD_IN_SOURCE 1
)
endif()
if("i386" IN_LIST CMAKE_OSX_ARCHITECTURES)
ExternalProject_Add(
openssl-i386
URL https://www.openssl.org/source/openssl-1.1.1m.tar.gz
URL_HASH SHA256=f89199be8b23ca45fc7cb9f1d8d3ee67312318286ad030f5316aca6462db6c96
CONFIGURE_COMMAND /usr/bin/perl ./Configure darwin-i386-cc --prefix=<INSTALL_DIR> --openssldir=<INSTALL_DIR> ${ssl_flags}
BUILD_COMMAND ${MAKE}
BUILD_IN_SOURCE 1
)
endif()
add_lipo_target(openssl libcrypto.a libssl.a)
endif()
if(BUILD_OPENEXR)
ExternalProject_Add(
openexr
DEPENDS zlib
GIT_REPOSITORY https://github.com/AcademySoftwareFoundation/openexr.git
GIT_TAG e94d82b2165da4e2af167aa74630906202e3d43b #v3.1.4
CMAKE_ARGS ${COMMON_CMAKE_ARGS}
-DCMAKE_PREFIX_PATH=${THIRDPARTY_DIR}/zlib
-DBUILD_TESTING=OFF
-DOPENEXR_FORCE_INTERNAL_IMATH=ON
-DOPENEXR_LIB_SUFFIX=
-DOPENEXR_BUILD_TOOLS=OFF
-DOPENEXR_INSTALL_TOOLS=OFF
-DOPENEXR_INSTALL_EXAMPLES=OFF
-DOPENEXR_INSTALL_PKG_CONFIG=OFF
-DIMATH_LIB_SUFFIX=
-DIMATH_INSTALL_PKG_CONFIG=OFF
INSTALL_DIR ${THIRDPARTY_DIR}/openexr
)
endif()
if(BUILD_FFMPEG AND APPLE)
set(ffmpeg_osx_flags "${ffmpeg_osx_flags} -mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET} -isysroot ${CMAKE_OSX_SYSROOT}")
foreach(arch ${CMAKE_OSX_ARCHITECTURES})
if(arch STREQUAL "arm64")
set(configure_flags --enable-cross-compile --arch=arm64 --target-os=darwin)
else()
set(configure_flags --arch=x86_64 --target-os=darwin)
endif()
ExternalProject_Add(
ffmpeg-${arch}
DEPENDS ogg vorbis freetype zlib
URL https://ffmpeg.org/releases/ffmpeg-4.4.1.tar.gz
URL_HASH SHA256=82c98f74777f623710b72f9a3389fd38c1ed93bc661107e65df19234e395f6b9
CONFIGURE_COMMAND ./configure --prefix=<INSTALL_DIR> --datadir=${CMAKE_BINARY_DIR}/etc --disable-shared --enable-static --enable-pic --disable-doc --disable-debug --disable-programs --disable-outdevs --enable-runtime-cpudetect ${configure_flags}
"--cc=${CMAKE_C_COMPILER}"
"--cxx=${CMAKE_CXX_COMPILER}"
"--ar=${CMAKE_C_COMPILER_AR}"
"--ranlib=${CMAKE_C_COMPILER_RANLIB}"
"--nm=${CMAKE_NM}"
"--strip=${CMAKE_STRIP}"
"--extra-cflags=${CMAKE_C_FLAGS} ${ffmpeg_osx_flags} -arch ${arch} -Wno-attributes"
"--extra-cxxflags=${CMAKE_CXX_FLAGS} ${ffmpeg_osx_flags} -arch ${arch} -Wno-attributes"
"--extra-ldflags=${ffmpeg_osx_flags} -arch ${arch}"
BUILD_COMMAND ${MAKE}
BUILD_IN_SOURCE 1
)
endforeach()
add_lipo_target(ffmpeg libavcodec.a libavdevice.a libavfilter.a libavformat.a libavutil.a libswresample.a libswscale.a)
elseif(BUILD_FFMPEG AND ANDROID)
if(CMAKE_ANDROID_ARCH STREQUAL "arm")
set(ffmpeg_arch armv7-a)
else()
set(ffmpeg_arch ${CMAKE_ANDROID_ARCH})
endif()
ExternalProject_Add(
ffmpeg
DEPENDS ogg vorbis freetype zlib
URL https://ffmpeg.org/releases/ffmpeg-4.4.1.tar.gz
URL_HASH SHA256=82c98f74777f623710b72f9a3389fd38c1ed93bc661107e65df19234e395f6b9
CONFIGURE_COMMAND ./configure --prefix=<INSTALL_DIR> --datadir=${CMAKE_BINARY_DIR}/etc --disable-shared --enable-static --enable-pic --disable-doc --disable-debug --disable-programs --disable-outdevs --enable-runtime-cpudetect --enable-cross-compile --arch=${ffmpeg_arch} --target-os=android
"--cc=${CMAKE_C_COMPILER}"
"--cxx=${CMAKE_CXX_COMPILER}"
"--ar=${CMAKE_AR}"
"--ranlib=${CMAKE_RANLIB}"
"--nm=${CMAKE_NM}"
"--strip=${CMAKE_STRIP}"
"--extra-cflags=${CMAKE_C_FLAGS} -target ${CMAKE_C_COMPILER_TARGET} -Wno-attributes"
"--extra-cxxflags=${CMAKE_CXX_FLAGS} -target ${CMAKE_CXX_COMPILER_TARGET} -Wno-attributes"
"--extra-ldflags=-target ${CMAKE_C_COMPILER_TARGET}"
BUILD_COMMAND ${MAKE}
BUILD_IN_SOURCE 1
INSTALL_DIR ${THIRDPARTY_DIR}/ffmpeg
)
ExternalProject_Add_Step(ffmpeg remove_extras
COMMAND ${CMAKE_COMMAND} -E remove_directory "<INSTALL_DIR>/lib/pkgconfig"
DEPENDEES install
)
elseif(BUILD_FFMPEG AND NOT WIN32)
ExternalProject_Add(
ffmpeg
DEPENDS ogg vorbis freetype zlib
URL https://ffmpeg.org/releases/ffmpeg-4.4.1.tar.gz
URL_HASH SHA256=82c98f74777f623710b72f9a3389fd38c1ed93bc661107e65df19234e395f6b9
CONFIGURE_COMMAND ./configure --prefix=<INSTALL_DIR> --datadir=${CMAKE_BINARY_DIR}/etc --disable-shared --enable-static --enable-pic --disable-doc --disable-debug --disable-programs --disable-outdevs --enable-runtime-cpudetect
"--cc=${CMAKE_C_COMPILER}"
"--cxx=${CMAKE_CXX_COMPILER}"
"--ar=${CMAKE_C_COMPILER_AR}"
"--ranlib=${CMAKE_C_COMPILER_RANLIB}"
"--nm=${CMAKE_NM}"
"--strip=${CMAKE_STRIP}"
"--extra-cflags=${CMAKE_C_FLAGS} -Wno-attributes"
"--extra-cxxflags=${CMAKE_CXX_FLAGS} -Wno-attributes"
BUILD_COMMAND ${MAKE}
BUILD_IN_SOURCE 1
INSTALL_DIR ${THIRDPARTY_DIR}/ffmpeg
)
ExternalProject_Add_Step(ffmpeg remove_extras
COMMAND ${CMAKE_COMMAND} -E remove_directory "<INSTALL_DIR>/lib/pkgconfig"
DEPENDEES install
)
endif()
if(BUILD_GLSLANG)
ExternalProject_Add(
glslang
GIT_REPOSITORY https://github.com/KhronosGroup/glslang.git
GIT_TAG 6d41bb9c557c5a0eec61ffba1f775dc5f717a8f7
CMAKE_ARGS ${COMMON_CMAKE_ARGS}
-DBUILD_EXTERNAL=OFF
-DBUILD_SHARED_LIBS=OFF
-DBUILD_TESTING=OFF
-DENABLE_EXCEPTIONS=OFF
-DENABLE_GLSLANG_BINARIES=ON
-DENABLE_HLSL=ON
-DENABLE_RTTI=OFF
-DENABLE_SPVREMAPPER=OFF
INSTALL_DIR ${THIRDPARTY_DIR}/glslang
)
endif()
if(BUILD_SPIRV_CROSS)
set(spirv_cross_flags)
if(MSVC)
# Don't specify NDEBUG so we don't compile out the error messages
set(spirv_cross_flags "-DCMAKE_CXX_FLAGS_RELEASE=/MD /O2 /Ob2")
endif()
ExternalProject_Add(
spirv-cross
GIT_REPOSITORY https://github.com/KhronosGroup/SPIRV-Cross.git
GIT_TAG 9040e0d25dc545a6d725276bdbd0362791c81f14
CMAKE_ARGS ${COMMON_CMAKE_ARGS}
${spirv_cross_flags}
-DSPIRV_CROSS_CLI=OFF
-DSPIRV_CROSS_ENABLE_CPP=OFF
-DSPIRV_CROSS_ENABLE_C_API=OFF
-DSPIRV_CROSS_ENABLE_GLSL=ON
-DSPIRV_CROSS_ENABLE_HLSL=ON
-DSPIRV_CROSS_ENABLE_MSL=ON
-DSPIRV_CROSS_ENABLE_REFLECT=OFF
-DSPIRV_CROSS_ENABLE_TESTS=OFF
-DSPIRV_CROSS_ENABLE_UTIL=OFF
-DSPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS=ON
-DSPIRV_CROSS_FORCE_PIC=ON
-DSPIRV_CROSS_SHARED=OFF
-DSPIRV_CROSS_STATIC=ON
INSTALL_DIR ${THIRDPARTY_DIR}/spirv-cross
)
ExternalProject_Add_Step(spirv-cross remove_extras
COMMAND ${CMAKE_COMMAND} -E remove_directory "<INSTALL_DIR>/share"
DEPENDEES install
)
endif()
if(BUILD_SPIRV_TOOLS)
ExternalProject_Add(
spirv-headers
GIT_REPOSITORY https://github.com/KhronosGroup/SPIRV-Headers.git
GIT_TAG 75b30a659c8a4979104986652c54cc421fc51129
BUILD_COMMAND cmake -E echo "Skipping build step."
INSTALL_COMMAND cmake -E echo "Skipping install step."
EXCLUDE_FROM_ALL TRUE
)
ExternalProject_Add(
spirv-tools
DEPENDS spirv-headers
GIT_REPOSITORY https://github.com/KhronosGroup/SPIRV-Tools.git
GIT_TAG c79edd260c2b503f0eca57310057b4a100999cc5
CMAKE_ARGS ${COMMON_CMAKE_ARGS}
-DSPIRV-Headers_SOURCE_DIR=${CMAKE_CURRENT_BINARY_DIR}/spirv-headers-prefix/src/spirv-headers
-DSPIRV_BUILD_COMPRESSION=OFF
-DSPIRV_SKIP_EXECUTABLES=ON
-DSPIRV_SKIP_TESTS=ON
-DSPIRV_WERROR=OFF
INSTALL_DIR ${THIRDPARTY_DIR}/spirv-tools
)
ExternalProject_Add_Step(spirv-tools remove_extras
COMMAND ${CMAKE_COMMAND} -E remove_directory "<INSTALL_DIR>/lib/pkgconfig"
COMMAND ${CMAKE_COMMAND} -E remove_directory "<INSTALL_DIR>/SPIRV-Tools"
COMMAND ${CMAKE_COMMAND} -E remove_directory "<INSTALL_DIR>/SPIRV-Tools-opt"
COMMAND ${CMAKE_COMMAND} -E remove_directory "<INSTALL_DIR>/SPIRV-Tools-reduce"
COMMAND ${CMAKE_COMMAND} -E remove_directory "<INSTALL_DIR>/SPIRV-Tools-link"
DEPENDEES install
)
endif()
if(BUILD_OPENCV)
ExternalProject_Add(
opencv
GIT_REPOSITORY https://github.com/opencv/opencv.git