-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
293 lines (264 loc) · 10.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
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
cmake_minimum_required(VERSION 3.1)
project(pandaExpress)
# Set c++11
# https://stackoverflow.com/questions/10851247/how-to-activate-c-11-in-cmake
if (POLICY CMP0025)
cmake_policy(SET CMP0025 NEW)
endif ()
set (CMAKE_CXX_STANDARD 14)
set (CMAKE_CXX_STANDARD_REQUIRED)
# nice hierarchichal structure in MSVC
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
#Find OS
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(IS_OS_MAC 1)
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
set(IS_OS_LINUX 1)
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
set(IS_OS_WINDOWS 1)
else()
message(FATAL_ERROR "OS ${CMAKE_SYSTEM_NAME} was not recognized")
endif()
# Add source files as we code (QWERTY)
# Generate the shader folder Location to the header
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/src/project_path.hpp.in" "${CMAKE_CURRENT_SOURCE_DIR}/src/project_path.hpp")
set(SOURCE_FILES
src/main.cpp
src/scene/scene_manager.cpp
src/scene/scene.cpp
src/util/input_manager.cpp
src/graphics/window.cpp
src/graphics/texture.cpp
src/graphics/texture_manager.cpp
src/graphics/shader.cpp
src/graphics/shader_manager.cpp
src/util/gl_utils.cpp
src/graphics/sprite.cpp
src/graphics/mesh.cpp
src/graphics/camera.cpp
src/systems/player_movement_system.cpp
src/systems/sprite_transform_system.cpp
src/util/constants.h
src/systems/physics_system.cpp
src/systems/physics_system.h
src/components/bread.h
src/util/random.cpp
src/util/random.h
src/scene/main_menu_scene.h
src/scene/main_menu_scene.cpp
src/components/obstacle.h
src/graphics/background.cpp
src/systems/background_transform_system.cpp
src/systems/background_transform_system.h
src/scene/vertical_scene.cpp
src/scene/vertical_scene.h
src/scene/dracula_boss_scene.cpp
src/scene/dracula_boss_scene.h
src/util/csv_reader.cpp
src/util/csv_reader.h
src/level/level_system.cpp
src/level/level_system.h
src/scene/horizontal_scene.cpp
src/scene/horizontal_scene.h
src/scene/boss_scene.cpp
src/scene/boss_scene.h
src/level/horizontal_level_system.h
src/level/horizontal_level_system.cpp
src/components/ghost.h
src/components/llama.h src/components/spit.h
src/components/pause_menu.h
src/components/seeks.h
src/level/vertical_level_system.cpp
src/level/vertical_level_system.h
src/components/chases.h
src/systems/chase_system.cpp
src/systems/chase_system.h
src/util/node.cpp
src/util/node.h
src/util/coordinates.cpp
src/util/coordinates.h
src/util/Location.cpp
src/util/Location.h
src/components/falling_platform.h
src/util/selector_node.h
src/util/selector_node.cpp
src/systems/seek_system.cpp
src/systems/seek_system.h
src/systems/a_star_system.cpp
src/systems/a_star_system.h
src/systems/jacko_ai_system.cpp
src/systems/jacko_ai_system.h
src/systems/dracula_ai_system.cpp
src/systems/dracula_ai_system.h
src/components/evades.h
src/level/boss_level_system.h
src/level/boss_level_system.cpp
src/systems/ghost_movement_system.cpp
src/systems/ghost_movement_system.h
src/graphics/mesh_manager.cpp
src/systems/player_animation_system.cpp
src/systems/player_animation_system.h
src/components/timer.cpp
src/components/timer.h
src/systems/timer_system.cpp
src/systems/timer_system.h
src/systems/falling_platform_system.cpp
src/systems/falling_platform_system.h
src/systems/panda_damage_system.cpp
src/systems/enemy_system.cpp
src/systems/enemy_system.h
src/systems/enemy_animation_system.cpp
src/systems/enemy_animation_system.h
src/util/sound_manager.cpp
src/util/sound_manager.h
src/graphics/health_bar.cpp
src/graphics/health_bar.h
src/systems/health_bar_transform_system.cpp
src/systems/health_bar_transform_system.h
src/graphics/cave.cpp src/graphics/cave.h
src/graphics/text.cpp
src/graphics/text.h
src/graphics/font.cpp
src/graphics/font.h
src/systems/text_transform_system.cpp
src/systems/text_transform_system.h
src/systems/score_system.cpp
src/systems/score_system.h
src/components/score.h
src/level/level.cpp
src/level/level.h
src/components/layer.h
src/graphics/fade_overlay.h
src/graphics/fade_overlay.cpp
src/systems/fade_overlay_system.cpp
src/systems/fade_overlay_system.h
src/scene/scene_mode.h
src/systems/pause_menu_transform_system.cpp
src/systems/pause_menu_transform_system.h
src/systems/transition_system.cpp
src/systems/transition_system.h
src/graphics/cave_entrance.h
src/graphics/cave_entrance.cpp
src/components/hud_element.h
src/systems/hud_transform_system.cpp
src/systems/hud_transform_system.h
src/graphics/font_manager.cpp
src/graphics/font_manager.h
src/components/label.h
src/systems/label_system.cpp
src/systems/label_system.h
src/util/scene_helper.h
src/util/property_reader.cpp
src/util/property_reader.h
src/systems/render_system.cpp
src/systems/render_system.h
src/scene/game_scene.cpp
src/scene/game_scene.h
src/scene/story_intro_beach.cpp
src/scene/story_intro_beach.h
src/systems/story_beach_animation_system.cpp
src/systems/story_beach_animation_system.h
src/components/kelly.h
src/components/hearts.h
src/components/powerup.h
src/systems/powerup_system.cpp
src/systems/powerup_system.h
src/components/kelly.h
src/components/hearts.h
src/graphics/framebuffer.h
src/graphics/framebuffer.cpp
src/scene/story_intro_jungle.cpp
src/scene/story_intro_jungle.h
src/systems/story_jungle_animation_system.cpp
src/systems/story_jungle_animation_system.h
src/components/vape.h
src/scene/story_end_scene.cpp
src/scene/story_end_scene.h
src/systems/story_end_animation_system.cpp
src/systems/story_end_animation_system.h
src/components/new_entrance.h)
# Create executable target
add_executable(${PROJECT_NAME} ${SOURCE_FILES})
target_include_directories(${PROJECT_NAME} PUBLIC src/)
# Added this so policy CMP0065 doesn't scream
set_target_properties(${PROJECT_NAME} PROPERTIES ENABLE_EXPORTS 0)
# External header-only libraries in the ext/
target_include_directories(${PROJECT_NAME} PUBLIC ext/stb_image/)
target_include_directories(${PROJECT_NAME} PUBLIC ext/entt/)
target_include_directories(${PROJECT_NAME} PUBLIC ext/Box2D/)
target_include_directories(${PROJECT_NAME} PUBLIC /usr/local/include/freetype2/)
# Find OpenGL
find_package(OpenGL REQUIRED)
if (OPENGL_FOUND)
target_include_directories(${PROJECT_NAME} PUBLIC ${OPENGL_INCLUDE_DIR})
target_link_libraries(${PROJECT_NAME} PUBLIC ${OPENGL_gl_LIBRARY})
endif()
# Find FreeType
find_package(Freetype REQUIRED)
target_include_directories(${PROJECT_NAME} PUBLIC ${FREETYPE_INCLUDE_DIRS})
target_link_libraries(${PROJECT_NAME} PUBLIC ${FREETYPE_LIBRARIES})
if (IS_OS_LINUX OR IS_OS_MAC)
# Try to find packages rather than to use the precompiled ones
# Since we're on OSX or Linux, we can just use pkgconfig.
find_package(PkgConfig REQUIRED)
pkg_search_module(GLEW REQUIRED glew)
pkg_search_module(SDL2 REQUIRED sdl2)
pkg_search_module(SDL2MIXER REQUIRED SDL2_mixer)
# Link Frameworks on OSX
if (IS_OS_MAC)
find_library(COCOA_LIBRARY Cocoa)
find_library(CF_LIBRARY CoreFoundation)
target_link_libraries(${PROJECT_NAME} PUBLIC ${COCOA_LIBRARY} ${CF_LIBRARY})
endif()
elseif (IS_OS_WINDOWS)
# https://stackoverflow.com/questions/17126860/cmake-link-precompiled-library-depending-on-os-and-architecture
set(GLEW_FOUND TRUE)
set(SDL2_FOUND TRUE)
set(GLEW_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/ext/glew/include/GL")
set(SDL2_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/ext/sdl/include/SDL")
if (${CMAKE_SIZEOF_VOID_P} MATCHES "8")
set(GLEW_LIBRARIES "${CMAKE_CURRENT_SOURCE_DIR}/ext/glew/lib/Release/x64/glew32s.lib")
set(SDL2_LIBRARIES "${CMAKE_CURRENT_SOURCE_DIR}/ext/sdl/lib/SDL2-x64.lib")
set(SDL2MIXER_LIBRARIES "${CMAKE_CURRENT_SOURCE_DIR}/ext/sdl/lib/SDL2_mixer-x64.lib")
set(SDL_DLL "${CMAKE_CURRENT_SOURCE_DIR}/ext/sdl/lib/SDL2-x64.dll")
set(SDLMIXER_DLL "${CMAKE_CURRENT_SOURCE_DIR}/ext/sdl/lib/SDL2_mixer-x64.dll")
else()
set(GLEW_LIBRARIES "${CMAKE_CURRENT_SOURCE_DIR}/ext/glew/lib/Release/Win32/glew32s.lib")
set(SDL2_LIBRARIES "${CMAKE_CURRENT_SOURCE_DIR}/ext/sdl/lib/SDL2-x86.lib")
set(SDL2MIXER_LIBRARIES "${CMAKE_CURRENT_SOURCE_DIR}/ext/sdl/lib/SDL2_mixer-x86.lib")
set(SDL_DLL "${CMAKE_CURRENT_SOURCE_DIR}/ext/sdl/lib/SDL2-x86.dll")
set(SDLMIXER_DLL "${CMAKE_CURRENT_SOURCE_DIR}/ext/sdl/lib/SDL2_mixer-x86.dll")
endif()
# Copy and rename dlls
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${SDL_DLL}"
"$<TARGET_FILE_DIR:${PROJECT_NAME}>/SDL2.dll")
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${SDLMIXER_DLL}"
"$<TARGET_FILE_DIR:${PROJECT_NAME}>/SDL2_mixer.dll")
endif()
# Can't find the include and lib. Quit.
if (NOT SDL2_FOUND)
message(FATAL_ERROR "Can't find SDL." )
endif()
target_include_directories(${PROJECT_NAME} PUBLIC ${GLEW_INCLUDE_DIRS} ${SDL2_INCLUDE_DIRS})
if($ENV{USER} STREQUAL "Avery" OR $ENV{USER} STREQUAL "catsrule123")
target_link_libraries(${PROJECT_NAME} PUBLIC "/usr/local/lib/libGLEW.dylib"
"/usr/local/lib/libSDL2.dylib"
"/usr/local/lib/libSDL2_mixer.dylib"
"-framework Foundation"
"-framework Cocoa"
"-framework CoreAudio"
"-framework AVFoundation"
"-framework CoreGraphics"
"-framework MediaPlayer"
"-framework QuartzCore")
else()
target_link_libraries(${PROJECT_NAME} PUBLIC ${GLEW_LIBRARIES} ${SDL2_LIBRARIES} ${SDL2MIXER_LIBRARIES})
endif()
# Needed to add this
if(IS_OS_LINUX)
target_link_libraries(${PROJECT_NAME} PUBLIC ${CMAKE_DL_LIBS})
endif()