-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
130 lines (115 loc) · 3.68 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
cmake_minimum_required(VERSION 3.18...3.21)
set(GAME "root-company")
project(${GAME}
VERSION 0.1.0
)
include(GNUInstallDirs)
find_package(gf REQUIRED COMPONENTS graphics)
find_package(SFML REQUIRED COMPONENTS audio)
if (UNIX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address")
endif ()
set(GAME_DATADIR "${CMAKE_INSTALL_PREFIX}/share/games/${GAME}" CACHE PATH "Game Data Dir")
set(GAME_RELATIVE_DATADIR "./share/games/${GAME}" CACHE STRING "Game Relative Data Dir")
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/code/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h @ONLY)
add_executable(${GAME}
code/main.cc
code/bits/AudioManager.cc
code/bits/CommonScene.cc
code/bits/DialogEntity.cc
code/bits/GameHub.cc
code/bits/GameOverEntity.cc
code/bits/GameOverScene.cc
code/bits/GameState.cc
code/bits/Hero.cc
code/bits/HeroEntity.cc
code/bits/HeroHudEntity.cc
code/bits/LiftEntity.cc
code/bits/LiftScene.cc
code/bits/LightEntity.cc
code/bits/MainScene.cc
code/bits/MapEntity.cc
code/bits/MapState.cc
code/bits/RootEntity.cc
code/bits/RootModel.cc
code/bits/SplitEntity.cc
code/bits/StartScene.cc
code/bits/TitleEntity.cc
code/bits/VictoryEntity.cc
code/bits/VictoryScene.cc
)
target_include_directories(${GAME}
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/code
${CMAKE_CURRENT_BINARY_DIR}
)
target_link_libraries(${GAME}
PRIVATE
gf::graphics
sfml-audio
)
if (WIN32)
add_custom_command(TARGET ${GAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_RUNTIME_DLLS:${GAME}> $<TARGET_FILE_DIR:${GAME}>
COMMAND_EXPAND_LISTS
)
install(
FILES
$<TARGET_FILE_DIR:${GAME}>/SDL2d.dll
$<TARGET_FILE_DIR:${GAME}>/brotlicommon.dll
$<TARGET_FILE_DIR:${GAME}>/brotlidec.dll
$<TARGET_FILE_DIR:${GAME}>/bz2d.dll
$<TARGET_FILE_DIR:${GAME}>/freetyped.dll
$<TARGET_FILE_DIR:${GAME}>/gf0.dll
$<TARGET_FILE_DIR:${GAME}>/gfcore0.dll
$<TARGET_FILE_DIR:${GAME}>/libpng16d.dll
$<TARGET_FILE_DIR:${GAME}>/pugixml_d.dll
$<TARGET_FILE_DIR:${GAME}>/zlibd1.dll
$<TARGET_FILE_DIR:${GAME}>/FLAC.dll
$<TARGET_FILE_DIR:${GAME}>/ogg.dll
$<TARGET_FILE_DIR:${GAME}>/OpenAL32.dll
$<TARGET_FILE_DIR:${GAME}>/sfml-audio-d-2.dll
$<TARGET_FILE_DIR:${GAME}>/sfml-system-d-2.dll
$<TARGET_FILE_DIR:${GAME}>/vorbis.dll
$<TARGET_FILE_DIR:${GAME}>/vorbisenc.dll
$<TARGET_FILE_DIR:${GAME}>/vorbisfile.dll
$<TARGET_FILE_DIR:${GAME}>/prises.pdb
DESTINATION .
CONFIGURATIONS Debug
)
install(
FILES
$<TARGET_FILE_DIR:${GAME}>/SDL2.dll
$<TARGET_FILE_DIR:${GAME}>/brotlicommon.dll
$<TARGET_FILE_DIR:${GAME}>/brotlidec.dll
$<TARGET_FILE_DIR:${GAME}>/bz2.dll
$<TARGET_FILE_DIR:${GAME}>/freetype.dll
$<TARGET_FILE_DIR:${GAME}>/gf0.dll
$<TARGET_FILE_DIR:${GAME}>/gfcore0.dll
$<TARGET_FILE_DIR:${GAME}>/libpng16.dll
$<TARGET_FILE_DIR:${GAME}>/pugixml.dll
$<TARGET_FILE_DIR:${GAME}>/zlib1.dll
$<TARGET_FILE_DIR:${GAME}>/FLAC.dll
$<TARGET_FILE_DIR:${GAME}>/ogg.dll
$<TARGET_FILE_DIR:${GAME}>/OpenAL32.dll
$<TARGET_FILE_DIR:${GAME}>/sfml-audio-2.dll
$<TARGET_FILE_DIR:${GAME}>/sfml-system-2.dll
$<TARGET_FILE_DIR:${GAME}>/vorbis.dll
$<TARGET_FILE_DIR:${GAME}>/vorbisenc.dll
$<TARGET_FILE_DIR:${GAME}>/vorbisfile.dll
DESTINATION .
CONFIGURATIONS Release
)
install(TARGETS ${GAME} DESTINATION .)
else ()
install(TARGETS ${GAME} RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
endif ()
install(
DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/data/${GAME}"
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/games"
)
# Package rules
if (WIN32)
set(CPACK_GENERATOR "ZIP")
include(CPack)
endif()