-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
260 lines (242 loc) · 6.65 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
cmake_minimum_required(VERSION 3.25)
project(demo)
# CMake
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin)
# CPM
include(cmake/CPM.cmake)
# Debug
add_compile_definitions($<$<CONFIG:DEBUG>:DEBUG>)
# Vulkan
add_compile_definitions(VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=1)
add_compile_definitions(VULKAN_HPP_NO_CONSTRUCTORS)
find_package(Vulkan REQUIRED COMPONENTS dxc)
# MSVC
if(MSVC)
add_compile_options(/wd5054)
else()
add_compile_options(-fms-extensions)
endif()
# GLFW
CPMAddPackage(
NAME glfw
GITHUB_REPOSITORY glfw/glfw
GIT_TAG 3.3.8
OPTIONS
"GLFW_BUILD_DOCS OFF"
"GLFW_BUILD_TESTS OFF"
"GLFW_BUILD_EXAMPLES OFF"
)
# OpenGL Mathematics (GLM)
add_compile_definitions(GLM_ENABLE_EXPERIMENTAL)
add_compile_definitions(GLM_FORCE_DEPTH_ZERO_TO_ONE)
add_compile_definitions(GLM_FORCE_RADIANS)
CPMAddPackage(
NAME glm
GITHUB_REPOSITORY g-truc/glm
GIT_TAG 0.9.9.8
)
# Dear ImGui
CPMAddPackage(
NAME imgui
GITHUB_REPOSITORY ocornut/imgui
GIT_TAG v1.89.9
DOWNLOAD_ONLY
)
include_directories(${imgui_SOURCE_DIR} ${imgui_SOURCE_DIR}/backends)
add_library(imgui
${imgui_SOURCE_DIR}/backends/imgui_impl_glfw.cpp
${imgui_SOURCE_DIR}/backends/imgui_impl_glfw.h
${imgui_SOURCE_DIR}/imconfig.h
${imgui_SOURCE_DIR}/imgui.cpp
${imgui_SOURCE_DIR}/imgui.h
${imgui_SOURCE_DIR}/imgui_demo.cpp
${imgui_SOURCE_DIR}/imgui_draw.cpp
${imgui_SOURCE_DIR}/imgui_internal.h
${imgui_SOURCE_DIR}/imgui_tables.cpp
${imgui_SOURCE_DIR}/imgui_widgets.cpp
${imgui_SOURCE_DIR}/imstb_rectpack.h
${imgui_SOURCE_DIR}/imstb_textedit.h
${imgui_SOURCE_DIR}/imstb_truetype.h
)
target_link_libraries(imgui Vulkan::Vulkan glfw)
# KTX (Khronos Texture)
CPMAddPackage(
NAME ktx
GITHUB_REPOSITORY KhronosGroup/KTX-Software
GIT_TAG v4.2.1
OPTIONS
"KTX_FEATURE_STATIC_LIBRARY ON"
"KTX_FEATURE_TESTS OFF"
"KTX_FEATURE_TOOLS OFF"
"KTX_FEATURE_GL_UPLOAD OFF"
"KTX_FEATURE_VK_UPLOAD OFF"
)
# MikkTSpace
CPMAddPackage(
NAME MikkTSpace
VERSION 3e895b4
GITHUB_REPOSITORY mmikk/MikkTSpace
GIT_TAG 3e895b4
DOWNLOAD_ONLY
)
include_directories(${MikkTSpace_SOURCE_DIR})
add_library(MikkTSpace
${MikkTSpace_SOURCE_DIR}/mikktspace.c
${MikkTSpace_SOURCE_DIR}/mikktspace.h
)
# MshIO
CPMAddPackage(
NAME mshio
GITHUB_REPOSITORY qnzhou/MshIO
GIT_TAG v0.0.1
)
# SoLoud
CPMAddPackage(
NAME SoLoud
VERSION 20200207
GITHUB_REPOSITORY jarikomppa/soloud
GIT_TAG RELEASE_20200207
DOWNLOAD_ONLY
)
add_compile_definitions(WITH_MINIAUDIO)
include_directories(${SoLoud_SOURCE_DIR}/include)
add_library(SoLoud
${SoLoud_SOURCE_DIR}/src/audiosource/wav/dr_flac.h
${SoLoud_SOURCE_DIR}/src/audiosource/wav/dr_impl.cpp
${SoLoud_SOURCE_DIR}/src/audiosource/wav/dr_mp3.h
${SoLoud_SOURCE_DIR}/src/audiosource/wav/dr_wav.h
${SoLoud_SOURCE_DIR}/src/audiosource/wav/soloud_wav.cpp
${SoLoud_SOURCE_DIR}/src/audiosource/wav/soloud_wavstream.cpp
${SoLoud_SOURCE_DIR}/src/audiosource/wav/stb_vorbis.c
${SoLoud_SOURCE_DIR}/src/audiosource/wav/stb_vorbis.h
${SoLoud_SOURCE_DIR}/src/backend/miniaudio/miniaudio.h
${SoLoud_SOURCE_DIR}/src/backend/miniaudio/soloud_miniaudio.cpp
${SoLoud_SOURCE_DIR}/src/core/soloud.cpp
${SoLoud_SOURCE_DIR}/src/core/soloud_audiosource.cpp
${SoLoud_SOURCE_DIR}/src/core/soloud_bus.cpp
${SoLoud_SOURCE_DIR}/src/core/soloud_core_3d.cpp
${SoLoud_SOURCE_DIR}/src/core/soloud_core_basicops.cpp
${SoLoud_SOURCE_DIR}/src/core/soloud_core_faderops.cpp
${SoLoud_SOURCE_DIR}/src/core/soloud_core_filterops.cpp
${SoLoud_SOURCE_DIR}/src/core/soloud_core_getters.cpp
${SoLoud_SOURCE_DIR}/src/core/soloud_core_setters.cpp
${SoLoud_SOURCE_DIR}/src/core/soloud_core_voicegroup.cpp
${SoLoud_SOURCE_DIR}/src/core/soloud_core_voiceops.cpp
${SoLoud_SOURCE_DIR}/src/core/soloud_fader.cpp
${SoLoud_SOURCE_DIR}/src/core/soloud_fft.cpp
${SoLoud_SOURCE_DIR}/src/core/soloud_fft_lut.cpp
${SoLoud_SOURCE_DIR}/src/core/soloud_file.cpp
${SoLoud_SOURCE_DIR}/src/core/soloud_filter.cpp
${SoLoud_SOURCE_DIR}/src/core/soloud_misc.cpp
${SoLoud_SOURCE_DIR}/src/core/soloud_queue.cpp
${SoLoud_SOURCE_DIR}/src/core/soloud_thread.cpp
)
# stb
CPMAddPackage(
NAME stb
VERSION 5736b15
GITHUB_REPOSITORY nothings/stb
GIT_TAG 5736b15
DOWNLOAD_ONLY
)
include_directories(${stb_SOURCE_DIR})
# tinygltf
add_compile_definitions(TINYGLTF_NO_EXTERNAL_IMAGE)
add_compile_definitions(TINYGLTF_NO_STB_IMAGE)
add_compile_definitions(TINYGLTF_NO_STB_IMAGE_WRITE)
add_compile_definitions(TINYGLTF_USE_CPP14)
CPMAddPackage(
NAME tinygltf
GITHUB_REPOSITORY syoyo/tinygltf
GIT_TAG v2.8.15
OPTIONS
"TINYGLTF_BUILD_LOADER_EXAMPLE OFF"
"TINYGLTF_HEADER_ONLY ON"
"TINYGLTF_INSTALL OFF"
)
# tinyobjloader
CPMAddPackage(
NAME tinyobjloader
GITHUB_REPOSITORY tinyobjloader/tinyobjloader
GIT_TAG v1.0.6
)
# Vulkan Memory Allocator
CPMAddPackage(
NAME VulkanMemoryAllocator
GITHUB_REPOSITORY GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator
GIT_TAG v3.0.1
)
CPMAddPackage(
NAME VulkanMemoryAllocator_Hpp
GITHUB_REPOSITORY ruberith/VulkanMemoryAllocator-Hpp
GIT_TAG v3.0.1
DOWNLOAD_ONLY
)
include_directories(${VulkanMemoryAllocator_Hpp_SOURCE_DIR}/include)
# demo
add_executable(demo
demo/main.cpp
demo/Audio.cpp
demo/Audio.h
demo/Buffer.h
demo/Camera.cpp
demo/Camera.h
demo/Data.h
demo/Demo.cpp
demo/Demo.h
demo/Descriptor.h
demo/Engine.cpp
demo/Engine.h
demo/GLFW.cpp
demo/GLFW.h
demo/GPU.cpp
demo/GPU.h
demo/GUI.cpp
demo/GUI.h
demo/Image.cpp
demo/Image.h
demo/Model.h
demo/Player.cpp
demo/Player.h
demo/Shader.cpp
demo/Shader.h
demo/Storage.h
demo/SurfaceMesh.h
demo/TangentSpace.h
demo/Uniform.h
demo/Utils.h
demo/VersionNumber.h
demo/Vertex.h
demo/Vulkan.cpp
demo/VulkanDescriptors.cpp
demo/VulkanMemory.cpp
demo/VulkanModels.cpp
demo/VulkanPipelines.cpp
demo/VulkanRender.cpp
demo/VulkanSim.cpp
demo/Vulkan.h
)
target_link_libraries(demo
Vulkan::Vulkan
Vulkan::dxc_lib
glfw
glm::glm
imgui
ktx
MikkTSpace
mshio
SoLoud
tinygltf
tinyobjloader
VulkanMemoryAllocator
)
# Resources
set(RESOURCE_FILES
README.md
)
set_source_files_properties(${RESOURCE_FILES} PROPERTIES HEADER_FILE_ONLY TRUE)
source_group(TREE ${CMAKE_SOURCE_DIR} FILES ${RESOURCE_FILES})
target_sources(demo PRIVATE ${RESOURCE_FILES})