-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
127 lines (117 loc) · 2.89 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
cmake_minimum_required(VERSION 3.18)
# Name of project
set(PROJ_NAME 2501proj)
project(${PROJ_NAME})
# Specify project files: header files and source files
set(HDRS
file_utils.h
game.h
game_object.h
player.h
bullet.h
big_bullet.h
gun.h
shader.h
geometry.h
sprite.h
collidable.h
collision_box.h
geometry.h
spinner.h
airship.h
airship_segment.h
engine.h
boiler.h
crew.h
workstation.h
textures.h
task.h
enemy.h
flanker.h
rammer.h
dreadnought.h
powerup.h
gui.h
gui_elem.h
gui_state.h
wheel_gui_elem.h
clickable_gui_elem.h
buttons.h
gui_elem_collection.h
crew_status_gui_elem.h
clickable_ship_segments.h
engine_power_gui_elem.h
)
set(SRCS
file_utils.cpp
game.cpp
game_object.cpp
main.cpp
player.cpp
bullet.cpp
big_bullet.cpp
gun.cpp
shader.cpp
sprite.cpp
collidable.cpp
sprite_vertex_shader.glsl
sprite_fragment_shader.glsl
collision_box.cpp
spinner.cpp
airship.cpp
airship_segment.cpp
engine.cpp
boiler.cpp
crew.cpp
workstation.cpp
textures.cpp
task.cpp
enemy.cpp
flanker.cpp
rammer.cpp
dreadnought.cpp
powerup.cpp
gui.cpp
gui_elem.cpp
gui_state.cpp
wheel_gui_elem.cpp
clickable_gui_elem.cpp
buttons.cpp
gui_elem_collection.cpp
crew_status_gui_elem.cpp
clickable_ship_segments.cpp
engine_power_gui_elem.cpp
)
# Add path name to configuration file
configure_file(path_config.h.in path_config.h)
# Add executable based on the source files
add_executable(${PROJ_NAME} ${HDRS} ${SRCS})
# Directories to include for header files, so that the compiler can find
# path_config.h
target_include_directories(${PROJ_NAME} PUBLIC ${CMAKE_CURRENT_BINARY_DIR})
# Require OpenGL library
find_package(OpenGL REQUIRED)
include_directories(${OPENGL_INCLUDE_DIR})
target_link_libraries(${PROJ_NAME} ${OPENGL_gl_LIBRARY})
# Other libraries needed
set(LIBRARY_PATH "" CACHE PATH "Folder with GLEW, GLFW, GLM, and SOIL libraries")
include_directories(${LIBRARY_PATH}/include)
if(NOT WIN32)
find_library(GLEW_LIBRARY GLEW)
find_library(GLFW_LIBRARY glfw)
find_library(SOIL_LIBRARY SOIL)
elseif(WIN32)
find_library(GLEW_LIBRARY glew32s HINTS ${LIBRARY_PATH}/lib)
find_library(GLFW_LIBRARY glfw3 HINTS ${LIBRARY_PATH}/lib)
find_library(SOIL_LIBRARY SOIL HINTS ${LIBRARY_PATH}/lib)
endif(NOT WIN32)
target_link_libraries(${PROJ_NAME} ${GLEW_LIBRARY})
target_link_libraries(${PROJ_NAME} ${GLFW_LIBRARY})
target_link_libraries(${PROJ_NAME} ${SOIL_LIBRARY})
# The rules here are specific to Windows Systems
if(WIN32)
# Avoid ZERO_CHECK target in Visual Studio
set(CMAKE_SUPPRESS_REGENERATION TRUE)
# This will use the proper libraries in debug mode in Visual Studio
set_target_properties(${PROJ_NAME} PROPERTIES DEBUG_POSTFIX _d)
endif(WIN32)