-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathCMakeLists.txt
194 lines (144 loc) · 3.6 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
cmake_minimum_required(VERSION 3.15)
set(TARGET BiplanesRevival)
set(${TARGET}_VERSION 1.2.1)
project(${TARGET} VERSION ${${TARGET}_VERSION} LANGUAGES C CXX)
add_executable(${TARGET})
option(BUILD_SHARED_LIBS "Build using shared libraries" ON)
option(${TARGET}_ENABLE_STEP_DEBUGGING
"${TARGET}: Enable step-by-step mode controls for easier debugging" OFF)
if (WIN32)
option(${TARGET}_DISABLE_CONSOLE "${TARGET}: Don't show console window" ON)
endif()
include(GNUInstallDirs)
set_target_properties(${TARGET} PROPERTIES
CXX_STANDARD_REQUIRED ON
CXX_STANDARD 17
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}"
)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/sdl2)
find_package(SDL2 2.0.10 REQUIRED)
find_package(SDL2_image REQUIRED)
find_package(SDL2_mixer REQUIRED)
target_sources(${TARGET} PRIVATE
src/biplanes.cpp
include/fwd.hpp
include/enums.hpp
include/constants.hpp
include/game_state.hpp
include/network_data.hpp
include/network_state.hpp
include/canvas.hpp
include/color.hpp
include/stats.hpp
include/sounds.hpp
include/textures.hpp
include/variables.hpp
lib/Net.h
src/icon.rc
src/version.rc
src/bullet.cpp
include/bullet.hpp
src/cloud.cpp
include/cloud.hpp
src/controls.cpp
include/controls.hpp
src/effects.cpp
include/effects.hpp
src/matchmake.cpp
include/matchmake.hpp
src/math.cpp
include/math.hpp
src/menu.cpp
src/menu_input.cpp
src/menu_navigation.cpp
src/menu_sp.cpp
src/menu_mp.cpp
src/menu_help.cpp
src/menu_stats.cpp
include/menu.hpp
src/network.cpp
include/network.hpp
src/plane.cpp
src/plane_input.cpp
src/plane_pilot.cpp
include/plane.hpp
src/render.cpp
include/render.hpp
src/resources.cpp
include/resources.hpp
src/sdl.cpp
include/sdl.hpp
src/time.cpp
include/time.hpp
src/timer.cpp
include/timer.hpp
src/utility.cpp
include/utility.hpp
src/zeppelin.cpp
include/zeppelin.hpp
src/ai_stuff.cpp
include/ai_stuff.hpp
)
add_subdirectory(deps/TimeUtils)
target_compile_definitions(${TARGET} PRIVATE
BIPLANES_EXE_NAME="${TARGET}"
BIPLANES_VERSION="${${TARGET}_VERSION}"
_USE_MATH_DEFINES
)
if (${${TARGET}_ENABLE_STEP_DEBUGGING})
target_compile_definitions(${TARGET} PRIVATE
BIPLANES_STEP_DEBUGGING_ENABLED
)
endif()
target_include_directories(${TARGET} PRIVATE
${SDL2_INCLUDE_DIR}
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
)
if (NOT CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
target_compile_options(${TARGET} PUBLIC -Wno-narrowing)
endif()
if (NOT ${BUILD_SHARED_LIBS})
target_link_libraries(${TARGET} PUBLIC
-static
-static-libgcc
-static-libstdc++
)
endif()
target_link_libraries(${TARGET} PUBLIC
SDL2::Main
SDL2::Image
SDL2::Mixer
TimeUtils::TimeUtils
)
if (WIN32)
target_link_libraries(${TARGET} PUBLIC
ws2_32
-static-libgcc
-static-libstdc++
)
if (${${TARGET}_DISABLE_CONSOLE})
set_target_properties(${TARGET} PROPERTIES
WIN32_EXECUTABLE TRUE
)
target_link_libraries(${TARGET} PUBLIC
-mwindows
)
else()
set_target_properties(${TARGET} PROPERTIES
WIN32_EXECUTABLE FALSE
)
target_link_libraries(${TARGET} PUBLIC
-mconsole
)
endif()
endif()
file(COPY assets DESTINATION ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR})
install(TARGETS ${TARGET}
EXPORT ${TARGET} DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
install(DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/assets
DESTINATION ${CMAKE_INSTALL_BINDIR}
)