-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathCMakeLists.txt
1287 lines (1208 loc) Β· 52.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
cmake_minimum_required(VERSION 3.2)
# some cmake yak yak about msvc CRT libs
cmake_policy(SET CMP0091 NEW)
project(DETONATOR2D)
option(USE_MOLD_LINKER "Use mold linker. /~https://github.com/rui314/mold" OFF)
message(STATUS "
~~ DETONATOR 2D ~~
\\\\o Brought to you by Ensisoft o//
http://www.ensisoft.com
Copyright (c) 2019-2023 Sami VΓ€isΓ€nen
Ensisoft
/~https://github.com/ensisoft/detonator
")
find_package(ZLIB REQUIRED)
find_package(HARFBUZZ REQUIRED)
find_package(MPG123 REQUIRED)
find_package(Boost REQUIRED)
find_package(assimp REQUIRED)
# conan2 doesn't provide CONAN_LIBS anymore, so we'll setup our own array var
# for the same purpose
set(CONAN_LIBS)
list(APPEND CONAN_LIBS "harfbuzz::harfbuzz")
list(APPEND CONAN_LIBS "Freetype::Freetype")
list(APPEND CONAN_LIBS "mpg123::mpg123")
list(APPEND CONAN_LIBS "ZLIB::ZLIB")
list(APPEND CONAN_LIBS "assimp::assimp")
# play stupid games, win stupid prices. shove this shit here to make the headers
# found same like before conan -> conan2 upgrade
include_directories(${Boost_INCLUDE_DIRS})
include_directories(${harfbuzz_INCLUDE_DIRS})
include_directories(${freetype_INCLUDE_DIRS})
# https://cmake.org/cmake/help/latest/module/FetchContent.html#examples
# https://jonathanhamberg.com/post/cmake-embedding-git-hash/
include(FetchContent)
FetchContent_Declare(cmake_git_version_tracking
GIT_REPOSITORY /~https://github.com/ensisoft/cmake-git-version-tracking.git
GIT_TAG 7b0d0fcb7e6f5fcadd238dd1292350e9e1363d36
)
FetchContent_MakeAvailable(cmake_git_version_tracking)
# wdk
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/wdk)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/third_party)
# current version is 0.2.1
#add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/third_party/libsamplerate)
# current version is 1.0.31
#add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/third_party/libsndfile)
# current version 2.4.1
#add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/third_party/box2d)
include_directories(BEFORE "${CMAKE_CURRENT_LIST_DIR}/wdk")
include_directories(BEFORE "${CMAKE_CURRENT_LIST_DIR}/third_party")
include_directories(BEFORE "${CMAKE_CURRENT_LIST_DIR}/third_party/glm")
include_directories(BEFORE "${CMAKE_CURRENT_LIST_DIR}/third_party/Khronos")
include_directories(BEFORE "${CMAKE_CURRENT_LIST_DIR}/third_party/libsamplerate/include")
include_directories(BEFORE "${CMAKE_CURRENT_LIST_DIR}/third_party/libsndfile/include")
include_directories(BEFORE "${CMAKE_CURRENT_LIST_DIR}/third_party/lua/src")
include_directories(BEFORE "${CMAKE_CURRENT_LIST_DIR}/third_party/box2d/include")
# this is only for CLion right now
if (UNIX)
include_directories(BEFORE "${CMAKE_CURRENT_LIST_DIR}/emsdk/upstream/emscripten/system/include")
endif()
# see this bug report about C++14 and Qt
# https://bugreports.qt.io/browse/QTBUG-53002
set(CMAKE_CXX_STANDARD 17)
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
message(STATUS "Building with Clang")
# in case of using something like Ninja we need this explicitly.
# https://medium.com/@alasher/colored-c-compiler-output-with-ninja-clang-gcc-10bfe7f2b949
add_compile_options (-fcolor-diagnostics)
# neargye magic-enum exceeds maximum expression nesting limit
add_compile_options(-fbracket-depth=1024)
if (USE_MOLD_LINKER)
message(STATUS "Using mold linker /~https://github.com/rui314/mold")
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" "-fuse-ld=/usr/bin/mold")
add_link_options(-fuse-ld=mold)
endif()
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
message(STATUS "Building with GCC")
# in case of using something like Ninja we need this explicitly.
# https://medium.com/@alasher/colored-c-compiler-output-with-ninja-clang-gcc-10bfe7f2b949
add_compile_options(-fdiagnostics-color=always)
# globally enable address sanitizing here
#add_link_options(-fsanitize=address)
# iterator debugging. otherwise it's also possible to use the debug containers
# https://gcc.gnu.org/onlinedocs/libstdc++/manual/debug_mode_using.html#debug_mode.using.specific
#add_compile_definitions(-D_GLIBCXX_DEBUG)
# and just like so, suddenly GCC no longer compiles the project after a Linux upgrade!
add_compile_options(-Wno-changes-meaning)
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
message(STATUS "Building with MSVC")
# /wd4251 Qt dll interface crap
# /wd4275 Qt dll interface crap again
# /wd4018 signed/unsigned mismatch
# /wd4244 conversion from double to float
# /wd4305 truncation from double to float
# /wd4267 conversion from size_t to int (Qt uses ints extensively)
add_definitions("/wd4251 /wd4275 /wd4018 /wd4244 /wd4305 /wd4267")
# generate debugging .pdb files for Release builds on MSVS
if (CMAKE_BUILD_TYPE MATCHES "Release")
# /Zi turns on the .pdb generation. We want this for the release build
# so that we can do post-mortem debugging with the minidump (from the crash)
# and the pdb file.
# /FS is needed for parallel build. It forces data to be written
# through a serialized surrogate process.
# NOTE that the /Zi names the .pdb file as vcx0.pdb where the x is
# the version number. So for example vc120.pdb
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zi")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /FS")
# http://www.wintellect.com/devcenter/jrobbins/correctly-creating-native-c-release-build-pdbs
# need to tell the linker also about the debug data.
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /DEBUG")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /OPT:REF")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /OPT:ICF")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /DEBUG")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /OPT:REF")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /OPT:ICF")
endif()
endif()
# we also need Qt for the time being
if (WIN32)
set(CMAKE_PREFIX_PATH "C:/Qt/5.15.2/msvc2019_64")
endif()
find_package(Qt5Widgets)
find_package(Qt5OpenGL)
find_package(Qt5Network)
find_package(Qt5Svg)
find_package(Qt5Xml)
if (NOT Qt5Widgets_FOUND)
message("
Qt5 was not found. I will not be able to build the game.
")
else()
message(STATUS "Qt5 version: ${Qt5Widgets_VERSION}")
message(STATUS "${Qt5Widgets_INCLUDE_DIRS}")
endif()
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTORCC ON)
# this tells cmake to include our *current* directory which is our build directory
# in which the Qt tools (moc and uic) will spit out their generated files.
# so for example when you have "include ui_foobar.h" in your code the
# ui_foobar.h is generated by UIC and will be placed in the current dir.
set(CMAKE_INCLUDE_CURRENT_DIR ON)
# Disable any prefix on debug libraries. This should make it easier to
# switch between debug/release versions when loading the game engine library.
# I.e the way the library is loaded based on its configured name doesn't
# need to change from release to debug.
set(CMAKE_DEBUG_POSTFIX "")
# combine as many translation units as possible into static libraries
# in order to reduce the build times by not repeatedly building a translation
# unit when it's possible to use a library
add_library(BaseLib
base/assert.cpp
base/format.cpp
base/logging.cpp
base/json.cpp
base/utility.cpp
base/trace.cpp
base/memory.cpp
base/threadpool.cpp)
add_library(AudioLib
audio/format.cpp
audio/loader.cpp
audio/sndfile.cpp
audio/mpg123.cpp
audio/pulseaudio.cpp
audio/sdl.cpp
audio/sokol.cpp
audio/waveout.cpp
audio/openal.cpp
audio/source.cpp
audio/player.cpp
audio/element.cpp
audio/graph.cpp
audio/proxy.cpp)
add_library(DataLib
data/json.cpp
data/io.cpp)
add_library(GfxLib
device/opengles.cpp
device/vertex.cpp
graphics/algo.cpp
graphics/bitmap.cpp
graphics/bitmap_noise.cpp
graphics/debug_drawable.cpp
graphics/device.cpp
graphics/device_framebuffer.cpp
graphics/device_geometry.cpp
graphics/device_instance.cpp
graphics/device_program.cpp
graphics/device_shader.cpp
graphics/device_texture.cpp
graphics/drawable.cpp
graphics/drawcmd.cpp
graphics/drawing.cpp
graphics/generic_shader_program.cpp
graphics/geometry.cpp
graphics/guidegrid.cpp
graphics/image.cpp
graphics/linebatch.cpp
graphics/loader.cpp
graphics/material.cpp
graphics/material_class.cpp
graphics/material_instance.cpp
graphics/painter.cpp
graphics/particle_engine.cpp
graphics/pixel.cpp
graphics/polygon_mesh.cpp
graphics/shader_program.cpp
graphics/shader_source.cpp
graphics/simple_shape.cpp
graphics/text_buffer.cpp
graphics/text_font.cpp
graphics/text_material.cpp
graphics/texture_bitmap_buffer_source.cpp
graphics/texture_bitmap_generator_source.cpp
graphics/texture_file_source.cpp
graphics/texture_map.cpp
graphics/texture_text_buffer_source.cpp
graphics/texture_texture_source.cpp
graphics/tilebatch.cpp
graphics/utility.cpp
graphics/vertex.cpp
third_party/stb/stb_image.c
third_party/stb/stb_image_write.c
third_party/base64/base64.cpp)
add_library(EngineLib
game/animation.cpp
game/animator.cpp
game/transform_animator.cpp
game/kinematic_animator.cpp
game/property_animator.cpp
game/material_animator.cpp
game/entity.cpp
game/entity_node.cpp
game/entity_placement.cpp
game/entity_state.cpp
game/entity_state_controller.cpp
game/entity_node_transformer.cpp
game/entity_node_rigid_body.cpp
game/entity_node_rigid_body_joint.cpp
game/entity_node_drawable_item.cpp
game/entity_node_text_item.cpp
game/entity_node_spatial_node.cpp
game/entity_node_fixture.cpp
game/entity_node_tilemap_node.cpp
game/entity_node_light.cpp
game/scriptvar.cpp
game/scene_class.cpp
game/scene.cpp
game/tilemap.cpp
engine/audio.cpp
engine/camera.cpp
engine/renderer.cpp
engine/physics.cpp
engine/graphics.cpp
engine/ui.cpp
engine/state.cpp)
add_library(UiLib
uikit/animation.cpp
uikit/layout.cpp
uikit/widget.cpp
uikit/window.cpp)
add_library(GfxLibTesting
device/opengles.cpp
device/vertex.cpp
graphics/algo.cpp
graphics/bitmap.cpp
graphics/bitmap_noise.cpp
graphics/debug_drawable.cpp
graphics/device.cpp
graphics/device_framebuffer.cpp
graphics/device_geometry.cpp
graphics/device_instance.cpp
graphics/device_program.cpp
graphics/device_shader.cpp
graphics/device_texture.cpp
graphics/drawable.cpp
graphics/drawcmd.cpp
graphics/drawing.cpp
graphics/generic_shader_program.cpp
graphics/geometry.cpp
graphics/guidegrid.cpp
graphics/image.cpp
graphics/linebatch.cpp
graphics/loader.cpp
graphics/material.cpp
graphics/material_class.cpp
graphics/material_instance.cpp
graphics/painter.cpp
graphics/particle_engine.cpp
graphics/pixel.cpp
graphics/polygon_mesh.cpp
graphics/shader_program.cpp
graphics/shader_source.cpp
graphics/simple_shape.cpp
graphics/text_buffer.cpp
graphics/text_font.cpp
graphics/text_material.cpp
graphics/texture_bitmap_buffer_source.cpp
graphics/texture_bitmap_generator_source.cpp
graphics/texture_file_source.cpp
graphics/texture_map.cpp
graphics/texture_text_buffer_source.cpp
graphics/texture_texture_source.cpp
graphics/tilebatch.cpp
graphics/utility.cpp
graphics/vertex.cpp
graphics/tool/polygon.cpp
third_party/stb/stb_image.c
third_party/stb/stb_image_write.c
third_party/base64/base64.cpp)
target_include_directories(GfxLibTesting PRIVATE "${CMAKE_CURRENT_LIST_DIR}/graphics/unit_test")
if (UNIX)
target_compile_options(GfxLibTesting PRIVATE -fPIC)
endif()
target_include_directories(AudioLib PRIVATE "${CMAKE_CURRENT_LIST_DIR}/config")
target_include_directories(BaseLib PRIVATE "${CMAKE_CURRENT_LIST_DIR}/config")
target_include_directories(DataLib PRIVATE "${CMAKE_CURRENT_LIST_DIR}/config")
target_include_directories(GfxLib PRIVATE "${CMAKE_CURRENT_LIST_DIR}/config")
target_include_directories(EngineLib PRIVATE "${CMAKE_CURRENT_LIST_DIR}/config")
target_include_directories(UiLib PRIVATE "${CMAKE_CURRENT_LIST_DIR}/config")
if (UNIX)
target_compile_options(AudioLib PRIVATE -fPIC)
target_compile_options(DataLib PRIVATE -fPIC)
target_compile_options(BaseLib PRIVATE -fPIC)
target_compile_options(GfxLib PRIVATE -fPIC)
target_compile_options(EngineLib PRIVATE -fPIC)
target_compile_options(UiLib PRIVATE -fPIC)
target_link_libraries(AudioLib INTERFACE pulse)
target_link_libraries(AudioLib INTERFACE pthread)
target_link_libraries(AudioLib INTERFACE samplerate)
target_link_libraries(AudioLib INTERFACE sndfile)
endif()
if (MSVC)
target_compile_options(EngineLib INTERFACE /bigobj)
target_link_libraries(AudioLib INTERFACE samplerate)
target_link_libraries(AudioLib INTERFACE sndfile)
endif()
target_link_libraries(EngineLib INTERFACE box2d)
# somehow this shit is now needed with conan2 deps...
target_link_libraries(AudioLib PUBLIC ${CONAN_LIBS})
target_link_libraries(DataLib PUBLIC ${CONAN_LIBS})
target_link_libraries(BaseLib PUBLIC ${CONAN_LIBS})
target_link_libraries(GfxLib PUBLIC ${CONAN_LIBS})
target_link_libraries(GfxLibTesting PUBLIC ${CONAN_LIBS})
target_link_libraries(EngineLib PUBLIC ${CONAN_LIBS})
target_link_libraries(UiLib PUBLIC ${CONAN_LIBS})
add_library(QuaZip
third_party/quazip/quazip/unzip.c
third_party/quazip/quazip/zip.c
third_party/quazip/quazip/JlCompress.cpp
third_party/quazip/quazip/qioapi.cpp
third_party/quazip/quazip/quaadler32.cpp
third_party/quazip/quazip/quachecksum32.cpp
third_party/quazip/quazip/quacrc32.cpp
third_party/quazip/quazip/quagzipfile.cpp
third_party/quazip/quazip/quaziodevice.cpp
third_party/quazip/quazip/quazip.cpp
third_party/quazip/quazip/quazipdir.cpp
third_party/quazip/quazip/quazipfile.cpp
third_party/quazip/quazip/quazipfileinfo.cpp
third_party/quazip/quazip/quazipnewinfo.cpp)
target_compile_definitions(QuaZip PUBLIC QUAZIP_STATIC)
target_link_libraries(QuaZip Qt5::Core ZLIB::ZLIB)
add_library(QtColorWidgets
third_party/Qt-Color-Widgets/src/abstract_widget_list.cpp
third_party/Qt-Color-Widgets/src/bound_color_selector.cpp
third_party/Qt-Color-Widgets/src/color_2d_slider.cpp
third_party/Qt-Color-Widgets/src/color_delegate.cpp
third_party/Qt-Color-Widgets/src/color_dialog.cpp
third_party/Qt-Color-Widgets/src/color_dialog.ui
third_party/Qt-Color-Widgets/src/color_line_edit.cpp
third_party/Qt-Color-Widgets/src/color_list_widget.cpp
third_party/Qt-Color-Widgets/src/color_names.cpp
third_party/Qt-Color-Widgets/src/color_palette.cpp
third_party/Qt-Color-Widgets/src/color_palette_model.cpp
third_party/Qt-Color-Widgets/src/color_palette_widget.cpp
third_party/Qt-Color-Widgets/src/color_palette_widget.ui
third_party/Qt-Color-Widgets/src/color_preview.cpp
third_party/Qt-Color-Widgets/src/color_selector.cpp
third_party/Qt-Color-Widgets/src/color_utils.cpp
third_party/Qt-Color-Widgets/src/color_wheel.cpp
third_party/Qt-Color-Widgets/src/color_widgets.qrc
third_party/Qt-Color-Widgets/src/gradient_slider.cpp
third_party/Qt-Color-Widgets/src/hue_slider.cpp
third_party/Qt-Color-Widgets/src/swatch.cpp
third_party/Qt-Color-Widgets/include/abstract_widget_list.hpp
third_party/Qt-Color-Widgets/include/bound_color_selector.hpp
third_party/Qt-Color-Widgets/include/color_2d_slider.hpp
third_party/Qt-Color-Widgets/include/color_delegate.hpp
third_party/Qt-Color-Widgets/include/color_dialog.hpp
third_party/Qt-Color-Widgets/include/color_line_edit.hpp
third_party/Qt-Color-Widgets/include/color_list_widget.hpp
third_party/Qt-Color-Widgets/include/color_names.hpp
third_party/Qt-Color-Widgets/include/color_palette.hpp
third_party/Qt-Color-Widgets/include/color_palette_model.hpp
third_party/Qt-Color-Widgets/include/color_palette_widget.hpp
third_party/Qt-Color-Widgets/include/color_preview.hpp
third_party/Qt-Color-Widgets/include/color_selector.hpp
third_party/Qt-Color-Widgets/include/color_wheel.hpp
third_party/Qt-Color-Widgets/include/colorwidgets_global.hpp
third_party/Qt-Color-Widgets/include/gradient_slider.hpp
third_party/Qt-Color-Widgets/include/hue_slider.hpp
third_party/Qt-Color-Widgets/include/swatch.hpp)
target_include_directories(QtColorWidgets PRIVATE "${CMAKE_CURRENT_LIST_DIR}/third_party/Qt-Color-Widgets/include")
target_compile_definitions(QtColorWidgets PRIVATE "QTCOLORWIDGETS_LIBRARY")
target_link_libraries(QtColorWidgets Qt5::Widgets Qt5::Core Qt5::CorePrivate)
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
# suppress some noise coming from Qt (Qt-Color-Widgets)
target_compile_options(QtColorWidgets PRIVATE -Wno-deprecated-declarations)
endif()
add_library(tree-sitter third_party/tree-sitter/src/lib.c
third_party/tree-sitter/lua/parser.c
third_party/tree-sitter/lua/scanner.c)
target_include_directories(tree-sitter PRIVATE "${CMAKE_CURRENT_LIST_DIR}/third_party/tree-sitter/include")
# Editor application.
add_executable(Detonator
audio/format.cpp
audio/loader.cpp
audio/sndfile.cpp
audio/mpg123.cpp
audio/pulseaudio.cpp
audio/sdl.cpp
audio/sokol.cpp
audio/waveout.cpp
audio/openal.cpp
audio/source.cpp
audio/player.cpp
audio/element.cpp
audio/graph.cpp
audio/proxy.cpp
graphics/tool/polygon.cpp
editor/app/import.h
editor/app/import.cpp
editor/app/event.h
editor/app/eventlog.h
editor/app/eventlog.cpp
editor/app/window-eventlog.h
editor/app/window-eventlog.cpp
editor/app/format.h
editor/app/format.cpp
editor/app/packing.h
editor/app/packing.cpp
editor/app/platform.h
editor/app/platform.cpp
editor/app/utility.h
editor/app/utility.cpp
editor/app/workspace.h
editor/app/workspace.cpp
editor/app/project_settings.cpp
editor/app/workspace_resource_packer.cpp
editor/app/zip_archive.cpp
editor/app/zip_archive_exporter.cpp
editor/app/zip_archive_importer.cpp
editor/app/buffer.h
editor/app/buffer.cpp
editor/app/packing.cpp
editor/app/process.h
editor/app/process.cpp
editor/app/ipc.cpp
editor/app/resource.cpp
editor/app/resource_cache.cpp
editor/app/lua-tools.cpp
editor/app/lua-doc.cpp
editor/app/code-tools.cpp
editor/gui/audiowidget.h
editor/gui/audiowidget.ui
editor/gui/audiowidget.cpp
editor/gui/animationtrackwidget.h
editor/gui/animationtrackwidget.ui
editor/gui/animationtrackwidget.cpp
editor/gui/childwindow.h
editor/gui/childwindow.cpp
editor/gui/childwindow.ui
editor/gui/fudialog.h
editor/gui/fudialog.cpp
editor/gui/completer.ui
editor/gui/codewidget.h
editor/gui/codewidget.cpp
editor/gui/drawing.cpp
editor/gui/playwindow.h
editor/gui/playwindow.cpp
editor/gui/playwindow.ui
editor/gui/dlganimator.h
editor/gui/dlganimator.ui
editor/gui/dlganimator.cpp
editor/gui/dlgeventlog.h
editor/gui/dlgeventlog.ui
editor/gui/dlgeventlog.cpp
editor/gui/dlgvcs.h
editor/gui/dlgvcs.ui
editor/gui/dlgvcs.cpp
editor/gui/dlgsvg.h
editor/gui/dlgsvg.ui
editor/gui/dlgsvg.cpp
editor/gui/dlgabout.h
editor/gui/dlgabout.ui
editor/gui/dlgabout.cpp
editor/gui/dlgcomplete.h
editor/gui/dlgcomplete.ui
editor/gui/dlgcomplete.cpp
editor/gui/dlgjoint.h
editor/gui/dlgjoint.ui
editor/gui/dlgjoint.cpp
editor/gui/dlgsettings.h
editor/gui/dlgsettings.ui
editor/gui/dlgsettings.cpp
editor/gui/dlgfindentity.ui
editor/gui/dlgentity.h
editor/gui/dlgentity.ui
editor/gui/dlgentity.cpp
editor/gui/dlgbitmap.h
editor/gui/dlgbitmap.cpp
editor/gui/dlgtext.h
editor/gui/dlgtext.cpp
editor/gui/dlgtext.ui
editor/gui/dlgfont.h
editor/gui/dlgfont.ui
editor/gui/dlgfont.cpp
editor/gui/dlgtexturerect.h
editor/gui/dlgtexturerect.ui
editor/gui/dlgtexturerect.cpp
editor/gui/dlgimgview.h
editor/gui/dlgimgview.ui
editor/gui/dlgimgview.cpp
editor/gui/dlgimgpack.ui
editor/gui/dlgimgpack.h
editor/gui/dlgimgpack.cpp
editor/gui/dlgparticle.h
editor/gui/dlgparticle.ui
editor/gui/dlgparticle.cpp
editor/gui/dlgmaterial.h
editor/gui/dlgmaterial.ui
editor/gui/dlgmaterial.cpp
editor/gui/dlgmaterialparams.h
editor/gui/dlgmaterialparams.ui
editor/gui/dlgmaterialparams.cpp
editor/gui/dlgmodelimport.h
editor/gui/dlgmodelimport.ui
editor/gui/dlgmodelimport.cpp
editor/gui/dlgpackage.h
editor/gui/dlgpackage.ui
editor/gui/dlgpackage.cpp
editor/gui/dlgprogress.h
editor/gui/dlgprogress.ui
editor/gui/dlgprogress.cpp
editor/gui/dlgproject.h
editor/gui/dlgproject.ui
editor/gui/dlgproject.cpp
editor/gui/dlgresdeps.h
editor/gui/dlgresdeps.ui
editor/gui/dlgresdeps.cpp
editor/gui/dlgsave.h
editor/gui/dlgsave.ui
editor/gui/dlgsave.cpp
editor/gui/dlgopen.h
editor/gui/dlgopen.ui
editor/gui/dlgopen.cpp
editor/gui/dlgscriptvarname.h
editor/gui/dlgscriptvarname.ui
editor/gui/dlgscriptvarname.cpp
editor/gui/dlgscriptvar.h
editor/gui/dlgscriptvar.ui
editor/gui/dlgscriptvar.cpp
editor/gui/dlgstyleproperties.h
editor/gui/dlgstyleproperties.ui
editor/gui/dlgstyleproperties.cpp
editor/gui/dlgtextedit.h
editor/gui/dlgtextedit.ui
editor/gui/dlgtextedit.cpp
editor/gui/dlgwidgetlist.h
editor/gui/dlgwidgetlist.ui
editor/gui/dlgwidgetlist.cpp
editor/gui/dlggradient.h
editor/gui/dlggradient.ui
editor/gui/dlgnew.h
editor/gui/dlgnew.ui
editor/gui/dlgtilemap.h
editor/gui/dlgtilemap.ui
editor/gui/dlgtilemap.cpp
editor/gui/dlgfontmap.h
editor/gui/dlgfontmap.ui
editor/gui/dlgfontmap.cpp
editor/gui/dlgtilelayer.h
editor/gui/dlgtilelayer.ui
editor/gui/dlgtileimport.h
editor/gui/dlgtileimport.ui
editor/gui/dlgtileimport.cpp
editor/gui/dlgtiletool.h
editor/gui/dlgtiletool.ui
editor/gui/dlgtiletool.cpp
editor/gui/dlgimport.h
editor/gui/dlgimport.ui
editor/gui/dlgimport.cpp
editor/gui/dlgmigrationlog.h
editor/gui/dlgmigrationlog.ui
editor/gui/dlgmigrationlog.cpp
editor/gui/gfxwidget.h
editor/gui/gfxwidget.cpp
editor/gui/mainwidget.h
editor/gui/mainwindow.h
editor/gui/mainwindow.cpp
editor/gui/mainwindow.ui
editor/gui/viewwindow.h
editor/gui/viewwindow.ui
editor/gui/viewwindow.cpp
editor/gui/main.cpp
editor/gui/particlewidget.h
editor/gui/particlewidget.cpp
editor/gui/particlewidget.ui
editor/gui/polygonwidget.ui
editor/gui/polygonwidget.h
editor/gui/polygonwidget.cpp
editor/gui/materialwidget.h
editor/gui/materialwidget.cpp
editor/gui/materialwidget.ui
editor/gui/entitywidget.h
editor/gui/entitywidget.ui
editor/gui/entitywidget.cpp
editor/gui/scenewidget.h
editor/gui/scenewidget.ui
editor/gui/scenewidget.cpp
editor/gui/scriptwidget.h
editor/gui/scriptwidget.ui
editor/gui/scriptwidget.cpp
editor/gui/settings.h
editor/gui/settings.cpp
editor/gui/doubleslider.h
editor/gui/doubleslider.ui
editor/gui/doubleslider.cpp
editor/gui/spinboxwidget.h
editor/gui/doublespinbox.ui
editor/gui/spinboxwidget.cpp
editor/gui/collapsible_widget.h
editor/gui/collapsible_widget.ui
editor/gui/collapsible_widget.cpp
editor/gui/curvewidget.cpp
editor/gui/curvewidget.h
editor/gui/treewidget.h
editor/gui/treewidget.cpp
editor/gui/timelinewidget.h
editor/gui/timelinewidget.cpp
editor/gui/rangewidget.h
editor/gui/rangewidget.cpp
editor/gui/uiwidget.h
editor/gui/uiwidget.ui
editor/gui/uiwidget.cpp
editor/gui/tilemapwidget.h
editor/gui/tilemapwidget.ui
editor/gui/tilemapwidget.cpp
editor/gui/uniform.h
editor/gui/uniform.ui
editor/gui/uniform.cpp
editor/gui/vector3.h
editor/gui/vector3.ui
editor/gui/vector3.cpp
editor/gui/palettematerial.h
editor/gui/palettematerial.ui
editor/gui/palettematerial.cpp
editor/gui/sampler.h
editor/gui/sampler.ui
editor/gui/widgetstylewidget.h
editor/gui/widgetstylewidget.ui
editor/gui/widgetstylewidget.cpp
editor/gui/timewidget.h
editor/gui/timewidget.ui
editor/gui/timewidget.cpp
editor/gui/utility.cpp
editor/gui/svg/svgview.h
editor/gui/svg/svgview.cpp
editor/gui/imgpack.cpp
editor/gui/translation.h
editor/gui/translation.cpp
editor/gui/spritewidget.h
editor/gui/spritewidget.ui
editor/gui/spritewidget.cpp
editor/resource/resource.qrc
editor/welcome.qrc
editor/gui/darkstyle/darkstyle.cpp
editor/gui/darkstyle/darkstyle.h
editor/gui/darkstyle/stylecommon.h
editor/gui/darkstyle/stylecommon.cpp
editor/gui/darkstyle/darkstyle.qrc
editor/gui/framelesswindow/framelesswindow.h
editor/gui/framelesswindow/framelesswindow.ui
editor/gui/framelesswindow/framelesswindow.cpp
editor/gui/framelesswindow/windowdragger.h
editor/gui/framelesswindow/windowdragger.cpp
editor/gui/framelesswindow/framelesswindow.qrc
)
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
# suppress some noise coming from Qt (Qt-Color-Widgets)
target_compile_options(Detonator PRIVATE -Wno-deprecated-declarations)
endif()
target_compile_definitions(Detonator PRIVATE DETONATOR_EDITOR_BUILD)
target_compile_definitions(Detonator PRIVATE "QTCOLORWIDGETS_LIBRARY")
target_include_directories(Detonator PRIVATE "${CMAKE_CURRENT_LIST_DIR}/editor")
# add this include for the promoted widgets
target_include_directories(Detonator PRIVATE "${CMAKE_CURRENT_LIST_DIR}/editor/gui")
target_include_directories(Detonator PRIVATE "${CMAKE_CURRENT_LIST_DIR}/editor/gui/framelesswindow")
target_include_directories(Detonator PRIVATE "${CMAKE_CURRENT_LIST_DIR}/third_party/Qt-Color-Widgets/include")
target_include_directories(Detonator PRIVATE "${CMAKE_CURRENT_LIST_DIR}/third_party/quazip/")
target_include_directories(Detonator PRIVATE "${CMAKE_CURRENT_LIST_DIR}/third_party/tree-sitter/include")
# support Clion finding the generated headers (see AUTOGEN_BUILD_DIR)
target_include_directories(Detonator PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/Editor_autogen/include")
target_link_libraries(Detonator Qt5::Widgets Qt5::OpenGL Qt5::Core Qt5::CorePrivate Qt5::Network Qt5::Svg Qt5::Xml)
target_link_libraries(Detonator EngineLib UiLib GfxLib DataLib BaseLib)
target_link_libraries(Detonator Lua)
target_link_libraries(Detonator QtColorWidgets)
target_link_libraries(Detonator QuaZip)
target_link_libraries(Detonator ${CONAN_LIBS})
target_link_libraries(Detonator cmake_git_version_tracking)
target_link_libraries(Detonator tree-sitter)
target_link_libraries(Detonator samplerate)
target_link_libraries(Detonator sndfile)
if (UNIX)
target_link_libraries(Detonator pulse)
target_link_libraries(Detonator pthread)
endif()
install(TARGETS Detonator DESTINATION "${CMAKE_CURRENT_LIST_DIR}/editor/dist")
# Copy the Python based http-server for serving the HTML5/WASM game locally
# with the right access policy headers for enabling some features such
# as the infamous SharedArrayBuffer
install(FILES "${CMAKE_CURRENT_LIST_DIR}/tools/http-server.py" DESTINATION "${CMAKE_CURRENT_LIST_DIR}/editor/dist")
# game host application which provides a host process to load the game
# libraries for playback.
add_executable(EditorGameHost
editor/app/format.cpp
editor/app/utility.cpp
editor/app/eventlog.h
editor/app/eventlog.cpp
editor/app/packing.cpp
editor/app/workspace.h
editor/app/workspace.cpp
editor/app/project_settings.cpp
editor/app/workspace_resource_packer.cpp
editor/app/zip_archive.cpp
editor/app/zip_archive_exporter.cpp
editor/app/zip_archive_importer.cpp
editor/app/resource.cpp
editor/app/buffer.cpp
editor/app/window-eventlog.cpp
editor/app/ipc.h
editor/app/ipc.cpp
editor/app/process.cpp
editor/gui/host.cpp
editor/gui/utility.h
editor/gui/playwindow.h
editor/gui/playwindow.ui
editor/gui/playwindow.cpp
editor/gui/dlgeventlog.h
editor/gui/dlgeventlog.ui
editor/gui/dlgeventlog.cpp
editor/resource/resource.qrc
editor/gui/darkstyle/darkstyle.cpp
editor/gui/darkstyle/darkstyle.h
editor/gui/darkstyle/stylecommon.h
editor/gui/darkstyle/stylecommon.cpp
editor/gui/darkstyle/darkstyle.qrc
)
target_compile_definitions(EditorGameHost PRIVATE DETONATOR_GAMEHOST_BUILD)
target_include_directories(EditorGameHost PRIVATE "${CMAKE_CURRENT_LIST_DIR}/editor")
target_include_directories(EditorGameHost PRIVATE "${CMAKE_CURRENT_LIST_DIR}/editor/gui")
target_include_directories(EditorGameHost PRIVATE "${CMAKE_CURRENT_LIST_DIR}/third_party/Qt-Color-Widgets/include")
target_include_directories(EditorGameHost PRIVATE "${CMAKE_CURRENT_LIST_DIR}/third_party/quazip/")
# support Clion finding the generated headers (see AUTOGEN_BUILD_DIR)
target_include_directories(EditorGameHost PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/EditorGameHost_autogen/include")
target_link_libraries(EditorGameHost Qt5::Widgets Qt5::OpenGL Qt5::Core Qt5::CorePrivate Qt5::Network)
target_link_libraries(EditorGameHost EngineLib AudioLib UiLib GfxLib DataLib BaseLib)
target_link_libraries(EditorGameHost QuaZip)
target_link_libraries(EditorGameHost ${CONAN_LIBS})
target_link_libraries(EditorGameHost cmake_git_version_tracking)
install(TARGETS EditorGameHost DESTINATION "${CMAKE_CURRENT_LIST_DIR}/editor/dist")
# audio test application. Simple console application that plays
# OGG and WAV files in several different formats.
add_executable(audio_test
audio/format.cpp
audio/loader.cpp
audio/sndfile.cpp
audio/mpg123.cpp
audio/pulseaudio.cpp
audio/waveout.cpp
audio/openal.cpp
audio/sdl.cpp
audio/sokol.cpp
audio/source.cpp
audio/player.cpp
audio/element.cpp
audio/graph.cpp
audio/proxy.cpp
audio/test/main.cpp
)
target_include_directories(audio_test PRIVATE "${CMAKE_CURRENT_LIST_DIR}/audio/test")
target_link_libraries(audio_test BaseLib)
target_link_libraries(audio_test Qt5::Widgets)
target_link_libraries(audio_test ${CONAN_LIBS})
target_link_libraries(audio_test samplerate)
target_link_libraries(audio_test sndfile)
if (UNIX)
target_link_libraries(audio_test pulse)
target_link_libraries(audio_test pthread)
# target_link_libraries(audio_test openal)
# target_link_libraries(audio_test SDL2)
# for ALSA backend through sokol
# target_link_libraries(audio_test asound)
endif()
install(TARGETS audio_test DESTINATION "${CMAKE_CURRENT_LIST_DIR}/audio/test/")
# graphics test application. Uses the graphics APIs to draw stuff.
# needs DETERMINISTIC_RANDOM flag
add_executable(graphics_test
graphics/test/main.cpp
)
target_include_directories(graphics_test PRIVATE "${CMAKE_CURRENT_LIST_DIR}/graphics/test")
target_link_libraries(graphics_test GfxLibTesting)
target_link_libraries(graphics_test BaseLib DataLib)
target_link_libraries(graphics_test ${CONAN_LIBS})
target_link_libraries(graphics_test wdk_system wdk_desktop_gl)
install(TARGETS graphics_test DESTINATION "${CMAKE_CURRENT_LIST_DIR}/graphics/test/dist")
# main game runner application. The executable will read a
# config.json and create the window/context for the application as
# per the configuration. The game logic will be loaded from a .so or .dll
add_executable(GameMain engine/main/main.cpp)
target_include_directories(GameMain PRIVATE "${CMAKE_CURRENT_LIST_DIR}/engine/main")
target_link_libraries(GameMain DataLib BaseLib wdk_system wdk_desktop_gl)
target_link_libraries(GameMain cmake_git_version_tracking)
if (UNIX)
target_link_libraries(GameMain dl pthread)
endif()
install(TARGETS GameMain DESTINATION "${CMAKE_CURRENT_LIST_DIR}/editor/dist")
# generic game engine library.
add_library(GameEngine SHARED
engine/loader.cpp
engine/engine.cpp
engine/lua_game_runtime.cpp
engine/lua_util.cpp
engine/lua_base.cpp
engine/lua_data.cpp
engine/lua_glm.cpp
engine/lua_wdk.cpp
engine/lua_uik.cpp
engine/lua_gfx.cpp
engine/lua_game.cpp
engine/library/library.cpp
)
target_include_directories(GameEngine PRIVATE "${CMAKE_CURRENT_LIST_DIR}/engine/main")
target_link_libraries(GameEngine PRIVATE EngineLib GfxLib AudioLib UiLib DataLib BaseLib)
target_link_libraries(GameEngine PRIVATE ${CONAN_LIBS})
target_link_libraries(GameEngine PRIVATE wdk_system)
target_link_libraries(GameEngine PRIVATE Lua)
install(TARGETS GameEngine DESTINATION "${CMAKE_CURRENT_LIST_DIR}/editor/dist")
# hide symbols on linux
if (UNIX)
target_link_options(GameEngine PRIVATE "-Wl,--version-script=${CMAKE_CURRENT_LIST_DIR}/engine/library/library.txt")
endif()
# test engine
add_library(TestEngine SHARED
engine/loader.cpp
engine/test/main.cpp
engine/library/library.cpp
)
target_include_directories(TestEngine PRIVATE "${CMAKE_CURRENT_LIST_DIR}/engine/test")
target_link_libraries(TestEngine PRIVATE EngineLib GfxLib AudioLib UiLib DataLib BaseLib)
target_link_libraries(TestEngine PRIVATE ${CONAN_LIBS})
install(TARGETS TestEngine GameMain DESTINATION "${CMAKE_CURRENT_LIST_DIR}/engine/test/dist")
# hide symbols on linux
if (UNIX)
target_link_options(TestEngine PRIVATE "-Wl,--version-script=${CMAKE_CURRENT_LIST_DIR}/engine/library/library.txt")
endif()
# engine perf test app
add_executable(perf-test engine/test/perftest.cpp)
target_include_directories(perf-test PRIVATE "${CMAKE_CURRENT_LIST_DIR}/engine/test")
target_link_libraries(perf-test PRIVATE EngineLib GfxLibTesting AudioLib UiLib DataLib BaseLib)
target_link_libraries(perf-test PRIVATE ${CONAN_LIBS})
target_link_libraries(perf-test PRIVATE wdk_system wdk_desktop_gl)
target_link_libraries(perf-test PRIVATE Lua)
install(TARGETS perf-test DESTINATION "${CMAKE_CURRENT_LIST_DIR}/engine/test/dist")
# simple standalone executable to play with lua and sol
# for testing c++/lua integration strategies.
add_executable(lua-test tools/test/luatest.cpp)
target_link_libraries(lua-test PRIVATE Lua ${CONAN_LIBS})
add_executable(glm-test tools/test/glmtest.cpp)
target_include_directories(glm-test PRIVATE "${CMAKE_CURRENT_LIST_DIR}/third_party/glm")
# 3D/2D isometric projection test app.
add_executable(3d tools/test/3d/main.cpp)
target_link_libraries(3d PRIVATE wdk_system wdk_desktop_gl EngineLib GfxLib UiLib DataLib BaseLib ${CONAN_LIBS})
target_include_directories(3d PRIVATE "${CMAKE_CURRENT_LIST_DIR}/tools/test/3d")
target_include_directories(3d PRIVATE "${CMAKE_CURRENT_LIST_DIR}/third_party/glm")
install(TARGETS 3d DESTINATION "${CMAKE_CURRENT_LIST_DIR}/tools/test/3d/dist")
# unit tests
enable_testing()
#data unit tests
add_executable(unit_test_data data/unit_test/unit_test.cpp
data/json.cpp)
add_test(NAME unit_test_data COMMAND unit_test_data)
target_include_directories(unit_test_data PRIVATE "${CMAKE_CURRENT_LIST_DIR}/data/unit_test")
target_link_libraries(unit_test_data PRIVATE BaseLib)
#editor unit tests
add_executable(unit_test_imgpack
editor/app/unit_test/unit_test_image_packing.cpp
editor/app/packing.cpp
base/assert.cpp
graphics/bitmap.cpp
graphics/bitmap_noise.cpp
graphics/pixel.cpp
third_party/stb/stb_image.c
third_party/stb/stb_image_write.c)
add_executable(unit_test_ipc
editor/app/unit_test/unit_test_ipc.cpp
editor/app/eventlog.cpp
editor/app/format.cpp
editor/app/utility.cpp
editor/app/workspace.cpp
editor/app/project_settings.cpp
editor/app/workspace_resource_packer.cpp
editor/app/zip_archive.cpp
editor/app/zip_archive_exporter.cpp
editor/app/zip_archive_importer.cpp
editor/app/resource.cpp
editor/app/buffer.cpp
editor/app/ipc.cpp
editor/app/packing.cpp
editor/app/process.cpp)
target_include_directories(unit_test_ipc PRIVATE "${CMAKE_CURRENT_LIST_DIR}/third_party/quazip/")
add_executable(unit_test_lua_tool
editor/app/unit_test/unit_test_lua_tool.cpp
editor/app/utility.cpp
editor/app/lua-tools.cpp
base/assert.cpp)
target_include_directories(unit_test_lua_tool PRIVATE "${CMAKE_CURRENT_LIST_DIR}/third_party/tree-sitter/include")
add_executable(unit_test_resource
editor/app/unit_test/unit_test_resource.cpp
editor/app/utility.cpp
base/assert.cpp)
add_executable(unit_test_workspace
editor/app/unit_test/unit_test_workspace.cpp
engine/loader.cpp
editor/app/utility.cpp
editor/app/format.cpp
editor/app/eventlog.cpp
editor/app/workspace.cpp
editor/app/project_settings.cpp
editor/app/workspace_resource_packer.cpp
editor/app/zip_archive.cpp