-
Notifications
You must be signed in to change notification settings - Fork 317
/
CMakeLists.txt
853 lines (796 loc) · 34.4 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
cmake_minimum_required(VERSION 3.1)
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(SYSTEM_LIBS "Use system libraries when available." ON)
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 julius)
set(USER_FRIENDLY_NAME Julius)
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 "JULIUS001")
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(CMAKE_C_FLAGS "-Walloc-zero -Wdouble-promotion -Wduplicated-branches -Wduplicated-cond -Wformat=2 -Wformat-signedness -Winit-self -Wlogical-op -Wmissing-declarations -Wmissing-prototypes -Wundef -Wunused-macros -Wwrite-strings ${CMAKE_C_FLAGS}")
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 1)
set(PROJECT_VERSION_MINOR 7)
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 --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()
set(TINYFD_FILES
ext/tinyfiledialogs/tinyfiledialogs.c
)
set(PNG_FILES
ext/png/png.c
ext/png/pngerror.c
ext/png/pngmem.c
ext/png/pngset.c
ext/png/pngwio.c
ext/png/pngwrite.c
ext/png/pngwutil.c
)
set(ZLIB_FILES
ext/zlib/adler32.c
ext/zlib/crc32.c
ext/zlib/deflate.c
ext/zlib/trees.c
ext/zlib/zutil.c
)
set(PLATFORM_FILES
${PROJECT_SOURCE_DIR}/src/platform/arguments.c
${PROJECT_SOURCE_DIR}/src/platform/cursor.c
${PROJECT_SOURCE_DIR}/src/platform/file_manager.c
${PROJECT_SOURCE_DIR}/src/platform/file_manager_cache.c
${PROJECT_SOURCE_DIR}/src/platform/joystick.c
${PROJECT_SOURCE_DIR}/src/platform/julius.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/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/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/switch/switch.c
)
elseif (${TARGET_PLATFORM} STREQUAL "android")
set(PLATFORM_FILES
${PLATFORM_FILES}
${PROJECT_SOURCE_DIR}/src/platform/android/android.c
)
endif()
set(CORE_FILES
${PROJECT_SOURCE_DIR}/src/core/backtrace.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/io.c
${PROJECT_SOURCE_DIR}/src/core/lang.c
${PROJECT_SOURCE_DIR}/src/core/locale.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/zip.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/building_state.c
${PROJECT_SOURCE_DIR}/src/building/clone.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/destruction.c
${PROJECT_SOURCE_DIR}/src/building/dock.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/industry.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/model.c
${PROJECT_SOURCE_DIR}/src/building/properties.c
${PROJECT_SOURCE_DIR}/src/building/storage.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/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/ratings.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/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/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/route.c
${PROJECT_SOURCE_DIR}/src/figure/service.c
${PROJECT_SOURCE_DIR}/src/figure/sound.c
${PROJECT_SOURCE_DIR}/src/figure/trader.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/maintenance.c
${PROJECT_SOURCE_DIR}/src/figuretype/market.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/trader.c
${PROJECT_SOURCE_DIR}/src/figuretype/wall.c
${PROJECT_SOURCE_DIR}/src/figuretype/water.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
)
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(SCENARIO_FILES
${PROJECT_SOURCE_DIR}/src/scenario/building.c
${PROJECT_SOURCE_DIR}/src/scenario/criteria.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/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
)
set(GRAPHICS_FILES
${PROJECT_SOURCE_DIR}/src/graphics/arrow_button.c
${PROJECT_SOURCE_DIR}/src/graphics/button.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/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_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_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/minimap.c
${PROJECT_SOURCE_DIR}/src/widget/scenario_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/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/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/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/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/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/difficulty_options.c
${PROJECT_SOURCE_DIR}/src/window/display_options.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_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/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/resource_settings.c
${PROJECT_SOURCE_DIR}/src/window/select_list.c
${PROJECT_SOURCE_DIR}/src/window/set_salary.c
${PROJECT_SOURCE_DIR}/src/window/sound_options.c
${PROJECT_SOURCE_DIR}/src/window/speed_options.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)
set(MACOSX_FILES ${PROJECT_SOURCE_DIR}/res/julius.icns)
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}
${SCENARIO_FILES}
${GRAPHICS_FILES}
${SOUND_FILES}
${WIDGET_FILES}
${WINDOW_FILES}
${EDITOR_FILES}
${TRANSLATION_FILES}
${TINYFD_FILES}
${PROJECT_SOURCE_DIR}/res/julius.rc
${MACOSX_FILES}
${EMSCRIPTEN_FILES}
)
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}")
else()
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()
find_package(SDL2 REQUIRED)
find_package(SDL2_mixer REQUIRED)
endif()
if(${TARGET_PLATFORM} STREQUAL "android")
add_library(${SHORT_NAME} SHARED ${SDL2_ANDROID_HOOK} ${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 -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\"]' --bind")
endif()
if(MSVC)
add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /utf-8")
endif()
if(APPLE)
# generating a macOS icns file (see https://stackoverflow.com/a/20703594)
add_custom_command(OUTPUT ${PROJECT_SOURCE_DIR}/res/julius.icns
COMMAND mkdir -p julius.iconset
COMMAND sips -z 16 16 julius_256.png --out julius.iconset/icon_16x16.png
COMMAND sips -z 32 32 julius_256.png --out julius.iconset/[email protected]
COMMAND sips -z 32 32 julius_256.png --out julius.iconset/icon_32x32.png
COMMAND sips -z 64 64 julius_256.png --out julius.iconset/[email protected]
COMMAND sips -z 128 128 julius_256.png --out julius.iconset/icon_128x128.png
COMMAND sips -z 256 256 julius_256.png --out julius.iconset/[email protected]
COMMAND sips -z 256 256 julius_256.png --out julius.iconset/icon_256x256.png
COMMAND sips -z 512 512 julius_512.png --out julius.iconset/[email protected]
COMMAND iconutil -c icns julius.iconset
COMMAND rm -R julius.iconset
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/res)
set_source_files_properties(${PROJECT_SOURCE_DIR}/res/julius.icns PROPERTIES
MACOSX_PACKAGE_LOCATION "Resources")
# setting variables that will populate Info.plist
set(MACOSX_BUNDLE_GUI_IDENTIFIER "com.github.bvschaik.julius")
set(MACOSX_BUNDLE_BUNDLE_NAME ${USER_FRIENDLY_NAME})
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.10" CACHE STRING "Minimum OS X deployment version" FORCE)
set(MACOSX_BUNDLE_ICON_FILE "julius.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(SYSTEM_LIBS)
find_package(PNG)
endif()
if(PNG_FOUND)
include_directories(SYSTEM ${PNG_INCLUDE_DIRS})
target_link_libraries(${SHORT_NAME} ${PNG_LIBRARIES})
else()
if(SYSTEM_LIBS)
message(STATUS "PNG was not found but that's ok: falling back to internal version")
endif()
include_directories(SYSTEM "ext/png")
target_sources(${SHORT_NAME} PRIVATE "${PNG_FILES}" "${ZLIB_FILES}")
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/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
)
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 "Julius"
AUTHOR "Bianca van Schaik"
)
nx_create_nro (${PROJECT_NAME}
NACP ${PROJECT_NAME}.nacp
ICON ${CMAKE_SOURCE_DIR}/res/switch/icon0.jpg
)
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")
find_library(LOG_LIB log)
target_link_libraries(${SHORT_NAME} ${LOG_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(UNIX AND NOT APPLE)
install(FILES "res/julius.desktop" DESTINATION "share/applications" RENAME "com.github.bvschaik.julius.desktop")
install(FILES "res/julius.metainfo.xml" DESTINATION "share/metainfo" RENAME "com.github.bvschaik.julius.metainfo.xml")
install(FILES "res/julius_32.png" DESTINATION "share/icons/hicolor/32x32/apps" RENAME "com.github.bvschaik.julius.png")
install(FILES "res/julius_48.png" DESTINATION "share/icons/hicolor/48x48/apps" RENAME "com.github.bvschaik.julius.png")
install(FILES "res/julius_256.png" DESTINATION "share/icons/hicolor/256x256/apps" RENAME "com.github.bvschaik.julius.png")
install(FILES "res/julius_512.png" DESTINATION "share/icons/hicolor/512x512/apps" RENAME "com.github.bvschaik.julius.png")
endif()
# Unit tests
if(${TARGET_PLATFORM} STREQUAL "default")
enable_testing()
add_subdirectory(test)
endif()
endif()