-
Notifications
You must be signed in to change notification settings - Fork 3
/
CMakeLists.txt
144 lines (125 loc) · 5.75 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
cmake_minimum_required(VERSION 3.0.0) # Selects the minimum version of CMake required to run this file
project(GFX-LAB VERSION 0.1.0) # Here we select the project name and version
# Here we select C++17 with all the standards required and all compiler-specific extensions disabled
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
# These are the options we select for building GLFW as a library
set(GLFW_BUILD_DOCS OFF CACHE BOOL "" FORCE) # Don't build Documentation
set(GLFW_BUILD_TESTS OFF CACHE BOOL "" FORCE) # Don't build Tests
set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE) # Don't build Examples
set(GLFW_INSTALL OFF CACHE BOOL "" FORCE) # Don't build Installation Information
set(GLFW_USE_HYBRID_HPG ON CACHE BOOL "" FORCE) # Add variables to use High Performance Graphics Card if available
add_subdirectory(vendor/glfw) # Build the GLFW project to use later as a library
# A variable with all the source files of GLAD
set(GLAD_SOURCE vendor/glad/src/gl.c)
# A variables with all the source files of Dear ImGui
set(IMGUI_SOURCES
vendor/imgui/imgui.cpp
vendor/imgui/imgui_demo.cpp
vendor/imgui/imgui_draw.cpp
vendor/imgui/imgui_widgets.cpp
vendor/imgui/imgui_impl/imgui_impl_glfw.cpp
vendor/imgui/imgui_impl/imgui_impl_opengl3.cpp
)
# Combine all vendor source files together into a single variable
set(VENDOR_SOURCES ${GLAD_SOURCE} ${IMGUI_SOURCES})
# A variable with all our source files that are common between executable targets (examples)
set(COMMON_SOURCES
source/common/application.hpp
source/common/application.cpp
source/common/input/keyboard.hpp
source/common/input/mouse.hpp
source/common/asset-loader.cpp
source/common/asset-loader.hpp
source/common/deserialize-utils.hpp
source/common/shader/shader.hpp
source/common/shader/shader.cpp
source/common/mesh/vertex.hpp
source/common/mesh/mesh.hpp
source/common/mesh/mesh-utils.hpp
source/common/mesh/mesh-utils.cpp
source/common/texture/sampler.hpp
source/common/texture/sampler.cpp
source/common/texture/texture2d.hpp
source/common/texture/texture-utils.hpp
source/common/texture/texture-utils.cpp
source/common/texture/screenshot.hpp
source/common/texture/screenshot.cpp
source/common/material/pipeline-state.hpp
source/common/material/pipeline-state.cpp
source/common/material/material.hpp
source/common/material/material.cpp
source/common/ecs/component.hpp
source/common/ecs/transform.hpp
source/common/ecs/transform.cpp
source/common/ecs/entity.hpp
source/common/ecs/entity.cpp
source/common/ecs/world.hpp
source/common/ecs/world.cpp
source/common/components/camera.hpp
source/common/components/camera.cpp
source/common/components/mesh-renderer.hpp
source/common/components/mesh-renderer.cpp
source/common/components/free-camera-controller.hpp
source/common/components/free-camera-controller.cpp
source/common/components/movement.hpp
source/common/components/movement.cpp
source/common/components/component-deserializer.hpp
source/common/components/light.hpp
source/common/components/light.cpp
source/common/components/battery.hpp
source/common/components/battery.cpp
source/common/components/position-point.hpp
source/common/components/position-point.cpp
source/common/systems/forward-renderer.hpp
source/common/systems/forward-renderer.cpp
source/common/systems/free-camera-controller.hpp
source/common/systems/movement.hpp
source/common/systems/crashing.hpp
source/common/systems/energy.hpp
source/common/systems/event-handler.hpp
source/common/systems/delivery.hpp
source/common/systems/big-obstacles.hpp
source/common/systems/car-movement.hpp
source/common/systems/street-lights.hpp
source/common/systems/knife.hpp
source/common/systems/battery-handler.hpp
source/common/systems/sound.hpp
source/common/systems/sound.cpp
source/common/systems/radio.hpp
)
# Define the directories in which to search for the included headers
include_directories(
source/common
vendor/glfw/include
vendor/glad/include
vendor/glm
vendor/imgui
vendor/utils
vendor/bass
)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/bin)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${PROJECT_SOURCE_DIR}/bin)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${PROJECT_SOURCE_DIR}/bin)
set(STATES_SOURCES
source/states/play-state.hpp
source/states/menu-state.hpp
source/states/win-state.hpp
source/states/lose-state.hpp
source/states/shader-test-state.hpp
source/states/mesh-test-state.hpp
source/states/transform-test-state.hpp
source/states/pipeline-test-state.hpp
source/states/texture-test-state.hpp
source/states/sampler-test-state.hpp
source/states/material-test-state.hpp
source/states/entity-test-state.hpp
source/states/renderer-test-state.hpp
)
# For each example, we add an executable target
# Each target compiles one example source file and the common & vendor source files
# Then we link GLFW with each target
add_executable(GAME_APPLICATION source/main.cpp ${STATES_SOURCES} ${COMMON_SOURCES} ${VENDOR_SOURCES})
target_link_directories(GAME_APPLICATION PUBLIC vendor/bass/x64)
target_link_libraries(GAME_APPLICATION glfw bass)