-
Notifications
You must be signed in to change notification settings - Fork 145
/
CMakeLists.txt
205 lines (173 loc) · 7.27 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
cmake_minimum_required(VERSION 3.12)
project(RenderingCookbook CXX C)
option(BUILD_WITH_EASY_PROFILER "Enable EasyProfiler usage" ON)
option(BUILD_WITH_OPTICK "Enable Optick usage" OFF)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
if(WIN32)
set(PYTHON_EXECUTABLE "python")
else()
set(PYTHON_EXECUTABLE "python3")
endif()
if((NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/deps/.bootstrap.json") OR ("${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt" IS_NEWER_THAN "${CMAKE_CURRENT_SOURCE_DIR}/deps/.bootstrap.json"))
execute_process(
COMMAND ${PYTHON_EXECUTABLE} "bootstrap.py"
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
RESULT_VARIABLE bootstrap_result
)
if (NOT (${bootstrap_result} EQUAL 0))
message(FATAL_ERROR "Cannot run bootstrap.py")
endif()
endif()
set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL "")
set(GLFW_BUILD_TESTS OFF CACHE BOOL "")
set(GLFW_BUILD_DOCS OFF CACHE BOOL "")
set(GLFW_INSTALL OFF CACHE BOOL "")
set(EASY_PROFILER_NO_GUI ON CACHE BOOL "")
set(EASY_PROFILER_NO_SAMPLES ON CACHE BOOL "")
set(ASSIMP_NO_EXPORT ON CACHE BOOL "")
set(ASSIMP_BUILD_DRACO OFF CACHE BOOL "")
set(ASSIMP_BUILD_ASSIMP_TOOLS OFF CACHE BOOL "")
set(ASSIMP_BUILD_TESTS OFF CACHE BOOL "")
set(ASSIMP_INSTALL_PDB OFF CACHE BOOL "")
set(ASSIMP_BUILD_ALL_IMPORTERS_BY_DEFAULT OFF CACHE BOOL "")
set(ASSIMP_BUILD_OBJ_IMPORTER ON CACHE BOOL "")
set(ASSIMP_BUILD_GLTF_IMPORTER ON CACHE BOOL "")
set(MESHOPT_BUILD_DEMO OFF CACHE BOOL "")
set(MESHOPT_BUILD_TOOLS OFF CACHE BOOL "")
set(MESHOPT_BUILD_SHARED_LIBS OFF CACHE BOOL "")
add_subdirectory(deps/src/etc2comp)
if(WIN32)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
endif()
#include_directories(deps/src/vulkan/include)
add_subdirectory(deps/src/glfw)
if(BUILD_WITH_OPTICK)
add_subdirectory(deps/src/optick)
endif()
add_subdirectory(deps/src/easy_sources)
add_subdirectory(deps/src/assimp)
add_subdirectory(deps/src/meshoptimizer)
add_subdirectory(deps/src/volk)
set(ENABLE_GLSLANG_BINARIES OFF CACHE BOOL "")
set(ENABLE_HLSL OFF CACHE BOOL "")
set(ENABLE_CTEST OFF CACHE BOOL "")
set(ENABLE_OPT OFF CACHE BOOL "")
set(SKIP_GLSLANG_INSTALL ON CACHE BOOL "")
add_subdirectory(deps/src/glslang)
include_directories(.)
include_directories(deps/src)
include_directories(deps/src/glfw/include)
include_directories(deps/src/glm)
include_directories(deps/src/gli)
include_directories(deps/glad/include)
include_directories(deps/src/assimp/include)
include_directories(deps/src/etc2comp/EtcLib/Etc)
include_directories(deps/src/etc2comp/EtcLib/EtcCodec)
include_directories(deps/src/glslang/glslang/Include)
include_directories(deps/src/taskflow)
include_directories(deps/src/rapidjson/include)
include_directories(${CMAKE_CURRENT_BINARY_DIR}/deps/src/assimp/include)
include_directories(deps/src/stb)
include_directories(deps/src/glslang)
include_directories(deps/src/glslang/StandAlone)
include_directories(deps/src/glslang/src)
include_directories(deps/src/bullet/src)
include_directories(deps/src/ImGuizmo/src)
add_subdirectory(deps/cmake/bullet)
add_subdirectory(deps/cmake/ImGuizmo)
set(GLAD_SOURCES deps/glad/src/gl.c deps/glad/src/vulkan.c)
if(WIN32)
set(GLAD_SOURCES ${GLAD_SOURCES} deps/glad/src/wgl.c)
endif()
add_library(glad ${GLAD_SOURCES})
if(BUILD_WITH_EASY_PROFILER)
message("Enabled EasyProfiler")
add_definitions(-DBUILD_WITH_EASY_PROFILER=1)
include_directories(deps/src/easy_profiler/include)
set_property(TARGET easy_profiler PROPERTY FOLDER "ThirdPartyLibraries")
set_property(TARGET profiler_converter PROPERTY FOLDER "ThirdPartyLibraries")
endif()
if(BUILD_WITH_OPTICK)
message("Enabled Optick")
add_definitions(-DBUILD_WITH_OPTICK=1)
set_property(TARGET OptickCore PROPERTY FOLDER "ThirdPartyLibraries")
endif()
set_property(TARGET glfw PROPERTY FOLDER "ThirdPartyLibraries")
set_property(TARGET assimp PROPERTY FOLDER "ThirdPartyLibraries")
set_property(TARGET EtcLib PROPERTY FOLDER "ThirdPartyLibraries")
set_property(TARGET EtcTool PROPERTY FOLDER "ThirdPartyLibraries")
set_property(TARGET glad PROPERTY FOLDER "ThirdPartyLibraries")
#set_property(TARGET IrrXML PROPERTY FOLDER "ThirdPartyLibraries")
set_property(TARGET meshoptimizer PROPERTY FOLDER "ThirdPartyLibraries")
set_property(TARGET volk PROPERTY FOLDER "ThirdPartyLibraries")
if(WIN32)
if(TARGET zlibstatic)
set_property(TARGET zlibstatic PROPERTY FOLDER "ThirdPartyLibraries")
endif()
if(TARGET UpdateAssimpLibsDebugSymbolsAndDLLs)
set_property(TARGET UpdateAssimpLibsDebugSymbolsAndDLLs PROPERTY FOLDER "ThirdPartyLibraries")
endif()
endif()
set_property(TARGET uninstall PROPERTY FOLDER "ThirdPartyLibraries")
set_property(TARGET glslang PROPERTY FOLDER "ThirdPartyLibraries/glslang")
set_property(TARGET OGLCompiler PROPERTY FOLDER "ThirdPartyLibraries/glslang")
set_property(TARGET OSDependent PROPERTY FOLDER "ThirdPartyLibraries/glslang")
set_property(TARGET SPIRV PROPERTY FOLDER "ThirdPartyLibraries/glslang")
set_property(TARGET SPVRemapper PROPERTY FOLDER "ThirdPartyLibraries/glslang")
# shared utils code for GL and Vulkan
add_subdirectory(shared)
target_sources(SharedUtils PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/deps/src/glslang/StandAlone/ResourceLimits.cpp
${CMAKE_CURRENT_SOURCE_DIR}/deps/src/glslang/StandAlone/resource_limits_c.cpp)
add_subdirectory(Chapter1/2_CMake)
add_subdirectory(Chapter2/01_GLFW)
add_subdirectory(Chapter2/02_GLM)
add_subdirectory(Chapter2/03_STB)
add_subdirectory(Chapter2/04_ImGui)
add_subdirectory(Chapter2/05_EasyProfiler)
if(BUILD_WITH_OPTICK)
add_subdirectory(Chapter2/06_Optick)
endif()
add_subdirectory(Chapter2/07_Assimp)
add_subdirectory(Chapter2/08_ETC2Comp)
add_subdirectory(Chapter2/09_Taskflow)
add_subdirectory(Chapter2/10_MeshOptimizer)
add_subdirectory(Chapter3/GL01_APIWrapping)
add_subdirectory(Chapter3/GL02_VtxPulling)
add_subdirectory(Chapter3/GL03_CubeMap)
add_subdirectory(Chapter3/VK01_GLSLang)
add_subdirectory(Chapter3/VK02_DemoApp)
add_subdirectory(Chapter4/GL01_Camera)
add_subdirectory(Chapter4/GL02_FPS)
add_subdirectory(Chapter4/VK01_DemoApp)
add_subdirectory(Chapter5/GL01_Grid)
add_subdirectory(Chapter5/GL02_Tessellation)
add_subdirectory(Chapter5/GL03_MeshRenderer)
add_subdirectory(Chapter5/VK01_MultiMeshDraw)
add_subdirectory(Chapter5/MeshConvert)
add_subdirectory(Chapter6/GL01_PBR)
add_subdirectory(Chapter6/VK01_BRDF_LUT)
add_subdirectory(Chapter6/VK02_DescriptorIndexing)
add_subdirectory(Chapter6/VK03_ComputeTexture)
add_subdirectory(Chapter6/VK04_ComputeMesh)
add_subdirectory(Chapter6/VK05_PBR)
add_subdirectory(Chapter6/Util01_FilterEnvmap)
add_subdirectory(Chapter7/GL01_LargeScene)
add_subdirectory(Chapter7/SceneConverter)
add_subdirectory(Chapter7/VK01_SceneGraph)
add_subdirectory(Chapter7/VK02_LargeScene)
add_subdirectory(Chapter8/GL01_ShadowMapping)
add_subdirectory(Chapter8/GL02_SSAO)
add_subdirectory(Chapter8/GL03_HDR)
add_subdirectory(Chapter8/GL04_HDR_Adaptation)
add_subdirectory(Chapter8/VK01_ShadowMapping)
add_subdirectory(Chapter8/VK02_SSAO)
add_subdirectory(Chapter8/VK03_HDR)
add_subdirectory(Chapter9/VK01_Physics)
add_subdirectory(Chapter10/GL01_CullingCPU)
add_subdirectory(Chapter10/GL02_CullingGPU)
add_subdirectory(Chapter10/GL03_OITransparency)
add_subdirectory(Chapter10/GL04_LazyLoading)
add_subdirectory(Chapter10/GL05_Final)
add_subdirectory(Chapter10/VK01_AtomicsTest)
add_subdirectory(Chapter10/VK02_Final)