forked from softdorothy/GliderPRO
-
Notifications
You must be signed in to change notification settings - Fork 9
/
CMakeLists.txt
736 lines (664 loc) · 18.9 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
cmake_minimum_required(VERSION 3.10)
project (Aerofoil)
SET(PLATFORM "X" CACHE STRING "Defines the target platform")
SET(EXECNAME "AerofoilX" CACHE STRING "Defines the exec name")
message(${CMAKE_BINARY_DIR})
# Use Release build type by default
if("${CMAKE_BUILD_TYPE}" STREQUAL "")
set(CMAKE_BUILD_TYPE Release)
message("Build type unspecified, using Release")
endif()
# Enable LTO by default if supported
if("${CMAKE_INTERPROCEDURAL_OPTIMIZATION}" STREQUAL "")
include(CheckIPOSupported)
check_ipo_supported(RESULT IPO_SUPPORTED)
if(IPO_SUPPORTED)
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION On)
message("Compiler supports LTO, enabling automatically")
endif()
endif()
# FIXME: Clang treats this as an error by default; fixing the source rather
# than downgrading the error to a warning would be a better solution.
add_compile_options(
$<$<COMPILE_LANG_AND_ID:CXX,AppleClang,Clang>:-Wno-error=c++11-narrowing>
)
find_package(SDL2 REQUIRED)
if(PLATFORM STREQUAL "MAC")
SET(EXECNAME "AerofoilMac" CACHE STRING "Defines the exec name" FORCE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
add_definitions(-D__MACOS__)
endif()
message("Building ${EXECNAME} for: ${PLATFORM}")
add_definitions(-DGP_DEBUG_CONFIG=0)
add_definitions(-DNDEBUG=1)
add_library(stb STATIC
stb/stb_image_write.c
)
add_library(zlib STATIC
zlib/adler32.c
zlib/crc32.c
zlib/deflate.c
zlib/inffast.c
zlib/inflate.c
zlib/inftrees.c
zlib/trees.c
zlib/zutil.c
)
add_library(MacRomanConversion STATIC
MacRomanConversion/MacRomanConversion.cpp
)
add_library(PortabilityLayer STATIC
PortabilityLayer/AntiAliasTable.cpp
PortabilityLayer/AppEventHandler.cpp
PortabilityLayer/BinHex4.cpp
PortabilityLayer/BitmapImage.cpp
PortabilityLayer/ByteSwap.cpp
PortabilityLayer/CFileStream.cpp
PortabilityLayer/CompositeRenderedFont.cpp
PortabilityLayer/DeflateCodec.cpp
PortabilityLayer/DialogManager.cpp
PortabilityLayer/DisplayDeviceManager.cpp
PortabilityLayer/EllipsePlotter.cpp
PortabilityLayer/FileBrowserUI.cpp
PortabilityLayer/FileManager.cpp
PortabilityLayer/FileSectionStream.cpp
PortabilityLayer/FontFamily.cpp
PortabilityLayer/FontManager.cpp
PortabilityLayer/FontRenderer.cpp
PortabilityLayer/GPArchive.cpp
PortabilityLayer/HostSuspendHook.cpp
PortabilityLayer/IconLoader.cpp
PortabilityLayer/InflateStream.cpp
PortabilityLayer/InputManager.cpp
PortabilityLayer/LinePlotter.cpp
PortabilityLayer/MacBinary2.cpp
PortabilityLayer/MacFileInfo.cpp
PortabilityLayer/MacFileMem.cpp
PortabilityLayer/MemoryManager.cpp
PortabilityLayer/MemReaderStream.cpp
PortabilityLayer/MenuManager.cpp
PortabilityLayer/MMHandleBlock.cpp
PortabilityLayer/PLApplication.cpp
PortabilityLayer/PLButtonWidget.cpp
PortabilityLayer/PLControlDefinitions.cpp
PortabilityLayer/PLCore.cpp
PortabilityLayer/PLCTabReducer.cpp
PortabilityLayer/PLDialogs.cpp
PortabilityLayer/PLDrivers.cpp
PortabilityLayer/PLEditboxWidget.cpp
PortabilityLayer/PLEventQueue.cpp
PortabilityLayer/PLHacks.cpp
PortabilityLayer/PLHandle.cpp
PortabilityLayer/PLIconWidget.cpp
PortabilityLayer/PLImageWidget.cpp
PortabilityLayer/PLInvisibleWidget.cpp
PortabilityLayer/PLKeyEncoding.cpp
PortabilityLayer/PLLabelWidget.cpp
PortabilityLayer/PLMenus.cpp
PortabilityLayer/PLMovies.cpp
PortabilityLayer/PLNumberFormatting.cpp
PortabilityLayer/PLPopupMenuWidget.cpp
PortabilityLayer/PLQDOffscreen.cpp
PortabilityLayer/PLQDraw.cpp
PortabilityLayer/PLResourceManager.cpp
PortabilityLayer/PLResources.cpp
PortabilityLayer/PLScrollBarWidget.cpp
PortabilityLayer/PLSound.cpp
PortabilityLayer/PLStandardColors.cpp
PortabilityLayer/PLStringCompare.cpp
PortabilityLayer/PLSysCalls.cpp
PortabilityLayer/PLTimeTaggedVOSEvent.cpp
PortabilityLayer/PLWidgets.cpp
PortabilityLayer/QDGraf.cpp
PortabilityLayer/QDManager.cpp
PortabilityLayer/QDPictDecoder.cpp
PortabilityLayer/QDPictEmitContext.cpp
PortabilityLayer/QDPictHeader.cpp
PortabilityLayer/QDPixMap.cpp
PortabilityLayer/QDPort.cpp
PortabilityLayer/QDStandardPalette.cpp
PortabilityLayer/RandomNumberGenerator.cpp
PortabilityLayer/ResolveCachingColor.cpp
PortabilityLayer/ResourceCompiledRef.cpp
PortabilityLayer/ResourceFile.cpp
PortabilityLayer/ScanlineMask.cpp
PortabilityLayer/ScanlineMaskBuilder.cpp
PortabilityLayer/ScanlineMaskConverter.cpp
PortabilityLayer/ScanlineMaskIterator.cpp
PortabilityLayer/SimpleGraphic.cpp
PortabilityLayer/TextPlacer.cpp
PortabilityLayer/UTF8.cpp
PortabilityLayer/WindowDef.cpp
PortabilityLayer/WindowManager.cpp
PortabilityLayer/WorkerThread.cpp
PortabilityLayer/XModemCRC.cpp
PortabilityLayer/ZipFileProxy.cpp
)
target_include_directories(PortabilityLayer PRIVATE
Common
GpCommon
PortabilityLayer
zlib
rapidjson/include
MacRomanConversion
stb
)
target_compile_options(PortabilityLayer PRIVATE -Wno-multichar)
target_link_libraries(PortabilityLayer PRIVATE zlib MacRomanConversion stb)
add_library(GpShell STATIC
GpShell/GpAppEnvironment.cpp
GpShell/GpAudioDriverFactory.cpp
GpShell/GpDisplayDriverFactory.cpp
GpShell/GpFontHandlerFactory.cpp
GpShell/GpGlobalConfig.cpp
GpShell/GpInputDriverFactory.cpp
GpShell/GpMain.cpp
GpShell/GpVOSEventQueue.cpp
)
target_include_directories(GpShell PRIVATE
Common
GpCommon
PortabilityLayer
)
add_library(GpApp STATIC
GpApp/About.cpp
GpApp/AnimCursor.cpp
GpApp/AppleEvents.cpp
GpApp/Banner.cpp
GpApp/ColorUtils.cpp
GpApp/Coordinates.cpp
GpApp/DialogUtils.cpp
GpApp/DynamicMaps.cpp
GpApp/Dynamics.cpp
GpApp/Dynamics2.cpp
GpApp/Dynamics3.cpp
GpApp/Environ.cpp
GpApp/Events.cpp
GpApp/FileError.cpp
GpApp/GameOver.cpp
GpApp/GpAppInterface.cpp
GpApp/Grease.cpp
GpApp/HighScores.cpp
GpApp/House.cpp
GpApp/HouseInfo.cpp
GpApp/HouseIO.cpp
GpApp/HouseLegal.cpp
GpApp/Input.cpp
GpApp/Interactions.cpp
GpApp/InterfaceInit.cpp
GpApp/Link.cpp
GpApp/Main.cpp
GpApp/MainMenuUI.cpp
GpApp/MainWindow.cpp
GpApp/Map.cpp
GpApp/Marquee.cpp
GpApp/Menu.cpp
GpApp/Modes.cpp
GpApp/Music.cpp
GpApp/ObjectAdd.cpp
GpApp/ObjectDraw.cpp
GpApp/ObjectDraw2.cpp
GpApp/ObjectDrawAll.cpp
GpApp/ObjectEdit.cpp
GpApp/ObjectInfo.cpp
GpApp/ObjectRects.cpp
GpApp/Objects.cpp
GpApp/Play.cpp
GpApp/Player.cpp
GpApp/Prefs.cpp
GpApp/RectUtils.cpp
GpApp/Render.cpp
GpApp/Room.cpp
GpApp/RoomGraphics.cpp
GpApp/RoomInfo.cpp
GpApp/RubberBands.cpp
GpApp/SavedGames.cpp
GpApp/Scoreboard.cpp
GpApp/Scrap.cpp
GpApp/SelectHouse.cpp
GpApp/Settings.cpp
GpApp/Sound.cpp
GpApp/SoundSync_Cpp11.cpp
GpApp/SourceExport.cpp
GpApp/StringUtils.cpp
GpApp/StructuresInit.cpp
GpApp/StructuresInit2.cpp
GpApp/Tools.cpp
GpApp/Transit.cpp
GpApp/Transitions.cpp
GpApp/Triggers.cpp
GpApp/Trip.cpp
GpApp/Utilities.cpp
GpApp/WindowUtils.cpp
)
target_compile_options(GpApp PRIVATE -Wno-multichar)
target_include_directories(GpApp PRIVATE
Common
GpCommon
PortabilityLayer
)
target_link_libraries(GpApp PRIVATE PortabilityLayer)
if(CMAKE_HOST_UNIX)
set(EXEC_SOURCES
AerofoilPortable/GpSystemServices_POSIX.cpp
AerofoilPortable/GpThreadEvent_Cpp11.cpp
AerofoilPortable/GpAllocator_C.cpp
AerofoilSDL/GpAudioDriver_SDL2.cpp
AerofoilSDL/GpDisplayDriver_SDL_GL2.cpp
AerofoilSDL/GpInputDriver_SDL_Gamepad.cpp
AerofoilSDL/ShaderCode/CopyQuadP.cpp
AerofoilSDL/ShaderCode/DrawQuad32P.cpp
AerofoilSDL/ShaderCode/DrawQuadPaletteP.cpp
AerofoilSDL/ShaderCode/DrawQuadV.cpp
AerofoilSDL/ShaderCode/ScaleQuadP.cpp
AerofoilX/GpMain_SDL_X.cpp
AerofoilX/GpLogDriver_X.cpp
AerofoilX/GpSystemServices_X.cpp
AerofoilX/GpFileSystem_X.cpp
)
set(EXEC_LIBS
${SDL2_LIBRARIES}
GpApp
GpShell
PortabilityLayer
)
set(EXEC_INC_DIRS
Common
GpCommon
GpShell
AerofoilSDL
AerofoilPortable
PortabilityLayer
${SDL2_INCLUDE_DIRS}
)
if(PLATFORM STREQUAL "MAC")
list(APPEND EXEC_SOURCES
AerofoilMac/AerofoilMac/AerofoilApplication.mm
AerofoilMac/AerofoilMac/MacInit.mm
)
list(APPEND EXEC_INC_DIRS
AerofoilMac/AerofoilMac
)
list(APPEND EXEC_LIBS
"-framework Cocoa"
)
endif(PLATFORM STREQUAL "MAC")
add_executable(${EXECNAME} ${EXEC_SOURCES})
target_include_directories(${EXECNAME} PRIVATE ${EXEC_INC_DIRS})
target_link_libraries(${EXECNAME} ${EXEC_LIBS})
endif()
add_executable(flattenmov EXCLUDE_FROM_ALL flattenmov/flattenmov.cpp AerofoilPortable/GpAllocator_C.cpp)
target_include_directories(flattenmov PRIVATE
Common
GpCommon
PortabilityLayer
AerofoilPortable
)
target_link_libraries(flattenmov PortabilityLayer)
add_executable(bin2gp EXCLUDE_FROM_ALL bin2gp/bin2gp.cpp AerofoilPortable/GpAllocator_C.cpp)
target_include_directories(bin2gp PRIVATE
Common
GpCommon
PortabilityLayer
AerofoilPortable
)
target_link_libraries(bin2gp PortabilityLayer)
add_executable(hqx2bin EXCLUDE_FROM_ALL hqx2bin/hqx2bin.cpp AerofoilPortable/GpAllocator_C.cpp)
target_include_directories(hqx2bin PRIVATE
Common
GpCommon
PortabilityLayer
AerofoilPortable
)
target_link_libraries(hqx2bin PortabilityLayer)
add_executable(hqx2gp EXCLUDE_FROM_ALL
hqx2gp/hqx2gp.cpp
AerofoilPortable/GpAllocator_C.cpp
WindowsUnicodeToolShim/UnixUnicodeToolShim.cpp
)
target_include_directories(hqx2gp PRIVATE
Common
GpCommon
PortabilityLayer
AerofoilPortable
WindowsUnicodeToolShim
)
target_link_libraries(hqx2gp PortabilityLayer)
add_executable(gpr2gpa EXCLUDE_FROM_ALL
gpr2gpa/gpr2gpa.cpp
gpr2gpa/macedec.cpp
AerofoilPortable/GpAllocator_C.cpp
WindowsUnicodeToolShim/UnixUnicodeToolShim.cpp
)
target_include_directories(gpr2gpa PRIVATE
Common
GpCommon
PortabilityLayer
AerofoilPortable
MacRomanConversion
WindowsUnicodeToolShim
rapidjson/include
zlib
)
target_link_libraries(gpr2gpa PortabilityLayer MacRomanConversion zlib)
add_executable(MakeTimestamp EXCLUDE_FROM_ALL
MakeTimestamp/MakeTimestamp.cpp
WindowsUnicodeToolShim/UnixUnicodeToolShim.cpp
)
target_include_directories(MakeTimestamp PRIVATE PortabilityLayer WindowsUnicodeToolShim)
target_link_libraries(MakeTimestamp PortabilityLayer)
add_executable(FTagData EXCLUDE_FROM_ALL
FTagData/FTagData.cpp
WindowsUnicodeToolShim/UnixUnicodeToolShim.cpp
)
target_include_directories(FTagData PRIVATE
Common
GpCommon
PortabilityLayer
AerofoilPortable
WindowsUnicodeToolShim
)
target_link_libraries(FTagData PortabilityLayer)
add_executable(MergeGPF EXCLUDE_FROM_ALL
MergeGPF/MergeGPF.cpp
AerofoilPortable/GpAllocator_C.cpp
WindowsUnicodeToolShim/UnixUnicodeToolShim.cpp
)
target_include_directories(MergeGPF PRIVATE
Common
GpCommon
PortabilityLayer
AerofoilPortable
WindowsUnicodeToolShim
)
target_link_libraries(MergeGPF PortabilityLayer)
add_executable(MiniRez EXCLUDE_FROM_ALL MiniRez/MiniRez.cpp WindowsUnicodeToolShim/UnixUnicodeToolShim.cpp)
target_include_directories(MiniRez PRIVATE
Common
GpCommon
PortabilityLayer
WindowsUnicodeToolShim
)
target_link_libraries(MiniRez PortabilityLayer)
add_executable(HouseTool EXCLUDE_FROM_ALL
HouseTool/HouseTool.cpp
WindowsUnicodeToolShim/UnixUnicodeToolShim.cpp
)
target_include_directories(HouseTool PRIVATE
Common
GpCommon
PortabilityLayer
MacRomanConversion
WindowsUnicodeToolShim
)
target_link_libraries(HouseTool PortabilityLayer MacRomanConversion)
add_executable(unpacktool EXCLUDE_FROM_ALL
unpacktool/ArchiveDescription.cpp
unpacktool/BWT.cpp
unpacktool/CompactProLZHDecompressor.cpp
unpacktool/CompactProLZHRLEDecompressor.cpp
unpacktool/CompactProParser.cpp
unpacktool/CompactProRLEDecompressor.cpp
unpacktool/CRC.cpp
unpacktool/CSInputBuffer.cpp
unpacktool/DecompressorProxyReader.cpp
unpacktool/LZSSDecompressor.cpp
unpacktool/LZW.cpp
unpacktool/LZWDecompressor.cpp
unpacktool/NullDecompressor.cpp
unpacktool/PrefixCode.cpp
unpacktool/RLE90Decompressor.cpp
unpacktool/StringCommon.cpp
unpacktool/StuffIt13Decompressor.cpp
unpacktool/StuffIt5Parser.cpp
unpacktool/StuffItArsenicDecompressor.cpp
unpacktool/StuffItCommon.cpp
unpacktool/StuffItHuffmanDecompressor.cpp
unpacktool/StuffItParser.cpp
unpacktool/unpacktool.cpp
WindowsUnicodeToolShim/UnixUnicodeToolShim.cpp
)
target_include_directories(unpacktool PRIVATE
Common
GpCommon
PortabilityLayer
MacRomanConversion
WindowsUnicodeToolShim
)
target_link_libraries(unpacktool PortabilityLayer MacRomanConversion)
find_package(Freetype)
if(FREETYPE_FOUND)
add_library(GpFontHandler_FreeType2 STATIC
GpFontHandler_FreeType2/GpFontHandler_FreeType2.cpp
)
target_include_directories(GpFontHandler_FreeType2 PRIVATE
Common
GpCommon
"${FREETYPE_INCLUDE_DIR_ft2build}"
)
target_link_libraries(GpFontHandler_FreeType2 PRIVATE Freetype::Freetype)
add_executable(GenerateFonts EXCLUDE_FROM_ALL
GenerateFonts/GenerateFonts.cpp
AerofoilPortable/GpAllocator_C.cpp
WindowsUnicodeToolShim/UnixUnicodeToolShim.cpp
)
target_include_directories(GenerateFonts PRIVATE
Common
GpCommon
PortabilityLayer
AerofoilPortable
WindowsUnicodeToolShim
)
target_link_libraries(GenerateFonts PortabilityLayer GpFontHandler_FreeType2)
endif()
add_executable(ConvertColorCursors EXCLUDE_FROM_ALL
ConvertColorCursors/ConvertColorCursors.cpp
AerofoilPortable/GpAllocator_C.cpp
stb/stb_image_write.c
WindowsUnicodeToolShim/UnixUnicodeToolShim.cpp
)
target_include_directories(ConvertColorCursors PRIVATE
Common
GpCommon
PortabilityLayer
AerofoilPortable
stb
WindowsUnicodeToolShim
)
target_link_libraries(ConvertColorCursors PortabilityLayer)
add_custom_target(BuildDirs
BYPRODUCTS Packaged tmp
COMMAND "${CMAKE_COMMAND}" -E make_directory Packaged/Houses tmp
VERBATIM
)
set(DATA_FILES)
function(add_data_file NAME)
list(APPEND DATA_FILES "Packaged/${NAME}")
set(DATA_FILES "${DATA_FILES}" PARENT_SCOPE)
cmake_parse_arguments(PARSE_ARGV 1 ARG "" "" "")
set(TMPDIR "${CMAKE_CURRENT_BINARY_DIR}/tmp/${NAME}")
list(TRANSFORM ARG_UNPARSED_ARGUMENTS
REPLACE {TMPDIR} "${TMPDIR}"
)
add_custom_command(
OUTPUT "Packaged/${NAME}"
DEPENDS BuildDirs
COMMAND "${CMAKE_COMMAND}" -E make_directory "${TMPDIR}"
${ARG_UNPARSED_ARGUMENTS}
COMMAND "${CMAKE_COMMAND}" -E rename
"${TMPDIR}/${NAME}"
"${CMAKE_CURRENT_BINARY_DIR}/Packaged/${NAME}"
COMMAND "${CMAKE_COMMAND}" -E rm -r -- "${TMPDIR}"
VERBATIM
)
endfunction()
add_data_file(ApplicationResources.gpf
DEPENDS
MiniRez gpr2gpa FTagData MergeGPF "GliderProData/Glider PRO.r"
ApplicationResourcePatches/manifest.json DefaultTimestamp.timestamp
COMMAND MiniRez
"GliderProData/Glider PRO.r"
"{TMPDIR}/ApplicationResources.gpr"
COMMAND gpr2gpa
"{TMPDIR}/ApplicationResources.gpr"
DefaultTimestamp.timestamp
"{TMPDIR}/ApplicationResources.gpa"
-patch ApplicationResourcePatches/manifest.json
COMMAND FTagData
DefaultTimestamp.timestamp
"{TMPDIR}/ApplicationResources.gpf"
data ozm5 0 0 locked
COMMAND MergeGPF
"{TMPDIR}/ApplicationResources.gpf"
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
)
file(GLOB_RECURSE FONT_DEPS RELATIVE "${CMAKE_SOURCE_DIR}" CONFIGURE_DEPENDS Resources/Fonts/*)
add_data_file(Fonts.gpf
DEPENDS GenerateFonts MiniRez gpr2gpa FTagData MergeGPF ${FONT_DEPS}
COMMAND GenerateFonts "${CMAKE_SOURCE_DIR}/Resources" {TMPDIR}
COMMAND MiniRez "${CMAKE_SOURCE_DIR}/Empty.r" {TMPDIR}/Fonts.gpr
COMMAND gpr2gpa
{TMPDIR}/Fonts.gpr
"${CMAKE_SOURCE_DIR}/DefaultTimestamp.timestamp"
{TMPDIR}/Fonts.gpa
-patch {TMPDIR}/FontCacheManifest.json
COMMAND FTagData
DefaultTimestamp.timestamp
{TMPDIR}/Fonts.gpf
data ozm5 0 0 locked
COMMAND MergeGPF {TMPDIR}/Fonts.gpf
)
# These files are committed to the repo and aren't currently useful on non-Windows systems anyway.
#file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/Aerofoil/ConvertedResources)
#
#set(CONVERTED_ICONS
# Aerofoil/ConvertedResources/Large128.ico
# Aerofoil/ConvertedResources/Large129.ico
# Aerofoil/ConvertedResources/Large130.ico
# Aerofoil/ConvertedResources/Large131.ico
# Aerofoil/ConvertedResources/Large132.ico
# Aerofoil/ConvertedResources/Large133.ico
# Aerofoil/ConvertedResources/Small128.ico
# Aerofoil/ConvertedResources/Small129.ico
# Aerofoil/ConvertedResources/Small130.ico
# Aerofoil/ConvertedResources/Small133.ico
# )
#
#add_custom_command(
# OUTPUT ${CONVERTED_ICONS}
# DEPENDS ConvertColorCursors Packaged/ApplicationResources.gpr
# COMMAND ConvertColorCursors
# )
#add_custom_target(Icons DEPENDS ${CONVERTED_ICONS})
set(HOUSE_FILES)
function(add_house NAME)
cmake_parse_arguments(PARSE_ARGV 0 ARG
""
PATCH
""
)
if(ARG_PATCH)
set(PATCH_ARGS -patch "${CMAKE_SOURCE_DIR}/HousePatches/${ARG_PATCH}")
endif()
set(BASE_PATH "Packaged/Houses/${NAME}")
list(APPEND HOUSE_FILES "${BASE_PATH}.gpf")
set(BYPRODUCTS "${BASE_PATH}.gpr" "${BASE_PATH}.gpa" "${BASE_PATH}.gpd")
set(BINHEX_SRC "${CMAKE_SOURCE_DIR}/GliderProData/Houses/${NAME}.binhex")
set(TS "${CMAKE_SOURCE_DIR}/DefaultTimestamp.timestamp")
add_custom_command(
OUTPUT
"${BASE_PATH}.gpf"
BYPRODUCTS
${BYPRODUCTS}
DEPENDS hqx2gp gpr2gpa MergeGPF BuildDirs "${BINHEX_SRC}" "${TS}"
COMMAND hqx2gp
"${BINHEX_SRC}"
"${TS}"
"${BASE_PATH}"
COMMAND gpr2gpa
"${BASE_PATH}.gpr"
"${TS}"
"${BASE_PATH}.gpa"
${PATCH_ARGS}
${HOUSE_EXTRA_COMMANDS}
COMMAND MergeGPF
"${BASE_PATH}.gpf"
COMMAND "${CMAKE_COMMAND}" -E rm
${BYPRODUCTS}
VERBATIM
)
set(MOV_GPA_SRC "${CMAKE_SOURCE_DIR}/GliderProData/ConvertedMovies/${NAME}.mov.gpa")
if(EXISTS "${MOV_GPA_SRC}")
list(APPEND HOUSE_FILES "${BASE_PATH}.mov.gpf")
add_custom_command(
OUTPUT
"${BASE_PATH}.mov.gpf"
BYPRODUCTS
"${BASE_PATH}.mov.gpa"
DEPENDS FTagData MergeGPF BuildDirs "${MOV_GPA_SRC}" "${TS}"
COMMAND FTagData
"${TS}"
"${BASE_PATH}.mov.gpf"
MooV ozm5 0 0 locked
COMMAND "${CMAKE_COMMAND}" -E copy
-t "Packaged/Houses"
"${MOV_GPA_SRC}"
COMMAND MergeGPF
"${BASE_PATH}.mov.gpf"
COMMAND "${CMAKE_COMMAND}" -E rm
"${BASE_PATH}.mov.gpa"
VERBATIM
)
endif()
set(HOUSE_FILES "${HOUSE_FILES}" PARENT_SCOPE)
endfunction()
add_house("Art Museum")
add_house("California or Bust!")
set(HOUSE_EXTRA_COMMANDS
DEPENDS HouseTool
COMMAND HouseTool
patch "Packaged/Houses/Castle o' the Air.gpd" .firstRoom 77
)
add_house("Castle o' the Air")
unset(HOUSE_EXTRA_COMMANDS)
add_house("CD Demo House")
add_house("Davis Station")
add_house("Demo House")
add_house("Fun House")
add_house("Grand Prix" PATCH "GrandPrix.json")
add_house("ImagineHouse PRO II" PATCH "ImagineHousePROII.json")
add_house("In The Mirror" PATCH "InTheMirror.json")
add_house("Land of Illusion")
add_house("Leviathan" PATCH "Leviathan.json")
add_house("Metropolis")
add_house("Nemo's Market")
add_house("Rainbow's End" PATCH "RainbowsEnd.json")
add_house("Slumberland")
add_house("SpacePods")
add_house("Teddy World")
add_house("The Asylum Pro")
add_house("Titanic")
add_custom_target(Executable DEPENDS "${EXECNAME}")
add_custom_target(Resources ALL
DEPENDS
${DATA_FILES}
${HOUSE_FILES}
)
set(TOOL_EXES
flattenmov
bin2gp
hqx2bin
hqx2gp
MakeTimestamp
FTagData
gpr2gpa
unpacktool
MergeGPF
)
add_custom_target(Tools ALL DEPENDS ${TOOL_EXES})
list(TRANSFORM DATA_FILES PREPEND "${CMAKE_CURRENT_BINARY_DIR}/")
list(TRANSFORM HOUSE_FILES PREPEND "${CMAKE_CURRENT_BINARY_DIR}/")
install(TARGETS "${EXECNAME}" COMPONENT Executable)
install(FILES ${DATA_FILES} DESTINATION lib/aerofoil/Packaged COMPONENT Resources)
install(FILES ${HOUSE_FILES} DESTINATION lib/aerofoil/Packaged/Houses COMPONENT Resources)
install(TARGETS ${TOOL_EXES} DESTINATION lib/aerofoil/tools COMPONENT Tools)