forked from invor/space-lion
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
399 lines (333 loc) · 14.1 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
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
cmake_minimum_required(VERSION 3.16)
project(space-lion)
set(CMAKE_CXX_STANDARD 23)
option(USE_GL "Use OpenGL graphics backend" ON)
option(USE_DX11 "Use DirectX11 graphics backend" OFF)
# Add compile defintion for UWP via cmake optioon
option(UWP "Compile for UWP" OFF)
if(UWP)
add_compile_definitions(_UWP)
#add_compile_definitions(__cplusplus_winrt)
endif()
if(USE_GL)
# try adding glfw by its own cmake file
set(GLFW_BUILD_DOCS OFF CACHE BOOL "Build the GLFW documentation")
set(GLFW_INSTALL OFF CACHE BOOL "Generate installation target")
add_subdirectory(src/External/glfw)
# try adding glowl by its own cmake file
set(GLOWL_OPENGL_INCLUDE "GLAD" CACHE STRING "Choose OpenGL include.")
add_subdirectory(src/External/glowl EXCLUDE_FROM_ALL)
endif()
if(USE_DX11)
# try adding dxowl by its own cmake file
add_subdirectory(src/External/dxowl EXCLUDE_FROM_ALL)
endif()
SET (ENGINECORE_ANIMATION_HEADER_FILES
src/EngineCore/TurntableComponentManager.hpp
src/EngineCore/TagAlongComponentManager.hpp
src/EngineCore/BillboardComponentManager.hpp
src/EngineCore/AnimationSystems.hpp
src/EngineCore/SkinComponentManager.hpp
src/EngineCore/MoveToComponentManager.hpp)
SET (ENGINECORE_ANIMATION_SOURCE_FILES
src/EngineCore/TurntableComponentManager.cpp
src/EngineCore/TagAlongComponentManager.cpp
src/EngineCore/BillboardComponentManager.cpp
src/EngineCore/AnimationSystems.cpp
src/EngineCore/SkinComponentManager.cpp
src/EngineCore/MoveToComponentManager.cpp)
SET (ENGINECORE_COMMON_HEADER_FILES
src/EngineCore/BaseComponentManager.hpp
src/EngineCore/BaseMultiInstanceComponentManager.hpp
src/EngineCore/BaseSingleInstanceComponentManager.hpp
src/EngineCore/BSplineComponent.hpp
src/EngineCore/CooldownTriggerComponentManager.hpp
src/EngineCore/EntityManager.hpp
src/EngineCore/Frame.hpp
src/EngineCore/InputEvent.hpp
src/EngineCore/NameComponentManager.hpp
src/EngineCore/ProximityTriggerComponentManager.hpp
src/EngineCore/TransformComponentManager.hpp
src/EngineCore/TriggerSystems.hpp
src/EngineCore/WorldState.hpp)
SET (ENGINECORE_COMMON_SOURCE_FILES
src/EngineCore/BSplineComponent.cpp
src/EngineCore/CooldownTriggerComponentManager.cpp
src/EngineCore/EntityManager.cpp
src/EngineCore/Frame.cpp
src/EngineCore/NameComponentManager.cpp
src/EngineCore/ProximityTriggerComponentManager.cpp
src/EngineCore/TransformComponentManager.cpp
src/EngineCore/TriggerSystems.cpp
src/EngineCore/WorldState.cpp)
SET (ENGINECORE_GRAPHICS_HEADER_FILES
src/EngineCore/AtmosphereComponentManager.hpp
src/EngineCore/BaseResourceManager.hpp
src/EngineCore/CameraComponent.hpp
src/EngineCore/BoundingBoxComponent.hpp
src/EngineCore/BoundingSphereComponent.hpp
src/EngineCore/BoundingCylinderComponent.hpp
src/EngineCore/GenericTextureLayout.hpp
src/EngineCore/GenericVertexLayout.hpp
src/EngineCore/GeometryBakery.hpp
src/EngineCore/gltfAssetComponentManager.hpp
src/EngineCore/gltfAssetSystems.hpp
src/EngineCore/MaterialComponentManager.hpp
src/EngineCore/MeshComponentManager.hpp
src/EngineCore/OceanComponent.hpp
src/EngineCore/ParticlesComponentManager.hpp
src/EngineCore/PointlightComponent.hpp
src/EngineCore/RenderPass.hpp
src/EngineCore/RenderTaskComponentManager.hpp
src/EngineCore/SunlightComponentManager.hpp
src/EngineCore/LandscapeFeatureCurveComponent.hpp
#src/EngineCore/LandscapeBrickComponent.hpp
)
SET (ENGINECORE_GRAPHICS_SOURCE_FILES
src/EngineCore/AtmosphereComponentManager.cpp
src/EngineCore/CameraComponent.cpp
src/EngineCore/BoundingBoxComponent.cpp
src/EngineCore/BoundingSphereComponent.cpp
src/EngineCore/BoundingCylinderComponent.cpp
src/EngineCore/GeometryBakery.cpp
src/EngineCore/gltfAssetComponentManager.cpp
src/EngineCore/MaterialComponentManager.cpp
src/EngineCore/MeshComponentManager.cpp
src/EngineCore/OceanComponent.cpp
src/EngineCore/PointlightComponent.cpp
src/EngineCore/RenderPass.cpp
src/EngineCore/RenderTaskComponentManager.cpp
src/EngineCore/SunlightComponentManager.cpp
src/EngineCore/LandscapeFeatureCurveComponent.inl
#src/EngineCore/LandscapeBrickComponent.inl
)
SET (ENGINECORE_GRAPHICS_GL_HEADER_FILES
src/EngineCore/OpenGL/AtmosphereRenderPass.hpp
src/EngineCore/OpenGL/BasicRenderingPipeline.hpp
src/EngineCore/OpenGL/GraphicsBackend.hpp
#src/EngineCore/OpenGL/LandscapeSystems.hpp
src/EngineCore/OpenGL/OceanRenderPass.hpp
src/EngineCore/OpenGL/ResourceManager.hpp
src/EngineCore/OpenGL/SkinnedMeshRenderPass.hpp)
SET (ENGINECORE_GRAPHICS_GL_SOURCE_FILES
src/EngineCore/OpenGL/AtmosphereRenderPass.cpp
src/EngineCore/OpenGL/BasicRenderingPipeline.cpp
src/EngineCore/OpenGL/GraphicsBackend.cpp
#src/EngineCore/OpenGL/LandscapeSystems.cpp
src/EngineCore/OpenGL/OceanRenderPass.cpp
src/EngineCore/OpenGL/ResourceManager.cpp
src/EngineCore/OpenGL/SkinnedMeshRenderPass.cpp)
SET (ENGINECORE_GRAPHICS_DX11_HEADER_FILES
src/EngineCore/Dx11/Dx11Frame.hpp
src/EngineCore/Dx11/SimpleForwardRenderingPipeline.hpp
src/EngineCore/Dx11/ResourceManager.hpp
src/EngineCore/Dx11/ParticlesRenderPass.hpp)
SET (ENGINECORE_GRAPHICS_DX11_SOURCE_FILES
src/EngineCore/Dx11/SimpleForwardRenderingPipeline.cpp
src/EngineCore/Dx11/ResourceManager.cpp)
SET (ENGINECORE_PHYSICS_HEADER_FILES
src/EngineCore/AirplanePhysicsComponent.hpp)
SET (ENGINECORE_PHYSICS_SOURCE_FILES
src/EngineCore/AirplanePhysicsComponent.cpp)
SET (ENGINECORE_UTILITY_HEADER_FILES
src/EngineCore/ComponentStorage.hpp
src/EngineCore/MTQueue.hpp
src/EngineCore/ResourceLoading.hpp
src/EngineCore/RingBuffer.hpp
src/EngineCore/SingleInstanceIndexMap.hpp
src/EngineCore/TaskScheduler.hpp
src/EngineCore/types.hpp
src/EngineCore/utility.hpp)
SET (ENGINECORE_UTILITY_SOURCE_FILES
src/EngineCore/ResourceLoading.cpp
src/EngineCore/TaskScheduler.cpp)
SET (EDITOR_FILES
src/Editor/CameraController.hpp
src/Editor/CameraController.cpp)
SET (DX11_VERTEX_SHADER_FILES
resources/shaders/hlsl/static_mesh.vertex.hlsl
resources/shaders/hlsl/static_mesh_unlit.vertex.hlsl
resources/shaders/hlsl/static_mesh_untextured.vertex.hlsl
resources/shaders/hlsl/particles.vertex.hlsl)
SET (DX11_PIXEL_SHADER_FILES
resources/shaders/hlsl/forward_pbr.pixel.hlsl
resources/shaders/hlsl/textured_unlit.pixel.hlsl
resources/shaders/hlsl/particles.pixel.hlsl)
SET (DX11_SHADER_FILES ${DX11_VERTEX_SHADER_FILES} ${DX11_PIXEL_SHADER_FILES})
add_library(SpaceLion "")
add_definitions(-DNOMINMAX)
target_include_directories(
SpaceLion PUBLIC
"${PROJECT_SOURCE_DIR}/src/Editor"
"${PROJECT_SOURCE_DIR}/src/EngineCore"
"${PROJECT_SOURCE_DIR}/src/External/tinygltf"
"${PROJECT_SOURCE_DIR}/src/External/glm"
)
target_sources(SpaceLion
PRIVATE
${EDITOR_FILES}
${ENGINECORE_ANIMATION_HEADER_FILES}
${ENGINECORE_ANIMATION_SOURCE_FILES}
${ENGINECORE_COMMON_HEADER_FILES}
${ENGINECORE_COMMON_SOURCE_FILES}
${ENGINECORE_GRAPHICS_HEADER_FILES}
${ENGINECORE_GRAPHICS_SOURCE_FILES}
${ENGINECORE_PHYSICS_HEADER_FILES}
${ENGINECORE_PHYSICS_SOURCE_FILES}
${ENGINECORE_UTILITY_HEADER_FILES}
${ENGINECORE_UTILITY_SOURCE_FILES}
)
source_group(Editor FILES ${EDITOR_FILES})
source_group(EngineCore\\Animation FILES ${ENGINECORE_ANIMATION_SOURCE_FILES} ${ENGINECORE_ANIMATION_HEADER_FILES})
source_group(EngineCore\\Common FILES ${ENGINECORE_COMMON_HEADER_FILES} ${ENGINECORE_COMMON_SOURCE_FILES})
source_group(EngineCore\\Graphics FILES ${ENGINECORE_GRAPHICS_HEADER_FILES} ${ENGINECORE_GRAPHICS_SOURCE_FILES})
source_group(EngineCore\\Physics FILES ${ENGINECORE_PHYSICS_HEADER_FILES} ${ENGINECORE_PHYSICS_SOURCE_FILES})
source_group(EngineCore\\Utility FILES ${ENGINECORE_UTILITY_HEADER_FILES} ${ENGINECORE_UTILITY_SOURCE_FILES})
SET (EXTERNAL_LODEPNG_FILES
src/External/lodepng/lodepng.h
src/External/lodepng/lodepng.cpp
)
target_include_directories(
SpaceLion PUBLIC
"${PROJECT_SOURCE_DIR}/src/External/lodepng/"
)
source_group(External\\lodepng\\ FILES ${EXTERNAL_LODEPNG_FILES})
SET (EXTERNAL_IMPLOT_FILES
src/External/implot/implot.h
src/External/implot/implot.cpp
src/External/implot/implot_demo.cpp
src/External/implot/implot_internal.h
src/External/implot/implot_items.cpp
)
target_include_directories(
SpaceLion PUBLIC
"${PROJECT_SOURCE_DIR}/src/External/implot/"
)
target_sources(SpaceLion
PRIVATE
${EXTERNAL_IMPLOT_FILES}
)
source_group(External\\implot\\ FILES ${EXTERNAL_IMPLOT_FILES})
if(USE_GL)
SET (EXTERNAL_GLAD_FILES
src/External/glad/include/glad/glad.h
src/External/glad/include/KHR/khrplatform.h
src/External/glad/src/glad.c
)
SET (EXTERNAL_IMGUI_FILES
src/External/imgui/imconfig.h
src/External/imgui/imgui.h
src/External/imgui/imgui.cpp
src/External/imgui/imgui_demo.cpp
src/External/imgui/imgui_draw.cpp
src/External/imgui/imgui_tables.cpp
src/External/imgui/imgui_widgets.cpp
src/External/imgui/backends/imgui_impl_glfw.h
src/External/imgui/backends/imgui_impl_glfw.cpp
src/External/imgui/backends/imgui_impl_opengl3.h
src/External/imgui/backends/imgui_impl_opengl3.cpp
src/External/imgui/imstb_rectpack.h
src/External/imgui/imstb_textedit.h
src/External/imgui/imstb_truetype.h
)
SET (EXTERNAL_GLOWL_FILES
src/External/glowl/include/glowl/BufferObject.hpp
src/External/glowl/include/glowl/Exceptions.hpp
src/External/glowl/include/glowl/FramebufferObject.hpp
src/External/glowl/include/glowl/glowl.h
src/External/glowl/include/glowl/GLSLProgram.hpp
src/External/glowl/include/glowl/Mesh.hpp
src/External/glowl/include/glowl/Texture.hpp
src/External/glowl/include/glowl/Texture2D.hpp
src/External/glowl/include/glowl/Texture2DView.hpp
src/External/glowl/include/glowl/Texture2DArray.hpp
src/External/glowl/include/glowl/Texture3D.hpp
src/External/glowl/include/glowl/Texture3DView.hpp
src/External/glowl/include/glowl/TextureCubemapArray.hpp
src/External/glowl/include/glowl/VertexLayout.hpp
)
target_include_directories(
SpaceLion PUBLIC
"${PROJECT_SOURCE_DIR}/src/External/glad/include"
"${PROJECT_SOURCE_DIR}/src/External/glfw/include"
"${PROJECT_SOURCE_DIR}/src/External/imgui/"
"${PROJECT_SOURCE_DIR}/src/External/lodepng/"
)
target_link_libraries(SpaceLion PUBLIC glowl glfw ${GLFW_LIBRARIES})
target_sources(SpaceLion
PRIVATE
${ENGINECORE_GRAPHICS_GL_HEADER_FILES}
${ENGINECORE_GRAPHICS_GL_SOURCE_FILES}
${EXTERNAL_GLAD_FILES}
${EXTERNAL_IMGUI_FILES}
${EXTERNAL_LODEPNG_FILES}
${EXTERNAL_GLOWL_FILES}
)
source_group(EngineCore\\Graphics\\OpenGL FILES ${ENGINECORE_GRAPHICS_GL_HEADER_FILES} ${ENGINECORE_GRAPHICS_GL_SOURCE_FILES})
source_group(External\\glad\\ FILES ${EXTERNAL_GLAD_FILES})
source_group(External\\imgui\\ FILES ${EXTERNAL_IMGUI_FILES})
source_group(External\\glowl\\ FILES ${EXTERNAL_GLOWL_FILES})
endif()
if(USE_DX11)
set_property(SOURCE ${DX11_SHADER_FILES} PROPERTY VS_SHADER_ENTRYPOINT Main)
set_property(SOURCE ${DX11_SHADER_FILES} PROPERTY VS_SHADER_MODEL 5.0)
set_property(SOURCE ${DX11_SHADER_FILES} PROPERTY VS_SHADER_FLAGS /Zi)
set_property(SOURCE ${DX11_VERTEX_SHADER_FILES} PROPERTY VS_SHADER_TYPE Vertex)
set_property(SOURCE ${DX11_PIXEL_SHADER_FILES} PROPERTY VS_SHADER_TYPE Pixel)
SET (EXTERNAL_IMGUI_FILES
src/External/imgui/imconfig.h
src/External/imgui/imgui.h
src/External/imgui/imgui.cpp
src/External/imgui/imgui_demo.cpp
src/External/imgui/imgui_draw.cpp
src/External/imgui/imgui_internal.h
src/External/imgui/imgui_tables.cpp
src/External/imgui/imgui_widgets.cpp
src/External/imgui/backends/imgui_impl_dx11.h
src/External/imgui/backends/imgui_impl_dx11.cpp
src/External/imgui/imstb_rectpack.h
src/External/imgui/imstb_textedit.h
src/External/imgui/imstb_truetype.h
)
SET (EXTERNAL_DXOWL_FILES
src/External/dxowl/include/dxowl/Buffer.hpp
src/External/dxowl/include/dxowl/RenderTarget.hpp
src/External/dxowl/include/dxowl/ShaderProgram.hpp
src/External/dxowl/include/dxowl/Mesh.hpp
src/External/dxowl/include/dxowl/Texture2D.hpp
src/External/dxowl/include/dxowl/Texture3D.hpp
src/External/dxowl/include/dxowl/VertexDescriptor.hpp
)
target_include_directories(
SpaceLion PUBLIC
"${PROJECT_SOURCE_DIR}/src/External/imgui/"
)
target_link_libraries(SpaceLion PUBLIC dxowl)
target_sources(SpaceLion
PRIVATE
${ENGINECORE_GRAPHICS_DX11_HEADER_FILES}
${ENGINECORE_GRAPHICS_DX11_SOURCE_FILES}
${EXTERNAL_IMGUI_FILES}
${EXTERNAL_DXOWL_FILES}
${DX11_SHADER_FILES}
)
source_group(EngineCore\\Graphics\\DX11 FILES ${ENGINECORE_GRAPHICS_DX11_HEADER_FILES} ${ENGINECORE_GRAPHICS_DX11_SOURCE_FILES})
source_group(External\\imgui\\ FILES ${EXTERNAL_IMGUI_FILES})
source_group(External\\dxowl\\ FILES ${EXTERNAL_DXOWL_FILES})
source_group(Resources\\Shaders\\ FILES ${DX11_SHADER_FILES})
endif()
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
# for now, in place example
#add_executable(example "")
#
#target_sources(example
# PRIVATE
# src/EngineCore/main.cpp
#)
#
#target_link_libraries(example PUBLIC EngineCore)
#
#target_include_directories(example PUBLIC
# "${PROJECT_BINARY_DIR}"
# "${PROJECT_SOURCE_DIR}/src/EngineCore"
# )