-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
212 lines (190 loc) · 6.82 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
cmake_minimum_required(VERSION 3.9.2)
project(PlannedObsolescence)
if(UNIX AND APPLE)
set(PLATFORM "osx" )
elseif(UNIX)
set(PLATFORM "linux")
else()
set(PLATFORM "win")
endif()
## hide console unless debug build ##
if (NOT CMAKE_BUILD_TYPE STREQUAL "Debug" AND WIN32)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mwindows")
endif()
set(CMAKE_DEBUG_POSTFIX d)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
## set to true to use dlls instead of static libs ##
set(BUILD_SHARED_LIBS false)
## itch.io and gamedata settings ##
set(GAMEDATA_FOLDER "data")
set(ITCHIO_USER "")
## files used to build this game
add_executable(
${PROJECT_NAME}
main.cpp
Source/PlannedObsolescence.cpp
Source/PlannedObsolescence.h
Source/Sprites/ScaledSpriteArray.h
Source/Sprites/ScaledSpriteArray.cpp
Source/Managers/SceneManager.h
Source/Managers/SceneManager.cpp
Source/FileHandler/FileHandler.h
Source/FileHandler/FileHandler.cpp
Source/Managers/CharacterManager.h
Source/Managers/CharacterManager.cpp
Source/Scenes/Scene.h
Source/Scenes/Splashscreen.h
Source/Scenes/Splashscreen.cpp
Source/Scenes/GameCore.h
Source/Scenes/GameCore.cpp
Source/Scenes/GameOver.h
Source/Scenes/GameOver.cpp
Source/Scenes/MainMenu.h
Source/Scenes/MainMenu.cpp
Source/Scenes/TutorialMenu.h
Source/Scenes/TutorialMenu.cpp
Source/Characters/Character.h
Source/Characters/Character.cpp
Source/Characters/Boss.h
Source/Characters/Boss.cpp
Source/Characters/Goon.h
Source/Characters/Goon.cpp
Source/Characters/LabTechnician.h
Source/Characters/LabTechnician.cpp
Source/Characters/Security.h
Source/Characters/Security.cpp
Source/Constants.h
Source/Characters/Pathfinding/PathfindingMap.h
Source/Characters/Pathfinding/PathNode.h
Source/Characters/Pathfinding/NodeConnection.h
Source/Math/Point.h
Source/Math/Point.cpp
Source/Math/Vector.h
Source/Math/Vector.cpp
Source/Map/GameMap.cpp
Source/Map/GameMap.h
Source/Map/Room.cpp
Source/Map/Room.h
Source/Map/Tile.cpp
Source/Map/Tile.h
Source/Characters/Pathfinding/PathfindingMap.cpp
Source/Debug/DebugText.h
Source/Debug/DebugText.cpp
Source/Viewport/Camera.h
Source/Viewport/Camera.cpp
Source/ConfigParsers/CharacterData.h
Source/ConfigParsers/TileData.h
Source/Viewport/ClickArea.cpp
Source/Viewport/ClickArea.h
Source/Keybinds/Keybinds.h
Source/Keybinds/Keybinds.cpp
Source/UI/UI.h
Source/UI/TextBox.h
Source/UI/TextBox.cpp
Source/UI/ProgressBar.h
Source/UI/ProgressBar.cpp
Source/UI/Button.h
Source/UI/Button.cpp
Source/ConfigParsers/RoomData.h
Source/UI/Menu.h
Source/UI/Menu.cpp
Source/UI/UI.cpp
Source/Managers/UIManager.h
Source/Managers/UIManager.cpp
Source/UI/PopupWindow.h
Source/UI/PopupWindow.cpp
Source/ConfigParsers/MapData.h
Source/UI/GenericUI.cpp
Source/UI/GenericUI.h
Source/Managers/GaugeManager.cpp
Source/Managers/GaugeManager.h
Source/UI/MainHUD.cpp
Source/UI/MainHUD.h
Source/UI/HudGaugeData.h
Source/UI/GetLocalisedString.h
Source/UI/GetLocalisedString.cpp
Source/UI/Cursor.cpp
Source/UI/Cursor.h
Source/Managers/Gauges.h
Source/Managers/Gauges.cpp
Source/UI/InteractionPopup.cpp
Source/UI/InteractionPopup.h
Source/UI/ActiveSelectionHighlight.cpp
Source/UI/ActiveSelectionHighlight.h
Source/Scenes/TutorialCore.cpp
Source/Scenes/TutorialCore.h)
## library includes
target_include_directories(
${PROJECT_NAME}
SYSTEM
PRIVATE
"${CMAKE_SOURCE_DIR}/Libs/ASGE/include"
"${CMAKE_SOURCE_DIR}/Libs/nlohmann")
## compile language settings
target_compile_features(
${PROJECT_NAME}
PRIVATE
cxx_std_17)
if ( CMAKE_COMPILER_IS_GNUCC )
list(APPEND BUILD_FLAGS_FOR_CXX
"-Wall" "-Wextra" "-Wshadow" "-Wnon-virtual-dtor"
"-Wold-style-cast" "-Wunused" "-pedantic"
"-Woverloaded-virtual" "-Wpedantic" "-Wconversion"
"-Wduplicated-cond" "-Wduplicated-branches" "-Wlogical-op"
"-Wnull-dereference" "-Wuseless-cast"
"-Wno-unused-parameter" "-Werror")
target_compile_options(${PROJECT_NAME} PRIVATE
$<$<COMPILE_LANGUAGE:CXX>:${BUILD_FLAGS_FOR_CXX}>)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0" )
elseif( MSVC )
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4 /WX")
endif()
if ( CMAKE_COMPILER_IS_GNUCC )
list(APPEND BUILD_FLAGS_FOR_CXX
"-Wall" "-Wextra" "-Wshadow" "-Wnon-virtual-dtor"
"-Wold-style-cast" "-Wunused" "-pedantic"
"-Woverloaded-virtual" "-Wpedantic" "-Wconversion"
"-Wduplicated-cond" "-Wduplicated-branches" "-Wlogical-op"
"-Wnull-dereference" "-Wuseless-cast"
"-Wno-unused-parameter" "-Werror")
target_compile_options(${PROJECT_NAME} PRIVATE
$<$<COMPILE_LANGUAGE:CXX>:${BUILD_FLAGS_FOR_CXX}>)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0" )
elseif( MSVC )
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4 /WX")
endif()
## build the game libs folder
add_library(ASGE UNKNOWN IMPORTED)
add_subdirectory(Libs)
target_link_libraries(${PROJECT_NAME} ASGE)
## copy the dlls post build
if(BUILD_SHARED_LIBS)
# copy the game engine dll to bin
add_custom_command(
TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${GameEngineDLL}"
$<TARGET_FILE_DIR:${PROJECT_NAME}>)
if(WIN32 AND NOT MSVC)
# copy the mingw runtime files to bin
add_custom_command(
TARGET ${PROJECT_NAME} PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_SOURCE_DIR}/Libs/mingw64/bin $<TARGET_FILE_DIR:${PROJECT_NAME}>)
endif()
endif()
## Copy launcher to build directory on Windows
if (${PLATFORM} MATCHES "win")
configure_file(${CMAKE_SOURCE_DIR}/Launcher/PO_Launcher.exe ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/Launcher.exe COPYONLY)
endif()
## enable static linking against gcc build
if (WIN32 AND NOT BUILD_SHARED_LIBS AND NOT MSVC)
target_link_libraries(${PROJECT_NAME} -static)
endif()
## utility scripts
SET(ENABLE_SOUND ON CACHE BOOL "Adds SoLoud to the Project" FORCE)
include(CMake/datapak.cmake)
target_link_libraries(${PROJECT_NAME} soloud)
## build types
set(CMAKE_CONFIGURATION_TYPES Debug;Release)