forked from Keriew/augustus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
975 lines (915 loc) · 40.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
cmake_minimum_required(VERSION 3.1...3.27.0)
include(CMakeDependentOption)
set(TARGET_PLATFORM "default" CACHE STRING "Platform to cross-compile for. Options: vita switch android emscripten. Leave blank for no cross compilation")
set_property(CACHE TARGET_PLATFORM PROPERTY STRINGS default vita switch android emscripten)
string(TOLOWER ${TARGET_PLATFORM} TARGET_PLATFORM)
option(DRAW_FPS "Draw FPS on the top left corner of the window." OFF)
option(DRAW_ROUTING "Draw routing debug information." OFF)
option(DRAW_HIGHWAY_TERRAIN "Draw highway debug information." OFF)
option(DRAW_ROAD_NETWORK_IDS "Draw road network IDs for debugging." OFF)
option(DRAW_TILE_COORDS "Draw tile coordinates." OFF)
if(${TARGET_PLATFORM} STREQUAL "vita" AND NOT DEFINED CMAKE_TOOLCHAIN_FILE)
if(DEFINED ENV{VITASDK})
set(CMAKE_TOOLCHAIN_FILE "$ENV{VITASDK}/share/vita.toolchain.cmake" CACHE PATH "toolchain file")
else()
message(FATAL_ERROR "Please define VITASDK to point to your SDK path!")
endif()
endif()
if(${TARGET_PLATFORM} STREQUAL "switch" AND NOT DEFINED CMAKE_TOOLCHAIN_FILE)
message(FATAL_ERROR "Please use /opt/devkitpro/portlibs/switch/bin/aarch64-none-elf-cmake to configure")
endif()
if(${TARGET_PLATFORM} STREQUAL "emscripten" AND NOT DEFINED CMAKE_TOOLCHAIN_FILE)
if(DEFINED ENV{EMSDK})
set(EMSDK $ENV{EMSDK})
set(CMAKE_TOOLCHAIN_FILE "$ENV{EMSDK}/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake" CACHE PATH "toolchain file")
else()
message(FATAL_ERROR "Please define EMSDK to point to your Emscripten SDK path!")
endif()
endif()
set(SHORT_NAME augustus)
set(USER_FRIENDLY_NAME Augustus)
project(${SHORT_NAME} C)
if (NINTENDO_SWITCH)
find_package(PkgConfig REQUIRED)
endif()
if (${TARGET_PLATFORM} STREQUAL "vita")
include("${VITASDK}/share/vita.cmake" REQUIRED)
set(VITA_TITLEID "AUGUSTUS1")
endif()
set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" "${CMAKE_SOURCE_DIR}/cmake/")
set(CMAKE_C_STANDARD 99)
if(CMAKE_COMPILER_IS_GNUCC)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wpedantic -Wno-unused-parameter -Wno-missing-field-initializers -Wno-sign-compare -Werror=implicit-function-declaration")
if(CMAKE_C_COMPILER_VERSION VERSION_GREATER 5.0)
set(CMAKE_C_FLAGS "-Werror=incompatible-pointer-types -Werror=int-conversion -Wstrict-prototypes ${CMAKE_C_FLAGS}")
endif()
if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 7.0)
set_source_files_properties(${SOURCE_FILES} PROPERTIES COMPILE_FLAGS "-Walloc-zero -Wdouble-promotion -Wduplicated-branches -Wduplicated-cond -Wformat=2 -Wformat-signedness -Winit-self -Wlogical-op -Wmissing-declarations -Wmissing-prototypes -Wshadow -Wundef -Wunused-macros -Wwrite-strings")
endif()
elseif(CMAKE_C_COMPILER_ID STREQUAL "Clang" AND "${CMAKE_BUILD_TYPE}" MATCHES "Debug" AND NOT ${TARGET_PLATFORM} STREQUAL "android")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=undefined")
endif()
set(PROJECT_VERSION_MAJOR 4)
set(PROJECT_VERSION_MINOR 0)
set(PROJECT_VERSION_PATCH 0)
set(IS_RELEASE_VERSION FALSE)
if(IS_RELEASE_VERSION)
set(PROJECT_VERSION_TWEAK 0)
set(VERSION_REVISION "")
elseif (EXISTS "${CMAKE_SOURCE_DIR}/.git")
find_package(Git)
if(Git_FOUND)
execute_process(
COMMAND git rev-list --count HEAD ^tags/v${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
RESULT_VARIABLE TWEAK_RESULT
OUTPUT_VARIABLE PROJECT_VERSION_TWEAK
OUTPUT_STRIP_TRAILING_WHITESPACE
)
execute_process(
COMMAND git rev-parse --short --verify HEAD
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE VERSION_COMMIT_HASH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
execute_process(
COMMAND git diff-index --quiet HEAD --
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
RESULT_VARIABLE VERSION_COMMIT_DIRTY
)
if(VERSION_COMMIT_DIRTY)
set(DIRTY_POSTFIX "-dirty")
else()
set(DIRTY_POSTFIX "")
endif()
if(NOT TWEAK_RESULT EQUAL 0)
# Happens on a shallow git clone, like Travis does. Append date to version ref.
set(PROJECT_VERSION_TWEAK 0)
string(TIMESTAMP TODAY "%Y%m%d")
set(VERSION_REVISION "-${TODAY}-${VERSION_COMMIT_HASH}${DIRTY_POSTFIX}")
else()
set(VERSION_REVISION ".${PROJECT_VERSION_TWEAK}-${VERSION_COMMIT_HASH}${DIRTY_POSTFIX}")
endif()
else()
set(PROJECT_VERSION_TWEAK 0)
set(VERSION_REVISION " unknown development version")
endif()
else()
set(PROJECT_VERSION_TWEAK 0)
set(VERSION_REVISION " unknown development version")
endif()
if(${TARGET_PLATFORM} STREQUAL "vita")
string(LENGTH "${PROJECT_VERSION_MAJOR}" NUM_DIGITS)
if(NUM_DIGITS EQUAL 1)
set(VITA_VERSION_MAJOR "0${PROJECT_VERSION_MAJOR}")
elseif(NUM_DIGITS EQUAL 2)
set(VITA_VERSION_MAJOR "${PROJECT_VERSION_MAJOR}")
else()
message(FATAL_ERROR "On Vita, major version number can only have one or two digits, found ${NUM_DIGITS} digits instead")
endif()
string(LENGTH "${PROJECT_VERSION_MINOR}" NUM_DIGITS)
if(NUM_DIGITS EQUAL 1)
set(VITA_VERSION_MINOR "0${PROJECT_VERSION_MINOR}")
elseif(NUM_DIGITS EQUAL 2)
set(VITA_VERSION_MINOR "${PROJECT_VERSION_MINOR}")
else()
message(FATAL_ERROR "On Vita, minor version number can only have one or two digits, found ${NUM_DIGITS} digits instead")
endif()
set(VITA_VERSION "${VITA_VERSION_MAJOR}.${VITA_VERSION_MINOR}")
endif()
if (NINTENDO_SWITCH)
string(SUBSTRING "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}${VERSION_REVISION}" 0 15 SWITCH_VERSION)
endif()
configure_file(${PROJECT_SOURCE_DIR}/gen/version.c.in ${PROJECT_SOURCE_DIR}/src/platform/version.c)
configure_file(${PROJECT_SOURCE_DIR}/gen/version.rc.in ${PROJECT_SOURCE_DIR}/res/version.rc)
configure_file(${PROJECT_SOURCE_DIR}/gen/version.txt.in ${PROJECT_SOURCE_DIR}/res/version.txt)
if(${TARGET_PLATFORM} STREQUAL "emscripten")
configure_file(${PROJECT_SOURCE_DIR}/gen/shell.html.in ${PROJECT_SOURCE_DIR}/res/shell.html)
endif()
if(DRAW_FPS)
add_definitions(-DDRAW_FPS)
endif()
if(DRAW_ROUTING)
add_definitions(-DDRAW_ROUTING)
endif()
if(DRAW_HIGHWAY_TERRAIN)
add_definitions(-DDRAW_HIGHWAY_TERRAIN)
endif()
if(DRAW_TILE_COORDS)
add_definitions(-DDRAW_TILE_COORDS)
endif()
if(DRAW_ROAD_NETWORK_IDS)
add_definitions(-DDRAW_ROAD_NETWORK_IDS)
endif()
set(ASSETS_DIR ${PROJECT_SOURCE_DIR}/res/assets)
if (EXISTS ${PROJECT_SOURCE_DIR}/res/packed_assets)
set(ASSETS_DIR ${PROJECT_SOURCE_DIR}/res/packed_assets)
endif()
set(TINYFD_FILES
${PROJECT_SOURCE_DIR}/ext/tinyfiledialogs/tinyfiledialogs.c
)
set(SPNG_FILES
${PROJECT_SOURCE_DIR}/ext/spng/spng.c
)
set(SXML_FILES
${PROJECT_SOURCE_DIR}/ext/sxml/sxml.c
)
set(ZIP_FILES
${PROJECT_SOURCE_DIR}/ext/zip/zip.c
)
set(PLATFORM_FILES
${PROJECT_SOURCE_DIR}/src/platform/arguments.c
${PROJECT_SOURCE_DIR}/src/platform/augustus.c
${PROJECT_SOURCE_DIR}/src/platform/crash_handler.c
${PROJECT_SOURCE_DIR}/src/platform/cursor.c
${PROJECT_SOURCE_DIR}/src/platform/file_manager.c
${PROJECT_SOURCE_DIR}/src/platform/icon.c
${PROJECT_SOURCE_DIR}/src/platform/joystick.c
${PROJECT_SOURCE_DIR}/src/platform/keyboard_input.c
${PROJECT_SOURCE_DIR}/src/platform/log.c
${PROJECT_SOURCE_DIR}/src/platform/mouse.c
${PROJECT_SOURCE_DIR}/src/platform/platform.c
${PROJECT_SOURCE_DIR}/src/platform/prefs.c
${PROJECT_SOURCE_DIR}/src/platform/renderer.c
${PROJECT_SOURCE_DIR}/src/platform/screen.c
${PROJECT_SOURCE_DIR}/src/platform/sound_device.c
${PROJECT_SOURCE_DIR}/src/platform/touch.c
${PROJECT_SOURCE_DIR}/src/platform/version.c
${PROJECT_SOURCE_DIR}/src/platform/virtual_keyboard.c
)
if (${TARGET_PLATFORM} STREQUAL "vita")
set(PLATFORM_FILES
${PLATFORM_FILES}
${PROJECT_SOURCE_DIR}/src/platform/file_manager_cache.c
${PROJECT_SOURCE_DIR}/src/platform/vita/vita.c
${PROJECT_SOURCE_DIR}/src/platform/vita/vita_keyboard.c
)
elseif (NINTENDO_SWITCH)
set(PLATFORM_FILES
${PLATFORM_FILES}
${PROJECT_SOURCE_DIR}/src/platform/file_manager_cache.c
${PROJECT_SOURCE_DIR}/src/platform/switch/switch.c
)
elseif (${TARGET_PLATFORM} STREQUAL "android")
set(PLATFORM_FILES
${PLATFORM_FILES}
${PROJECT_SOURCE_DIR}/src/platform/android/android.c
${PROJECT_SOURCE_DIR}/src/platform/android/asset_handler.c
${PROJECT_SOURCE_DIR}/src/platform/android/jni.c
)
endif()
set(CORE_FILES
${PROJECT_SOURCE_DIR}/src/core/array.c
${PROJECT_SOURCE_DIR}/src/core/buffer.c
${PROJECT_SOURCE_DIR}/src/core/calc.c
${PROJECT_SOURCE_DIR}/src/core/config.c
${PROJECT_SOURCE_DIR}/src/core/dir.c
${PROJECT_SOURCE_DIR}/src/core/encoding.c
${PROJECT_SOURCE_DIR}/src/core/encoding_japanese.c
${PROJECT_SOURCE_DIR}/src/core/encoding_korean.c
${PROJECT_SOURCE_DIR}/src/core/encoding_simp_chinese.c
${PROJECT_SOURCE_DIR}/src/core/encoding_trad_chinese.c
${PROJECT_SOURCE_DIR}/src/core/file.c
${PROJECT_SOURCE_DIR}/src/core/hotkey_config.c
${PROJECT_SOURCE_DIR}/src/core/image.c
${PROJECT_SOURCE_DIR}/src/core/image_packer.c
${PROJECT_SOURCE_DIR}/src/core/io.c
${PROJECT_SOURCE_DIR}/src/core/lang.c
${PROJECT_SOURCE_DIR}/src/core/locale.c
${PROJECT_SOURCE_DIR}/src/core/memory_block.c
${PROJECT_SOURCE_DIR}/src/core/png_read.c
${PROJECT_SOURCE_DIR}/src/core/random.c
${PROJECT_SOURCE_DIR}/src/core/smacker.c
${PROJECT_SOURCE_DIR}/src/core/speed.c
${PROJECT_SOURCE_DIR}/src/core/string.c
${PROJECT_SOURCE_DIR}/src/core/time.c
${PROJECT_SOURCE_DIR}/src/core/xml_parser.c
${PROJECT_SOURCE_DIR}/src/core/xml_exporter.c
${PROJECT_SOURCE_DIR}/src/core/zip.c
${PROJECT_SOURCE_DIR}/src/core/zlib_helper.c
)
set(BUILDING_FILES
${PROJECT_SOURCE_DIR}/src/building/animation.c
${PROJECT_SOURCE_DIR}/src/building/barracks.c
${PROJECT_SOURCE_DIR}/src/building/building.c
${PROJECT_SOURCE_DIR}/src/building/caravanserai.c
${PROJECT_SOURCE_DIR}/src/building/clone.c
${PROJECT_SOURCE_DIR}/src/building/connectable.c
${PROJECT_SOURCE_DIR}/src/building/construction.c
${PROJECT_SOURCE_DIR}/src/building/construction_building.c
${PROJECT_SOURCE_DIR}/src/building/construction_clear.c
${PROJECT_SOURCE_DIR}/src/building/construction_routed.c
${PROJECT_SOURCE_DIR}/src/building/construction_warning.c
${PROJECT_SOURCE_DIR}/src/building/count.c
${PROJECT_SOURCE_DIR}/src/building/data_transfer.c
${PROJECT_SOURCE_DIR}/src/building/destruction.c
${PROJECT_SOURCE_DIR}/src/building/distribution.c
${PROJECT_SOURCE_DIR}/src/building/dock.c
${PROJECT_SOURCE_DIR}/src/building/entertainment.c
${PROJECT_SOURCE_DIR}/src/building/figure.c
${PROJECT_SOURCE_DIR}/src/building/government.c
${PROJECT_SOURCE_DIR}/src/building/granary.c
${PROJECT_SOURCE_DIR}/src/building/house.c
${PROJECT_SOURCE_DIR}/src/building/house_evolution.c
${PROJECT_SOURCE_DIR}/src/building/house_population.c
${PROJECT_SOURCE_DIR}/src/building/house_service.c
${PROJECT_SOURCE_DIR}/src/building/image.c
${PROJECT_SOURCE_DIR}/src/building/industry.c
${PROJECT_SOURCE_DIR}/src/building/lighthouse.c
${PROJECT_SOURCE_DIR}/src/building/list.c
${PROJECT_SOURCE_DIR}/src/building/maintenance.c
${PROJECT_SOURCE_DIR}/src/building/market.c
${PROJECT_SOURCE_DIR}/src/building/menu.c
${PROJECT_SOURCE_DIR}/src/building/mess_hall.c
${PROJECT_SOURCE_DIR}/src/building/model.c
${PROJECT_SOURCE_DIR}/src/building/monument.c
${PROJECT_SOURCE_DIR}/src/building/properties.c
${PROJECT_SOURCE_DIR}/src/building/roadblock.c
${PROJECT_SOURCE_DIR}/src/building/rotation.c
${PROJECT_SOURCE_DIR}/src/building/state.c
${PROJECT_SOURCE_DIR}/src/building/storage.c
${PROJECT_SOURCE_DIR}/src/building/tavern.c
${PROJECT_SOURCE_DIR}/src/building/temple.c
${PROJECT_SOURCE_DIR}/src/building/variant.c
${PROJECT_SOURCE_DIR}/src/building/warehouse.c
)
set(CITY_FILES
${PROJECT_SOURCE_DIR}/src/city/buildings.c
${PROJECT_SOURCE_DIR}/src/city/culture.c
${PROJECT_SOURCE_DIR}/src/city/data.c
${PROJECT_SOURCE_DIR}/src/city/data_private.c
${PROJECT_SOURCE_DIR}/src/city/emperor.c
${PROJECT_SOURCE_DIR}/src/city/entertainment.c
${PROJECT_SOURCE_DIR}/src/city/festival.c
${PROJECT_SOURCE_DIR}/src/city/figures.c
${PROJECT_SOURCE_DIR}/src/city/finance.c
${PROJECT_SOURCE_DIR}/src/city/games.c
${PROJECT_SOURCE_DIR}/src/city/gods.c
${PROJECT_SOURCE_DIR}/src/city/health.c
${PROJECT_SOURCE_DIR}/src/city/houses.c
${PROJECT_SOURCE_DIR}/src/city/labor.c
${PROJECT_SOURCE_DIR}/src/city/map.c
${PROJECT_SOURCE_DIR}/src/city/message.c
${PROJECT_SOURCE_DIR}/src/city/migration.c
${PROJECT_SOURCE_DIR}/src/city/military.c
${PROJECT_SOURCE_DIR}/src/city/mission.c
${PROJECT_SOURCE_DIR}/src/city/population.c
${PROJECT_SOURCE_DIR}/src/city/race_bet.c
${PROJECT_SOURCE_DIR}/src/city/ratings.c
${PROJECT_SOURCE_DIR}/src/city/request.c
${PROJECT_SOURCE_DIR}/src/city/resource.c
${PROJECT_SOURCE_DIR}/src/city/sentiment.c
${PROJECT_SOURCE_DIR}/src/city/sound.c
${PROJECT_SOURCE_DIR}/src/city/trade.c
${PROJECT_SOURCE_DIR}/src/city/trade_policy.c
${PROJECT_SOURCE_DIR}/src/city/victory.c
${PROJECT_SOURCE_DIR}/src/city/view.c
${PROJECT_SOURCE_DIR}/src/city/warning.c
)
set(EMPIRE_FILES
${PROJECT_SOURCE_DIR}/src/empire/city.c
${PROJECT_SOURCE_DIR}/src/empire/empire.c
${PROJECT_SOURCE_DIR}/src/empire/xml.c
${PROJECT_SOURCE_DIR}/src/empire/object.c
${PROJECT_SOURCE_DIR}/src/empire/trade_prices.c
${PROJECT_SOURCE_DIR}/src/empire/trade_route.c
)
set(FIGURE_FILES
${PROJECT_SOURCE_DIR}/src/figure/action.c
${PROJECT_SOURCE_DIR}/src/figure/combat.c
${PROJECT_SOURCE_DIR}/src/figure/enemy_army.c
${PROJECT_SOURCE_DIR}/src/figure/figure.c
${PROJECT_SOURCE_DIR}/src/figure/formation.c
${PROJECT_SOURCE_DIR}/src/figure/formation_enemy.c
${PROJECT_SOURCE_DIR}/src/figure/formation_herd.c
${PROJECT_SOURCE_DIR}/src/figure/formation_layout.c
${PROJECT_SOURCE_DIR}/src/figure/formation_legion.c
${PROJECT_SOURCE_DIR}/src/figure/image.c
${PROJECT_SOURCE_DIR}/src/figure/movement.c
${PROJECT_SOURCE_DIR}/src/figure/name.c
${PROJECT_SOURCE_DIR}/src/figure/phrase.c
${PROJECT_SOURCE_DIR}/src/figure/properties.c
${PROJECT_SOURCE_DIR}/src/figure/roamer_preview.c
${PROJECT_SOURCE_DIR}/src/figure/route.c
${PROJECT_SOURCE_DIR}/src/figure/service.c
${PROJECT_SOURCE_DIR}/src/figure/sound.c
${PROJECT_SOURCE_DIR}/src/figure/trader.c
${PROJECT_SOURCE_DIR}/src/figure/visited_buildings.c
)
set(FIGURETYPE_FILES
${PROJECT_SOURCE_DIR}/src/figuretype/animal.c
${PROJECT_SOURCE_DIR}/src/figuretype/cartpusher.c
${PROJECT_SOURCE_DIR}/src/figuretype/crime.c
${PROJECT_SOURCE_DIR}/src/figuretype/docker.c
${PROJECT_SOURCE_DIR}/src/figuretype/editor.c
${PROJECT_SOURCE_DIR}/src/figuretype/enemy.c
${PROJECT_SOURCE_DIR}/src/figuretype/entertainer.c
${PROJECT_SOURCE_DIR}/src/figuretype/depot.c
${PROJECT_SOURCE_DIR}/src/figuretype/maintenance.c
${PROJECT_SOURCE_DIR}/src/figuretype/migrant.c
${PROJECT_SOURCE_DIR}/src/figuretype/missile.c
${PROJECT_SOURCE_DIR}/src/figuretype/native.c
${PROJECT_SOURCE_DIR}/src/figuretype/service.c
${PROJECT_SOURCE_DIR}/src/figuretype/soldier.c
${PROJECT_SOURCE_DIR}/src/figuretype/supplier.c
${PROJECT_SOURCE_DIR}/src/figuretype/trader.c
${PROJECT_SOURCE_DIR}/src/figuretype/wall.c
${PROJECT_SOURCE_DIR}/src/figuretype/water.c
${PROJECT_SOURCE_DIR}/src/figuretype/workcamp.c
)
set(GAME_FILES
${PROJECT_SOURCE_DIR}/src/game/animation.c
${PROJECT_SOURCE_DIR}/src/game/cheats.c
${PROJECT_SOURCE_DIR}/src/game/difficulty.c
${PROJECT_SOURCE_DIR}/src/game/file.c
${PROJECT_SOURCE_DIR}/src/game/file_editor.c
${PROJECT_SOURCE_DIR}/src/game/file_io.c
${PROJECT_SOURCE_DIR}/src/game/game.c
${PROJECT_SOURCE_DIR}/src/game/mission.c
${PROJECT_SOURCE_DIR}/src/game/orientation.c
${PROJECT_SOURCE_DIR}/src/game/resource.c
${PROJECT_SOURCE_DIR}/src/game/settings.c
${PROJECT_SOURCE_DIR}/src/game/speed.c
${PROJECT_SOURCE_DIR}/src/game/state.c
${PROJECT_SOURCE_DIR}/src/game/tick.c
${PROJECT_SOURCE_DIR}/src/game/time.c
${PROJECT_SOURCE_DIR}/src/game/tutorial.c
${PROJECT_SOURCE_DIR}/src/game/undo.c
)
set(INPUT_FILES
${PROJECT_SOURCE_DIR}/src/input/cursor.c
${PROJECT_SOURCE_DIR}/src/input/hotkey.c
${PROJECT_SOURCE_DIR}/src/input/input.c
${PROJECT_SOURCE_DIR}/src/input/joystick.c
${PROJECT_SOURCE_DIR}/src/input/keyboard.c
${PROJECT_SOURCE_DIR}/src/input/keys.c
${PROJECT_SOURCE_DIR}/src/input/mouse.c
${PROJECT_SOURCE_DIR}/src/input/scroll.c
${PROJECT_SOURCE_DIR}/src/input/touch.c
${PROJECT_SOURCE_DIR}/src/input/zoom.c
)
set(MAP_FILES
${PROJECT_SOURCE_DIR}/src/map/aqueduct.c
${PROJECT_SOURCE_DIR}/src/map/bookmark.c
${PROJECT_SOURCE_DIR}/src/map/bridge.c
${PROJECT_SOURCE_DIR}/src/map/building.c
${PROJECT_SOURCE_DIR}/src/map/building_tiles.c
${PROJECT_SOURCE_DIR}/src/map/desirability.c
${PROJECT_SOURCE_DIR}/src/map/elevation.c
${PROJECT_SOURCE_DIR}/src/map/figure.c
${PROJECT_SOURCE_DIR}/src/map/grid.c
${PROJECT_SOURCE_DIR}/src/map/image.c
${PROJECT_SOURCE_DIR}/src/map/image_context.c
${PROJECT_SOURCE_DIR}/src/map/natives.c
${PROJECT_SOURCE_DIR}/src/map/orientation.c
${PROJECT_SOURCE_DIR}/src/map/point.c
${PROJECT_SOURCE_DIR}/src/map/property.c
${PROJECT_SOURCE_DIR}/src/map/random.c
${PROJECT_SOURCE_DIR}/src/map/ring.c
${PROJECT_SOURCE_DIR}/src/map/road_access.c
${PROJECT_SOURCE_DIR}/src/map/road_aqueduct.c
${PROJECT_SOURCE_DIR}/src/map/road_network.c
${PROJECT_SOURCE_DIR}/src/map/routing.c
${PROJECT_SOURCE_DIR}/src/map/routing_data.c
${PROJECT_SOURCE_DIR}/src/map/routing_path.c
${PROJECT_SOURCE_DIR}/src/map/routing_terrain.c
${PROJECT_SOURCE_DIR}/src/map/soldier_strength.c
${PROJECT_SOURCE_DIR}/src/map/sprite.c
${PROJECT_SOURCE_DIR}/src/map/terrain.c
${PROJECT_SOURCE_DIR}/src/map/tiles.c
${PROJECT_SOURCE_DIR}/src/map/water.c
${PROJECT_SOURCE_DIR}/src/map/water_supply.c
)
set(ASSETS_FILES
${PROJECT_SOURCE_DIR}/src/assets/group.c
${PROJECT_SOURCE_DIR}/src/assets/image.c
${PROJECT_SOURCE_DIR}/src/assets/layer.c
${PROJECT_SOURCE_DIR}/src/assets/assets.c
${PROJECT_SOURCE_DIR}/src/assets/xml.c
)
set(SCENARIO_FILES
${PROJECT_SOURCE_DIR}/src/scenario/building.c
${PROJECT_SOURCE_DIR}/src/scenario/criteria.c
${PROJECT_SOURCE_DIR}/src/scenario/custom_media.c
${PROJECT_SOURCE_DIR}/src/scenario/custom_messages_export_xml.c
${PROJECT_SOURCE_DIR}/src/scenario/custom_messages_import_xml.c
${PROJECT_SOURCE_DIR}/src/scenario/custom_messages.c
${PROJECT_SOURCE_DIR}/src/scenario/demand_change.c
${PROJECT_SOURCE_DIR}/src/scenario/distant_battle.c
${PROJECT_SOURCE_DIR}/src/scenario/earthquake.c
${PROJECT_SOURCE_DIR}/src/scenario/editor.c
${PROJECT_SOURCE_DIR}/src/scenario/editor_events.c
${PROJECT_SOURCE_DIR}/src/scenario/editor_map.c
${PROJECT_SOURCE_DIR}/src/scenario/emperor_change.c
${PROJECT_SOURCE_DIR}/src/scenario/empire.c
${PROJECT_SOURCE_DIR}/src/scenario/gladiator_revolt.c
${PROJECT_SOURCE_DIR}/src/scenario/invasion.c
${PROJECT_SOURCE_DIR}/src/scenario/map.c
${PROJECT_SOURCE_DIR}/src/scenario/message_media_text_blob.c
${PROJECT_SOURCE_DIR}/src/scenario/price_change.c
${PROJECT_SOURCE_DIR}/src/scenario/property.c
${PROJECT_SOURCE_DIR}/src/scenario/random_event.c
${PROJECT_SOURCE_DIR}/src/scenario/request.c
${PROJECT_SOURCE_DIR}/src/scenario/scenario.c
${PROJECT_SOURCE_DIR}/src/scenario/scenario_event.c
${PROJECT_SOURCE_DIR}/src/scenario/scenario_events_import_xml.c
${PROJECT_SOURCE_DIR}/src/scenario/scenario_events_export_xml.c
${PROJECT_SOURCE_DIR}/src/scenario/scenario_events_controller.c
${PROJECT_SOURCE_DIR}/src/scenario/scenario_events_parameter_data.c
${PROJECT_SOURCE_DIR}/src/scenario/action_types/action_handler.c
${PROJECT_SOURCE_DIR}/src/scenario/action_types/action_types.c
${PROJECT_SOURCE_DIR}/src/scenario/condition_types/comparison_helper.c
${PROJECT_SOURCE_DIR}/src/scenario/condition_types/condition_handler.c
${PROJECT_SOURCE_DIR}/src/scenario/condition_types/condition_types.c
)
set(GRAPHICS_FILES
${PROJECT_SOURCE_DIR}/src/graphics/arrow_button.c
${PROJECT_SOURCE_DIR}/src/graphics/button.c
${PROJECT_SOURCE_DIR}/src/graphics/clouds.c
${PROJECT_SOURCE_DIR}/src/graphics/font.c
${PROJECT_SOURCE_DIR}/src/graphics/generic_button.c
${PROJECT_SOURCE_DIR}/src/graphics/graphics.c
${PROJECT_SOURCE_DIR}/src/graphics/image.c
${PROJECT_SOURCE_DIR}/src/graphics/image_button.c
${PROJECT_SOURCE_DIR}/src/graphics/lang_text.c
${PROJECT_SOURCE_DIR}/src/graphics/menu.c
${PROJECT_SOURCE_DIR}/src/graphics/panel.c
${PROJECT_SOURCE_DIR}/src/graphics/rich_text.c
${PROJECT_SOURCE_DIR}/src/graphics/renderer.c
${PROJECT_SOURCE_DIR}/src/graphics/screen.c
${PROJECT_SOURCE_DIR}/src/graphics/screenshot.c
${PROJECT_SOURCE_DIR}/src/graphics/scrollbar.c
${PROJECT_SOURCE_DIR}/src/graphics/text.c
${PROJECT_SOURCE_DIR}/src/graphics/tooltip.c
${PROJECT_SOURCE_DIR}/src/graphics/video.c
${PROJECT_SOURCE_DIR}/src/graphics/warning.c
${PROJECT_SOURCE_DIR}/src/graphics/window.c
)
set(SOUND_FILES
${PROJECT_SOURCE_DIR}/src/sound/city.c
${PROJECT_SOURCE_DIR}/src/sound/effect.c
${PROJECT_SOURCE_DIR}/src/sound/music.c
${PROJECT_SOURCE_DIR}/src/sound/speech.c
${PROJECT_SOURCE_DIR}/src/sound/system.c
)
set(WIDGET_FILES
${PROJECT_SOURCE_DIR}/src/widget/city.c
${PROJECT_SOURCE_DIR}/src/widget/city_bridge.c
${PROJECT_SOURCE_DIR}/src/widget/city_building_ghost.c
${PROJECT_SOURCE_DIR}/src/widget/city_figure.c
${PROJECT_SOURCE_DIR}/src/widget/city_draw_highway.c
${PROJECT_SOURCE_DIR}/src/widget/city_overlay_education.c
${PROJECT_SOURCE_DIR}/src/widget/city_overlay_entertainment.c
${PROJECT_SOURCE_DIR}/src/widget/city_overlay_health.c
${PROJECT_SOURCE_DIR}/src/widget/city_overlay_other.c
${PROJECT_SOURCE_DIR}/src/widget/city_overlay_risks.c
${PROJECT_SOURCE_DIR}/src/widget/city_pause_menu.c
${PROJECT_SOURCE_DIR}/src/widget/city_water_ghost.c
${PROJECT_SOURCE_DIR}/src/widget/city_with_overlay.c
${PROJECT_SOURCE_DIR}/src/widget/city_without_overlay.c
${PROJECT_SOURCE_DIR}/src/widget/input_box.c
${PROJECT_SOURCE_DIR}/src/widget/map_editor.c
${PROJECT_SOURCE_DIR}/src/widget/map_editor_tool.c
${PROJECT_SOURCE_DIR}/src/widget/map_editor_pause_menu.c
${PROJECT_SOURCE_DIR}/src/widget/minimap.c
${PROJECT_SOURCE_DIR}/src/widget/top_menu.c
${PROJECT_SOURCE_DIR}/src/widget/top_menu_editor.c
${PROJECT_SOURCE_DIR}/src/widget/sidebar/city.c
${PROJECT_SOURCE_DIR}/src/widget/sidebar/common.c
${PROJECT_SOURCE_DIR}/src/widget/sidebar/editor.c
${PROJECT_SOURCE_DIR}/src/widget/sidebar/extra.c
${PROJECT_SOURCE_DIR}/src/widget/sidebar/military.c
${PROJECT_SOURCE_DIR}/src/widget/sidebar/slide.c
)
set(WINDOW_FILES
${PROJECT_SOURCE_DIR}/src/window/advisors.c
${PROJECT_SOURCE_DIR}/src/window/advisor/chief.c
${PROJECT_SOURCE_DIR}/src/window/advisor/education.c
${PROJECT_SOURCE_DIR}/src/window/advisor/entertainment.c
${PROJECT_SOURCE_DIR}/src/window/advisor/financial.c
${PROJECT_SOURCE_DIR}/src/window/advisor/health.c
${PROJECT_SOURCE_DIR}/src/window/advisor/housing.c
${PROJECT_SOURCE_DIR}/src/window/advisor/imperial.c
${PROJECT_SOURCE_DIR}/src/window/advisor/labor.c
${PROJECT_SOURCE_DIR}/src/window/advisor/military.c
${PROJECT_SOURCE_DIR}/src/window/advisor/population.c
${PROJECT_SOURCE_DIR}/src/window/advisor/ratings.c
${PROJECT_SOURCE_DIR}/src/window/advisor/religion.c
${PROJECT_SOURCE_DIR}/src/window/advisor/trade.c
${PROJECT_SOURCE_DIR}/src/window/asset_previewer.c
${PROJECT_SOURCE_DIR}/src/window/build_menu.c
${PROJECT_SOURCE_DIR}/src/window/building_info.c
${PROJECT_SOURCE_DIR}/src/window/building/common.c
${PROJECT_SOURCE_DIR}/src/window/building/culture.c
${PROJECT_SOURCE_DIR}/src/window/building/distribution.c
${PROJECT_SOURCE_DIR}/src/window/building/depot.c
${PROJECT_SOURCE_DIR}/src/window/building/figures.c
${PROJECT_SOURCE_DIR}/src/window/building/government.c
${PROJECT_SOURCE_DIR}/src/window/building/house.c
${PROJECT_SOURCE_DIR}/src/window/building/industry.c
${PROJECT_SOURCE_DIR}/src/window/building/military.c
${PROJECT_SOURCE_DIR}/src/window/building/terrain.c
${PROJECT_SOURCE_DIR}/src/window/building/utility.c
${PROJECT_SOURCE_DIR}/src/window/editor/allowed_buildings.c
${PROJECT_SOURCE_DIR}/src/window/editor/attributes.c
${PROJECT_SOURCE_DIR}/src/window/editor/build_menu.c
${PROJECT_SOURCE_DIR}/src/window/editor/custom_messages.c
${PROJECT_SOURCE_DIR}/src/window/editor/custom_variables.c
${PROJECT_SOURCE_DIR}/src/window/editor/demand_changes.c
${PROJECT_SOURCE_DIR}/src/window/editor/edit_demand_change.c
${PROJECT_SOURCE_DIR}/src/window/editor/edit_invasion.c
${PROJECT_SOURCE_DIR}/src/window/editor/edit_price_change.c
${PROJECT_SOURCE_DIR}/src/window/editor/edit_request.c
${PROJECT_SOURCE_DIR}/src/window/editor/empire.c
${PROJECT_SOURCE_DIR}/src/window/editor/invasions.c
${PROJECT_SOURCE_DIR}/src/window/editor/map.c
${PROJECT_SOURCE_DIR}/src/window/editor/price_changes.c
${PROJECT_SOURCE_DIR}/src/window/editor/requests.c
${PROJECT_SOURCE_DIR}/src/window/editor/scenario_events.c
${PROJECT_SOURCE_DIR}/src/window/editor/scenario_event_details.c
${PROJECT_SOURCE_DIR}/src/window/editor/scenario_action_edit.c
${PROJECT_SOURCE_DIR}/src/window/editor/scenario_condition_edit.c
${PROJECT_SOURCE_DIR}/src/window/editor/select_city_by_type.c
${PROJECT_SOURCE_DIR}/src/window/editor/select_city_trade_route.c
${PROJECT_SOURCE_DIR}/src/window/editor/select_custom_message.c
${PROJECT_SOURCE_DIR}/src/window/editor/select_scenario_action_type.c
${PROJECT_SOURCE_DIR}/src/window/editor/select_scenario_condition_type.c
${PROJECT_SOURCE_DIR}/src/window/editor/select_special_attribute_mapping.c
${PROJECT_SOURCE_DIR}/src/window/editor/special_events.c
${PROJECT_SOURCE_DIR}/src/window/editor/start_year.c
${PROJECT_SOURCE_DIR}/src/window/editor/starting_conditions.c
${PROJECT_SOURCE_DIR}/src/window/editor/win_criteria.c
${PROJECT_SOURCE_DIR}/src/window/cck_selection.c
${PROJECT_SOURCE_DIR}/src/window/city.c
${PROJECT_SOURCE_DIR}/src/window/config.c
${PROJECT_SOURCE_DIR}/src/window/console.c
${PROJECT_SOURCE_DIR}/src/window/donate_to_city.c
${PROJECT_SOURCE_DIR}/src/window/empire.c
${PROJECT_SOURCE_DIR}/src/window/file_dialog.c
${PROJECT_SOURCE_DIR}/src/window/gift_to_emperor.c
${PROJECT_SOURCE_DIR}/src/window/hold_games.c
${PROJECT_SOURCE_DIR}/src/window/hold_festival.c
${PROJECT_SOURCE_DIR}/src/window/hotkey_config.c
${PROJECT_SOURCE_DIR}/src/window/hotkey_editor.c
${PROJECT_SOURCE_DIR}/src/window/intermezzo.c
${PROJECT_SOURCE_DIR}/src/window/intro_video.c
${PROJECT_SOURCE_DIR}/src/window/labor_priority.c
${PROJECT_SOURCE_DIR}/src/window/logo.c
${PROJECT_SOURCE_DIR}/src/window/main_menu.c
${PROJECT_SOURCE_DIR}/src/window/message_dialog.c
${PROJECT_SOURCE_DIR}/src/window/message_list.c
${PROJECT_SOURCE_DIR}/src/window/military_menu.c
${PROJECT_SOURCE_DIR}/src/window/mission_briefing.c
${PROJECT_SOURCE_DIR}/src/window/mission_end.c
${PROJECT_SOURCE_DIR}/src/window/mission_selection.c
${PROJECT_SOURCE_DIR}/src/window/new_career.c
${PROJECT_SOURCE_DIR}/src/window/numeric_input.c
${PROJECT_SOURCE_DIR}/src/window/option_popup.c
${PROJECT_SOURCE_DIR}/src/window/overlay_menu.c
${PROJECT_SOURCE_DIR}/src/window/plain_message_dialog.c
${PROJECT_SOURCE_DIR}/src/window/popup_dialog.c
${PROJECT_SOURCE_DIR}/src/window/race_bet.c
${PROJECT_SOURCE_DIR}/src/window/resource_settings.c
${PROJECT_SOURCE_DIR}/src/window/select_list.c
${PROJECT_SOURCE_DIR}/src/window/set_salary.c
${PROJECT_SOURCE_DIR}/src/window/text_input.c
${PROJECT_SOURCE_DIR}/src/window/trade_opened.c
${PROJECT_SOURCE_DIR}/src/window/trade_prices.c
${PROJECT_SOURCE_DIR}/src/window/victory_dialog.c
${PROJECT_SOURCE_DIR}/src/window/victory_video.c
)
set(EDITOR_FILES
${PROJECT_SOURCE_DIR}/src/editor/editor.c
${PROJECT_SOURCE_DIR}/src/editor/tool.c
${PROJECT_SOURCE_DIR}/src/editor/tool_restriction.c
)
set(TRANSLATION_FILES
${PROJECT_SOURCE_DIR}/src/translation/czech.c
${PROJECT_SOURCE_DIR}/src/translation/english.c
${PROJECT_SOURCE_DIR}/src/translation/french.c
${PROJECT_SOURCE_DIR}/src/translation/german.c
${PROJECT_SOURCE_DIR}/src/translation/greek.c
${PROJECT_SOURCE_DIR}/src/translation/italian.c
${PROJECT_SOURCE_DIR}/src/translation/japanese.c
${PROJECT_SOURCE_DIR}/src/translation/korean.c
${PROJECT_SOURCE_DIR}/src/translation/polish.c
${PROJECT_SOURCE_DIR}/src/translation/portuguese.c
${PROJECT_SOURCE_DIR}/src/translation/russian.c
${PROJECT_SOURCE_DIR}/src/translation/simplified_chinese.c
${PROJECT_SOURCE_DIR}/src/translation/spanish.c
${PROJECT_SOURCE_DIR}/src/translation/swedish.c
${PROJECT_SOURCE_DIR}/src/translation/traditional_chinese.c
${PROJECT_SOURCE_DIR}/src/translation/translation.c
)
set(MACOSX_FILES "")
if(APPLE)
function(resource VAR SOURCE_PATH DESTINATION PATTERN)
file(GLOB_RECURSE _LIST CONFIGURE_DEPENDS ${SOURCE_PATH}/${PATTERN})
foreach (RESOURCE ${_LIST})
get_filename_component(_PARENT ${RESOURCE} DIRECTORY)
if (${_PARENT} STREQUAL ${SOURCE_PATH})
set(_DESTINATION ${DESTINATION})
else ()
file(RELATIVE_PATH _DESTINATION ${SOURCE_PATH} ${_PARENT})
set(_DESTINATION ${DESTINATION}/${_DESTINATION})
endif ()
set_property(SOURCE ${RESOURCE} PROPERTY MACOSX_PACKAGE_LOCATION ${_DESTINATION})
endforeach (RESOURCE)
set(${VAR} ${_LIST} PARENT_SCOPE)
endfunction()
resource(ASSET_SOURCES ${ASSETS_DIR} Resources/assets *)
set(MACOSX_FILES
${PROJECT_SOURCE_DIR}/res/augustus.icns
${ASSET_SOURCES}
)
endif()
set(EMSCRIPTEN_FILES "")
if(${TARGET_PLATFORM} STREQUAL "emscripten")
set(EMSCRIPTEN_FILES ${PROJECT_SOURCE_DIR}/res/shell.html)
endif()
set(SOURCE_FILES
${PLATFORM_FILES}
${CORE_FILES}
${BUILDING_FILES}
${CITY_FILES}
${EMPIRE_FILES}
${FIGURE_FILES}
${FIGURETYPE_FILES}
${GAME_FILES}
${INPUT_FILES}
${MAP_FILES}
${ASSETS_FILES}
${SCENARIO_FILES}
${GRAPHICS_FILES}
${SOUND_FILES}
${WIDGET_FILES}
${WINDOW_FILES}
${EDITOR_FILES}
${TRANSLATION_FILES}
${TINYFD_FILES}
${SPNG_FILES}
${SXML_FILES}
${ZIP_FILES}
${PROJECT_SOURCE_DIR}/res/augustus.rc
${MACOSX_FILES}
)
function(GET_SDL_EXT_DIR result module)
if(NOT module STREQUAL "")
set(module "_${module}")
endif()
set(SDL_LOCATION ${PROJECT_SOURCE_DIR}/ext/SDL2)
file(GLOB children
RELATIVE ${SDL_LOCATION}
CONFIGURE_DEPENDS
${SDL_LOCATION}/SDL${module}
${SDL_LOCATION}/SDL2${module}
${SDL_LOCATION}/SDL${module}-*
${SDL_LOCATION}/SDL2${module}-*
)
foreach(child ${children})
if(IS_DIRECTORY "${SDL_LOCATION}/${child}")
set(${result} "${SDL_LOCATION}/${child}" PARENT_SCOPE)
break()
endif()
endforeach()
endfunction()
if(${TARGET_PLATFORM} STREQUAL "emscripten")
set(USE_FLAGS "-s USE_SDL=2 -s USE_SDL_MIXER=2 -s SDL2_MIXER_FORMATS=[\"mp3\"] -s USE_MPG123=1")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${USE_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${USE_FLAGS}")
elseif(${TARGET_PLATFORM} STREQUAL "android")
find_package(SDL2 REQUIRED CONFIG)
string(TOLOWER ${CMAKE_BUILD_TYPE} ANDROID_BUILD_DIR)
set(SDL2_LIBRARY SDL2::SDL2)
set(SDL2_MIXER_LIBRARY SDL2::SDL2_mixer)
else()
find_package(SDL2 REQUIRED)
find_package(SDL2_mixer REQUIRED)
endif()
if(${TARGET_PLATFORM} STREQUAL "android")
add_library(${SHORT_NAME} SHARED ${SOURCE_FILES})
else()
add_executable(${SHORT_NAME} WIN32 ${SOURCE_FILES})
endif()
if(${TARGET_PLATFORM} STREQUAL "emscripten")
set(CMAKE_EXECUTABLE_SUFFIX .html)
set_target_properties(${SHORT_NAME} PROPERTIES LINK_FLAGS "-lidbfs.js -s SINGLE_FILE=1 -s DEMANGLE_SUPPORT=1 -s DYNCALLS=1 --shell-file ${PROJECT_SOURCE_DIR}/res/shell.html --embed-file ${ASSETS_DIR}@/assets -s INITIAL_MEMORY=268435456 -s ALLOW_MEMORY_GROWTH=1 -s DISABLE_DEPRECATED_FIND_EVENT_TARGET_BEHAVIOR=0 -s SAFE_HEAP=1 -s INVOKE_RUN=0 -s EXPORTED_FUNCTIONS=[\"_main\"] -s EXPORTED_RUNTIME_METHODS=[\"callMain\",\"FS\"] -s DEFAULT_LIBRARY_FUNCS_TO_INCLUDE=[\"$autoResumeAudioContext\"] --bind")
endif()
if(MSVC)
add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
string(REGEX REPLACE "/W3" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
set_source_files_properties(${EXPAT_FILES} PROPERTIES COMPILE_FLAGS "/W3")
set_source_files_properties(${SOURCE_FILES} PROPERTIES COMPILE_FLAGS "/W4")
set_source_files_properties(${PROJECT_SOURCE_DIR}/res/augustus.rc PROPERTIES COMPILE_FLAGS "")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /utf-8 /wd4100 /wd4244")
endif()
# Show debug info on crash on 32 bit builds compiled with MinGW
if(MINGW AND CMAKE_SIZEOF_VOID_P EQUAL 4 AND CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-omit-frame-pointer")
endif()
if(CMAKE_INSTALL_DATADIR)
add_compile_definitions(CUSTOM_ASSETS_DIR="${CMAKE_INSTALL_DATADIR}")
endif()
if(APPLE)
# generating a macOS icns file (see https://stackoverflow.com/a/20703594)
add_custom_command(OUTPUT ${PROJECT_SOURCE_DIR}/res/augustus.icns
COMMAND mkdir -p augustus.iconset
COMMAND sips -z 16 16 augustus_256.png --out augustus.iconset/icon_16x16.png
COMMAND sips -z 32 32 augustus_256.png --out augustus.iconset/icon_16x16@2x.png
COMMAND sips -z 32 32 augustus_256.png --out augustus.iconset/icon_32x32.png
COMMAND sips -z 64 64 augustus_256.png --out augustus.iconset/icon_32x32@2x.png
COMMAND sips -z 128 128 augustus_256.png --out augustus.iconset/icon_128x128.png
COMMAND sips -z 256 256 augustus_256.png --out augustus.iconset/icon_128x128@2x.png
COMMAND sips -z 256 256 augustus_256.png --out augustus.iconset/icon_256x256.png
COMMAND sips -z 512 512 augustus_512.png --out augustus.iconset/icon_256x256@2x.png
COMMAND iconutil -c icns augustus.iconset
COMMAND rm -R augustus.iconset
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/res)
set_source_files_properties(${PROJECT_SOURCE_DIR}/res/augustus.icns PROPERTIES
MACOSX_PACKAGE_LOCATION "Resources")
# setting variables that will populate Info.plist
set(MACOSX_BUNDLE_GUI_IDENTIFIER "pl.Keriew.augustus")
set(MACOSX_BUNDLE_BUNDLE_NAME ${USER_FRIENDLY_NAME})
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.11" CACHE STRING "Minimum OS X deployment version" FORCE)
set(MACOSX_BUNDLE_ICON_FILE "augustus.icns")
set(MACOSX_BUNDLE_BUNDLE_VERSION
"${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}${VERSION_REVISION}")
set(MACOSX_BUNDLE_LONG_VERSION_STRING ${MACOSX_BUNDLE_BUNDLE_VERSION})
set(MACOSX_BUNDLE_SHORT_VERSION_STRING ${MACOSX_BUNDLE_BUNDLE_VERSION})
set_target_properties(${SHORT_NAME} PROPERTIES
MACOSX_BUNDLE TRUE
MACOSX_BUNDLE_INFO_PLIST "${PROJECT_SOURCE_DIR}/res/macos/Info.plist")
set(DIRS "")
set(LIBS "")
# if SDL2 library is a framework, we need to indicate to CMake
# the path to its dependencies. SDL2_LIBRARY contains two parts.
# Example: /Library/Frameworks/SDL2.framework;-framework Cocoa
# So strip out everything after the ';'
string(REGEX REPLACE ";.*$" "" SDL2_LIB_DIR "${SDL2_LIBRARY}")
if(EXISTS "${SDL2_LIB_DIR}/Versions/A/Frameworks")
list(APPEND DIRS "${SDL2_LIB_DIR}/Versions/A/Frameworks")
endif()
# if SDL2_mixer library is a framework, we need to indicate to CMake
# the path to its dependencies (Ogg.framework etc):
if(EXISTS "${SDL2_MIXER_LIBRARY}/Versions/A/Frameworks")
list(APPEND DIRS "${SDL2_MIXER_LIBRARY}/Versions/A/Frameworks")
endif()
# when installing, "fixup" automatically copies libraries inside the
# bundle and links the binary against them
install(CODE "
include(BundleUtilities)
fixup_bundle(${CMAKE_BINARY_DIR}/${PROJECT_NAME}.app \"${LIBS}\" \"${DIRS}\")
" BUNDLE DESTINATION ${CMAKE_BINARY_DIR})
# perform ad-hoc codesigning
set(codesignCommand "codesign --verbose=4 --force --deep --options=runtime --timestamp=none --sign -")
set(codesignCommandWithEntitlements "${codesignCommand} --entitlements \"${PROJECT_SOURCE_DIR}/res/macos/Entitlements.plist\"")
install(CODE "
execute_process(COMMAND
${codesignCommandWithEntitlements} \"${CMAKE_BINARY_DIR}/${PROJECT_NAME}.app/Contents/MacOS/${PROJECT_NAME}\"
)
")
endif()
if(SDL2_INCLUDE_DIR)
include_directories(SYSTEM ${SDL2_INCLUDE_DIR})
endif()
if(SDL2_MIXER_INCLUDE_DIR)
include_directories(SYSTEM ${SDL2_MIXER_INCLUDE_DIR})
endif()
if(${TARGET_PLATFORM} STREQUAL "vita")
include_directories(SYSTEM
$ENV{VITASDK}/arm-vita-eabi/include
${CMAKE_CURRENT_SOURCE_DIR}
)
endif()
include_directories(SYSTEM ext)
include_directories(src)
if(MSVC)
include_directories(SYSTEM ext/dirent)
endif()
if(${TARGET_PLATFORM} STREQUAL "vita")
target_link_libraries(${SHORT_NAME}
${SDL2_MIXER_LIBRARY}
${SDL2_LIBRARY}
vorbisfile
vorbis
mikmod
xmp
modplug
mpg123
FLAC
ogg
opusfile
opus
stdc++
m
SceAppUtil_stub
SceAudio_stub
SceAudioIn_stub
SceCommonDialog_stub
SceCtrl_stub
SceDisplay_stub
SceGxm_stub
SceHid_stub
SceMotion_stub
SceIofilemgr_stub
SceMotion_stub
SceSysmodule_stub
SceTouch_stub
ScePower_stub
ScePgf_stub
SceAppMgr_stub
)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D__vita__")
# this setting enables larger heap memory sizes on Vita, up to ~330 MB
# useful for pre-loading videos into memory
set(VITA_MKSFOEX_FLAGS "${VITA_MKSFOEX_FLAGS} -d ATTRIBUTE2=12")
vita_create_self(${SHORT_NAME}.self ${SHORT_NAME} UNSAFE UNCOMPRESSED)
vita_create_vpk(${SHORT_NAME}.vpk ${VITA_TITLEID} ${SHORT_NAME}.self
VERSION ${VITA_VERSION}
NAME ${SHORT_NAME}
FILE res/vita/icon0.png sce_sys/icon0.png
FILE res/vita/pic0.png sce_sys/pic0.png
FILE res/vita/bg.png sce_sys/livearea/contents/bg.png
FILE res/vita/startup.png sce_sys/livearea/contents/startup.png
FILE res/vita/template.xml sce_sys/livearea/contents/template.xml
FILE ${ASSETS_DIR} assets
)
elseif(NINTENDO_SWITCH)
pkg_check_modules(SDL2 REQUIRED IMPORTED_TARGET sdl2 SDL2_mixer)
target_link_libraries(${SHORT_NAME} PkgConfig::SDL2)
nx_generate_nacp (${PROJECT_NAME}.nacp
NAME "Augustus"
AUTHOR "Keriew"
)
nx_create_nro (${PROJECT_NAME}
NACP ${PROJECT_NAME}.nacp
ICON ${CMAKE_SOURCE_DIR}/res/switch/icon0.jpg
ROMFS ${ASSETS_DIR}
)
else()
if (UNIX AND NOT APPLE AND (CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang"))
target_link_libraries(${SHORT_NAME} m)
endif()
if(${TARGET_PLATFORM} STREQUAL "android")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_BSD_SOURCE")
find_library(log-lib log)
find_library(android-lib android)
target_link_libraries(${SHORT_NAME} ${log-lib} ${android-lib})
endif()
target_link_libraries(${SHORT_NAME} ${SDL2_LIBRARY} ${SDL2_MIXER_LIBRARY})
if(NOT APPLE AND NOT ${TARGET_PLATFORM} STREQUAL "android")
install(TARGETS ${SHORT_NAME} RUNTIME DESTINATION bin)
endif()
if(WIN32)
target_link_libraries(${SHORT_NAME} dbghelp shlwapi)
endif()
if(UNIX AND NOT APPLE)
install(FILES "res/augustus.desktop" DESTINATION "share/applications" RENAME "com.github.keriew.augustus.desktop")
install(FILES "res/augustus.metainfo.xml" DESTINATION "share/metainfo" RENAME "com.github.keriew.augustus.metainfo.xml")
install(FILES "res/augustus_32.png" DESTINATION "share/icons/hicolor/32x32/apps" RENAME "com.github.keriew.augustus.png")
install(FILES "res/augustus_48.png" DESTINATION "share/icons/hicolor/48x48/apps" RENAME "com.github.keriew.augustus.png")
install(FILES "res/augustus_256.png" DESTINATION "share/icons/hicolor/256x256/apps" RENAME "com.github.keriew.augustus.png")
install(FILES "res/augustus_512.png" DESTINATION "share/icons/hicolor/512x512/apps" RENAME "com.github.keriew.augustus.png")
install(DIRECTORY "${ASSETS_DIR}/" DESTINATION "share/augustus-game/assets")
endif()
endif()