-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
68 lines (62 loc) · 3 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
cmake_minimum_required(VERSION 3.14 FATAL_ERROR)
project(ComputerGraphics C CXX)
# Set this before including framework such that it knows to use the OpenGL4.5 version of GLAD
if (EXISTS "${CMAKE_CURRENT_LIST_DIR}/framework")
# Create framework library and include CMake scripts (compiler warnings, sanitizers and static analyzers).
add_subdirectory("framework")
else ()
# During development the framework lives in parent folder.
add_subdirectory("../../../framework/" "${CMAKE_BINARY_DIR}/framework/")
endif ()
add_executable(Game
src/application.cpp
src/materials/Material.h
src/materials/Material.cpp
src/managers/MaterialManager.h
src/managers/MaterialManager.cpp
src/materials/Texture.cpp
src/materials/Texture.h
src/mesh.cpp
src/camera.cpp
src/camera.h
src/scene/Scene.cpp
src/scene/Scene.h
src/scene/Entity.h
src/components/Components.h
src/systems/WasdControllerSystem.h
src/systems/RenderSystem.h
src/systems/DebugSystem.h
src/Transform.cpp
src/Transform.h
src/lights/Light.h
src/lights/Light.cpp
src/managers/ShaderManager.cpp
src/managers/TextureManager.h
src/managers/TextureManager.cpp src/components/RobotArmComponents.h src/systems/RobotArmSystem.h src/components/AnimComponents.h src/systems/AnimationSystem.h src/AnimatedMesh.h src/AnimatedMesh.cpp src/managers/SceneManager.cpp src/managers/SceneManager.h)
target_compile_features(Game PRIVATE cxx_std_20)
target_link_libraries(Game PRIVATE CGFramework)
enable_sanitizers(Game)
set_project_warnings(Game)
# We would like to copy the files when they changed. Even if no *.cpp files were modified (and
# thus no build is triggered). We tell CMake that the executable depends on the shader files in
# the build directory. We also tell it how to generate those files (by copying them from the
# shaders folder in this directory). The gather all glsl files in the shaders folder when CMake
# is configured. So if you were to add a shader file then you need to configure CMake again.
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/shaders/")
set(shader_copies "")
# List all *.glsl files in the shaders folder
file(GLOB shader_sources "${CMAKE_CURRENT_LIST_DIR}/shaders/*.glsl")
foreach (shader_file IN LISTS shader_sources)
get_filename_component(file_name ${shader_file} NAME)
message("shader_file: ${file_name}")
add_custom_command(
OUTPUT "${CMAKE_BINARY_DIR}/shaders/${file_name}"
COMMAND ${CMAKE_COMMAND} -E copy
"${CMAKE_CURRENT_LIST_DIR}/shaders/${file_name}"
"${CMAKE_BINARY_DIR}/shaders/${file_name}"
DEPENDS "${CMAKE_CURRENT_LIST_DIR}/shaders/${file_name}"
)
LIST(APPEND shader_copies "${CMAKE_BINARY_DIR}/shaders/${file_name}")
endforeach ()
add_custom_target(copy_shaders DEPENDS ${shader_copies})
add_dependencies(Game copy_shaders)