forked from k4zmu2a/SpaceCadetPinball
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
230 lines (211 loc) · 8.3 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
cmake_minimum_required(VERSION 3.0)
project(SpaceCadetPinball)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/bin)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/CMakeModules")
# On Windows, set paths to SDL-devel packages here
if(WIN32)
list(APPEND SDL2_PATH "${CMAKE_CURRENT_LIST_DIR}/Libs/SDL2")
list(APPEND SDL2_MIXER_PATH "${CMAKE_CURRENT_LIST_DIR}/Libs/SDL2_mixer")
endif()
# Link mingw libs static
if(MINGW)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static")
endif()
# SDL2main is not needed
set(SDL2_BUILDING_LIBRARY ON)
find_package(SDL2 REQUIRED)
FIND_PACKAGE(SDL2_mixer REQUIRED)
include_directories(${SDL2_INCLUDE_DIR} ${SDL2_MIXER_INCLUDE_DIR})
get_property(dirs DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY INCLUDE_DIRECTORIES)
foreach(dir ${dirs})
message(STATUS "Include dir='${dir}'")
endforeach()
set(SOURCE_FILES
SpaceCadetPinball/control.cpp
SpaceCadetPinball/control.h
SpaceCadetPinball/EmbeddedData.cpp
SpaceCadetPinball/EmbeddedData.h
SpaceCadetPinball/fullscrn.cpp
SpaceCadetPinball/fullscrn.h
SpaceCadetPinball/gdrv.cpp
SpaceCadetPinball/gdrv.h
SpaceCadetPinball/GroupData.cpp
SpaceCadetPinball/GroupData.h
SpaceCadetPinball/high_score.cpp
SpaceCadetPinball/high_score.h
SpaceCadetPinball/loader.cpp
SpaceCadetPinball/loader.h
SpaceCadetPinball/maths.cpp
SpaceCadetPinball/maths.h
SpaceCadetPinball/midi.cpp
SpaceCadetPinball/midi.h
SpaceCadetPinball/nudge.cpp
SpaceCadetPinball/nudge.h
SpaceCadetPinball/options.cpp
SpaceCadetPinball/options.h
SpaceCadetPinball/partman.cpp
SpaceCadetPinball/partman.h
SpaceCadetPinball/pb.cpp
SpaceCadetPinball/pb.h
SpaceCadetPinball/pch.h
SpaceCadetPinball/pinball.cpp
SpaceCadetPinball/pinball.h
SpaceCadetPinball/proj.cpp
SpaceCadetPinball/proj.h
SpaceCadetPinball/render.cpp
SpaceCadetPinball/render.h
SpaceCadetPinball/score.cpp
SpaceCadetPinball/score.h
SpaceCadetPinball/Sound.cpp
SpaceCadetPinball/Sound.h
SpaceCadetPinball/SpaceCadetPinball.cpp
SpaceCadetPinball/TBall.cpp
SpaceCadetPinball/TBall.h
SpaceCadetPinball/TBlocker.cpp
SpaceCadetPinball/TBlocker.h
SpaceCadetPinball/TBumper.cpp
SpaceCadetPinball/TBumper.h
SpaceCadetPinball/TCircle.cpp
SpaceCadetPinball/TCircle.h
SpaceCadetPinball/TCollisionComponent.cpp
SpaceCadetPinball/TCollisionComponent.h
SpaceCadetPinball/TComponentGroup.cpp
SpaceCadetPinball/TComponentGroup.h
SpaceCadetPinball/TDemo.cpp
SpaceCadetPinball/TDemo.h
SpaceCadetPinball/TDrain.cpp
SpaceCadetPinball/TDrain.h
SpaceCadetPinball/TEdgeBox.h
SpaceCadetPinball/TEdgeManager.cpp
SpaceCadetPinball/TEdgeManager.h
SpaceCadetPinball/TEdgeSegment.cpp
SpaceCadetPinball/TEdgeSegment.h
SpaceCadetPinball/TFlagSpinner.cpp
SpaceCadetPinball/TFlagSpinner.h
SpaceCadetPinball/TFlipper.cpp
SpaceCadetPinball/TFlipper.h
SpaceCadetPinball/TFlipperEdge.cpp
SpaceCadetPinball/TFlipperEdge.h
SpaceCadetPinball/TGate.cpp
SpaceCadetPinball/TGate.h
SpaceCadetPinball/THole.cpp
SpaceCadetPinball/THole.h
SpaceCadetPinball/timer.cpp
SpaceCadetPinball/timer.h
SpaceCadetPinball/TKickback.cpp
SpaceCadetPinball/TKickback.h
SpaceCadetPinball/TKickout.cpp
SpaceCadetPinball/TKickout.h
SpaceCadetPinball/TLight.cpp
SpaceCadetPinball/TLight.h
SpaceCadetPinball/TLightBargraph.cpp
SpaceCadetPinball/TLightBargraph.h
SpaceCadetPinball/TLightGroup.cpp
SpaceCadetPinball/TLightGroup.h
SpaceCadetPinball/TLightRollover.cpp
SpaceCadetPinball/TLightRollover.h
SpaceCadetPinball/TLine.cpp
SpaceCadetPinball/TLine.h
SpaceCadetPinball/TOneway.cpp
SpaceCadetPinball/TOneway.h
SpaceCadetPinball/TPinballComponent.cpp
SpaceCadetPinball/TPinballComponent.h
SpaceCadetPinball/TPinballTable.cpp
SpaceCadetPinball/TPinballTable.h
SpaceCadetPinball/TPlunger.cpp
SpaceCadetPinball/TPlunger.h
SpaceCadetPinball/TPopupTarget.cpp
SpaceCadetPinball/TPopupTarget.h
SpaceCadetPinball/TRamp.cpp
SpaceCadetPinball/TRamp.h
SpaceCadetPinball/TRollover.cpp
SpaceCadetPinball/TRollover.h
SpaceCadetPinball/TSink.cpp
SpaceCadetPinball/TSink.h
SpaceCadetPinball/TSoloTarget.cpp
SpaceCadetPinball/TSoloTarget.h
SpaceCadetPinball/TSound.cpp
SpaceCadetPinball/TSound.h
SpaceCadetPinball/TTableLayer.cpp
SpaceCadetPinball/TTableLayer.h
SpaceCadetPinball/TTextBox.cpp
SpaceCadetPinball/TTextBox.h
SpaceCadetPinball/TTextBoxMessage.cpp
SpaceCadetPinball/TTextBoxMessage.h
SpaceCadetPinball/TTimer.cpp
SpaceCadetPinball/TTimer.h
SpaceCadetPinball/TTripwire.cpp
SpaceCadetPinball/TTripwire.h
SpaceCadetPinball/TWall.cpp
SpaceCadetPinball/TWall.h
SpaceCadetPinball/winmain.cpp
SpaceCadetPinball/winmain.h
SpaceCadetPinball/zdrv.cpp
SpaceCadetPinball/zdrv.h
SpaceCadetPinball/imconfig.h
SpaceCadetPinball/imgui_internal.h
SpaceCadetPinball/imgui.cpp
SpaceCadetPinball/imgui.h
SpaceCadetPinball/imgui_sdl.cpp
SpaceCadetPinball/imgui_sdl.h
SpaceCadetPinball/imgui_draw.cpp
SpaceCadetPinball/imgui_widgets.cpp
SpaceCadetPinball/imgui_tables.cpp
SpaceCadetPinball/imgui_demo.cpp
SpaceCadetPinball/imgui_impl_sdl.cpp
SpaceCadetPinball/imgui_impl_sdl.h
SpaceCadetPinball/imstb_textedit.h
SpaceCadetPinball/imstb_rectpack.h
SpaceCadetPinball/imstb_truetype.h
)
# On Windows, include resource file with the icon
if(WIN32)
set_source_files_properties(SpaceCadetPinball/SpaceCadetPinball.rc LANGUAGE RC)
list(APPEND SOURCE_FILES SpaceCadetPinball/SpaceCadetPinball.rc)
endif(WIN32)
add_executable(SpaceCadetPinball ${SOURCE_FILES})
# Skip pch on foreign code
set_source_files_properties(
SpaceCadetPinball/imgui.cpp
SpaceCadetPinball/imgui_sdl.cpp
SpaceCadetPinball/imgui_draw.cpp
SpaceCadetPinball/imgui_widgets.cpp
SpaceCadetPinball/imgui_tables.cpp
SpaceCadetPinball/imgui_demo.cpp
SpaceCadetPinball/imgui_impl_sdl.cpp
PROPERTIES SKIP_PRECOMPILE_HEADERS 1
)
if(${CMAKE_VERSION} VERSION_GREATER "3.16.0" OR ${CMAKE_VERSION} VERSION_EQUAL "3.16.0")
target_precompile_headers(SpaceCadetPinball
PUBLIC
SpaceCadetPinball/pch.h
)
endif()
target_link_libraries(SpaceCadetPinball ${SDL2_LIBRARY} ${SDL2_MIXER_LIBRARY})
# On Windows, copy DLL to output
if(WIN32)
list(GET SDL2_LIBRARY -1 SDL2_DLL_PATH)
list(GET SDL2_MIXER_LIBRARY -1 SDL2_MIXER_DLL_PATH)
get_filename_component(SDL2_DLL_PATH ${SDL2_DLL_PATH} DIRECTORY)
get_filename_component(SDL2_MIXER_DLL_PATH ${SDL2_MIXER_DLL_PATH} DIRECTORY)
if(MINGW)
string(REGEX REPLACE "lib$" "bin" SDL2_DLL_PATH ${SDL2_DLL_PATH})
string(REGEX REPLACE "lib$" "bin" SDL2_MIXER_DLL_PATH ${SDL2_MIXER_DLL_PATH})
endif()
message(STATUS "copy paths='${SDL2_DLL_PATH}' '${SDL2_MIXER_DLL_PATH}'")
add_custom_command(TARGET SpaceCadetPinball POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${SDL2_DLL_PATH}/SDL2.dll" $<TARGET_FILE_DIR:SpaceCadetPinball>
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${SDL2_MIXER_DLL_PATH}/SDL2_mixer.dll" $<TARGET_FILE_DIR:SpaceCadetPinball>
)
endif()
if(UNIX AND NOT APPLE)
include(GNUInstallDirs)
install(TARGETS "${PROJECT_NAME}" RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
install(FILES "Platform/Linux/${PROJECT_NAME}.desktop" DESTINATION "share/applications")
install(FILES "Platform/Linux/${PROJECT_NAME}.metainfo.xml" DESTINATION "share/metainfo")
foreach(S 16 32 48 128 192)
install(FILES "${PROJECT_NAME}/Icon_${S}x${S}.png" DESTINATION
"share/icons/hicolor/${S}x${S}/apps" RENAME "${PROJECT_NAME}.png")
endforeach(S)
endif()