-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
243 lines (207 loc) · 7.32 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
###############################################################################
# Declare the minimum cmake version required
###############################################################################
cmake_minimum_required(VERSION 3.0.2)
###############################################################################
# The name of out project
###############################################################################
project(CPP18_ASTEROIDS)
###############################################################################
# Now you would normally declare additional linker and include directories.
# We don't need this at this moment, just to show you how its done
###############################################################################
#link_directories("${CMAKE_SOURCE_DIR}/lib")
#link_directories("$ENV{HOME}/local/lib")
#include_directories(${CMAKE_SOURCE_DIR}/ext/Eigen)
#include_directories(${CMAKE_SOURCE_DIR})
#include_directories(${CMAKE_SOURCE_DIR}/src/lib)
###############################################################################
# Extend path to search for local cmake modules
###############################################################################
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/")
###############################################################################
# With cmake we can define additional compiler flags for different
# configurations. CMAKE_CXX_FLAGS are for the default case. The debug config
# can be used to generate debug symbols for gdb. The release option uses
# special optimization flags
###############################################################################
set( CMAKE_CXX_FLAGS "-std=c++17 -O3 -Wall" )
set( CMAKE_CXX_FLAGS_RELEASE "-std=c++17 -O3 -msse3 -Wno-deprecated-declarations -Wno-unused -Wcpp" )
set( CMAKE_CXX_FLAGS_DEBUG "-g -Wall -std=c++17" )
###############################################################################
# Find required libraries.Right now we need glut and OpenGL. The required
# options forces this packages to be present. For non-mandatory packages you
# can leave this flag out. The can then check if they were found by using
# IF(OpenGL_found) etc.
###############################################################################
include_directories(${CMAKE_SOURCE_DIR})
include_directories(${CMAKE_SOURCE_DIR}/ext/load3ds)
include_directories(${CMAKE_SOURCE_DIR}/ext/load3ds/math3d++)
find_package(OpenGL REQUIRED)
find_package(GLEW REQUIRED)
find_package(SDL2 REQUIRED)
find_package(JPEG REQUIRED)
# Add SDL2 include directory to search path
include_directories(${SDL2_INCLUDE_DIR})
if(OpenGL_FOUND)
link_directories(${OpenGL_LIBRARY_DIRS})
include_directories(${OpenGL_INCLUDE_DIRS})
endif(OpenGL_FOUND)
if(GLEW_FOUND)
include_directories(${GLEW_INCLUDE_DIRS})
endif(GLEW_FOUND)
set(Boost_USE_MULTITHREADED ON)
find_package( Boost 1.54
COMPONENTS
program_options
filesystem
system
thread
serialization
REQUIRED )
link_directories(${Boost_LIBRARY_DIR})
include_directories(${Boost_INCLUDE_DIRS})
add_definitions(${Boost_LIB_DIAGNOSTIC_DEFINITIONS})
###############################################################################
# Find and setup Qt5
###############################################################################
set( QT_USE_QTOPENGL TRUE )
find_package( Qt5
COMPONENTS
Core
Network
Widgets
Concurrent
OpenGL
Multimedia
REQUIRED
)
find_package(Qt5Multimedia REQUIRED)
include_directories(${Qt5Widgets_INCLUDE_DIRS})
include_directories(${Qt5Concurrent_INCLUDE_DIRS})
include_directories(${Qt5Core_INCLUDE_DIRS})
include_directories(${Qt5Network_INCLUDE_DIRS})
include_directories(${Qt5OpenGL_INCLUDE_DIRS})
###############################################################################
# Compile external libraries
###############################################################################
add_subdirectory(ext/load3ds)
###############################################################################
# Variable for the sources of the binary. In larger projects it is often a
# good idea to use such variables because it is easy to add more source files
# and you can reuse it for several targets (maybe you want to build a library
# some day ;-)
###############################################################################
set(ASTEROID_SOURCES
Main.cpp
#io/PLYIO.cpp #old ply loader
io/PLYTraits.cpp
io/ReadPPM.cpp
io/ReadTGA.cpp
io/ReadJPG.cpp
io/ReadPLY.cpp
io/Read3DS.cpp
io/ReadOBJ.cpp
io/TextureFactory.cpp
io/TriangleMeshFactory.cpp
io/LevelParser.cpp
io/SoundFactory.cpp
math/Matrix.cpp
math/Quaternion.cpp
math/Randomizer.cpp
physics/Transformable.cpp
physics/PhysicalObject.cpp
physics/PhysicsEngine.cpp
physics/ParticleEngine.cpp
rendering/Bullet.cpp
rendering/ParticleEffect.cpp
rendering/Sphere.cpp
rendering/Texture.cpp
rendering/TriangleMesh.cpp
rendering/TexturedMesh.cpp
rendering/Skybox.cpp
rendering/SpaceCraft.cpp
rendering/Asteroid.cpp
util/AsteroidField.cpp
util/ColorMap.cpp
rendering/HealthBar.cpp
rendering/Crosshair.cpp
util/Util.cpp
util/ManageGame.cpp
view/items/Map.cpp
view/items/Planet.cpp
util/MapFactory.cpp
view/GLWidget.cpp
view/HUDWidget.cpp
view/MainWindow.cpp
view/Camera.cpp
view/startscreen.cpp
view/settingwindow.cpp
view/scene2d.cpp
view/loadingscreen.cpp
view/infobar.cpp
view/2DScene/scene2dhandler.cpp
view/2DScene/graphicsplanetitem.cpp
view/2DScene/graphicsmineitem.cpp
view/2DScene/graphicsfactoryitem.cpp
view/2DScene/graphicsfighteritem.cpp
view/2DScene/graphicstransporteritem.cpp
view/2DScene/graphicshqitem.cpp
qtclient/client.cpp
view/loosingscreen.cpp
view/winningscreen.cpp
)
set(ASTEROID_MOCS
view/MainWindow.hpp
view/startscreen.h
view/scene2d.h
view/loadingscreen.h
view/infobar.h
view/settingwindow.h
view/2DScene/itemtypes.h
view/loosingscreen.h
view/winningscreen.h
)
set(ASTEROID_UIS
view/startscreen.ui
view/scene2d.ui
view/loadingscreen.ui
view/infobar.ui
view/settingwindow.ui
view/loosingscreen.ui
view/winningscreen.ui
)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
qt5_wrap_ui(ASTEROID_UI_HDRS ${ASTEROID_UIS})
message(STATUS ${ASTEROID_UI_HDRS})
add_definitions(${QT_DEFINITIONS})
set(ASTEROID_DEPENDS
${Boost_PROGRAM_OPTIONS_LIBRARY}
${Boost_SYSTEM_LIBRARY}
${Boost_THREAD_LIBRARY}
${Boost_FILESYSTEM_LIBRARY}
${GLEW_LIBRARIES}
${GLUT_LIBRARY}
${OPENGL_LIBRARY}
${SDL2_LIBRARY}
${JPEG_LIBRARIES}
${Qt5Widgets_LIBRARIES}
${Qt5Network_LIBRARIES}
c3dsreader
)
###############################################################################
# The executable of our project
###############################################################################
add_executable(asteroids
${ASTEROID_SOURCES}
${C3DSREADER_SOURCES}
${ASTEROID_MOCS}
${ASTEROID_UI_HDRS}
)
qt5_use_modules(asteroids Multimedia)
###############################################################################
# External library dependencys
###############################################################################
target_link_libraries(asteroids ${ASTEROID_DEPENDS})