-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
326 lines (281 loc) · 9.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
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
cmake_minimum_required(VERSION 3.15)
set(CMAKE_POLICY_DEFAULT_CMP0077 NEW)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
set(CMAKE_DEBUG_POSTFIX "-debug")
set(CMAKE_RELWITHDEBINFO_POSTFIX "-reldbg")
set_directory_properties(PROPERTIES COMPILE_DEFINITIONS_DEBUG "_DEBUG")
list(INSERT CMAKE_MODULE_PATH 0 ${CMAKE_CURRENT_LIST_DIR}/cmake)
include(${CMAKE_CURRENT_LIST_DIR}/cmake/utils.cmake)
if (WIN32)
set(VCPKG_TARGET_TRIPLET x64-windows-static-md)
endif()
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_CURRENT_SOURCE_DIR}/vcpkg/scripts/buildsystems/vcpkg.cmake CACHE STRING "Vcpkg toolchain file")
set(APP_NAME ${PROJECT_NAME})
set(REZONALITY_ROOT ${CMAKE_CURRENT_LIST_DIR})
project(Rezonality VERSION 0.1.0.0)
# Set additional project information
set(COMPANY "Rezonality")
set(COPYRIGHT "Copyright (c) 2022 Rezonality")
set(IDENTIFIER "com.rezonality.vklive")
find_package(unofficial-minizip CONFIG REQUIRED)
find_package(Vulkan REQUIRED) # Vulkan API
find_package(assimp CONFIG REQUIRED) # Asset import for loading models
find_package(clipp CONFIG REQUIRED) # Commandline parser for command line arguments
find_package(fmt CONFIG REQUIRED) # String formatting library
find_package(reproc++ REQUIRED) # Process launch library for loading shader compiler binary
find_package(SDL2 CONFIG REQUIRED) # SDL UI library for creating windows, etc.
find_package(unofficial-concurrentqueue REQUIRED) # Concurrent lock/free queue for thread interactions
find_package(tinyfiledialogs CONFIG REQUIRED) # File dialogs that look OS specific and more standard
find_package(unofficial-nativefiledialog CONFIG REQUIRED) # File dialogs that look OS specific and more standard
find_package(unofficial-spirv-reflect CONFIG REQUIRED)
#find_package(VulkanMemoryAllocator CONFIG REQUIRED)
find_package(gli CONFIG REQUIRED)
find_path(STB_INCLUDE_DIRS "stb_c_lexer.h")
find_package(range-v3 CONFIG REQUIRED)
find_path(TSL_ORDERED_MAP_INCLUDE_DIRS "tsl/ordered_hash.h")
find_package(lodepng CONFIG REQUIRED)
# Set this if we are sitting on SDL
add_definitions(-DZEP_USE_SDL -DGLM_ENABLE_EXPERIMENTAL)
# Vulkan can use dynamic dispatch extensions
add_definitions(-DVULKAN_HPP_DISPATCH_LOADER_DYNAMIC=1)
# Set this to get the default file system
add_definitions(-DZEP_FEATURE_CPP_FILE_SYSTEM)
if(MSVC)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
else()
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG -DDEBUG")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG -DDEBUG" )
endif()
set(ZING_LIBRARY_ONLY ON)
set(ZEST_BUILD_TESTS OFF)
add_definitions(-DIMGUI_DISABLE_INCLUDE_IMCONFIG_H)
add_subdirectory(libs/zing)
# Set this to use a lib instead of the single header build
set (ZEP_LIB 1)
if (DEFINED ZEP_LIB)
add_subdirectory(zep/src)
else()
add_definitions(-DZEP_SINGLE_HEADER=1)
endif()
set(VKLIVE_ROOT ${CMAKE_CURRENT_LIST_DIR})
configure_file(${CMAKE_CURRENT_LIST_DIR}/cmake/config_app.h.cmake ${CMAKE_BINARY_DIR}/config_app.h)
set(VULKAN_SOURCES
src/vulkan/vulkan_bindings.cpp
src/vulkan/vulkan_buffer.cpp
src/vulkan/vulkan_command.cpp
src/vulkan/vulkan_context.cpp
src/vulkan/vulkan_debug.cpp
src/vulkan/vulkan_descriptor.cpp
src/vulkan/vulkan_device.cpp
src/vulkan/vulkan_imgui.cpp
src/vulkan/vulkan_nanovg.cpp
src/vulkan/vulkan_imgui_viewports.cpp
src/vulkan/vulkan_imgui_texture.cpp
src/vulkan/vulkan_model.cpp
src/vulkan/vulkan_model_as.cpp
src/vulkan/vulkan_pass.cpp
src/vulkan/vulkan_pipeline.cpp
src/vulkan/vulkan_reflect.cpp
src/vulkan/vulkan_render.cpp
src/vulkan/vulkan_scene.cpp
src/vulkan/vulkan_shader.cpp
src/vulkan/vulkan_surface.cpp
src/vulkan/vulkan_uniform.cpp
src/vulkan/vulkan_utils.cpp
src/vulkan/vulkan_window.cpp
include/vklive/vulkan/vulkan_buffer.h
include/vklive/vulkan/vulkan_command.h
include/vklive/vulkan/vulkan_context.h
include/vklive/vulkan/vulkan_debug.h
include/vklive/vulkan/vulkan_descriptor.h
include/vklive/vulkan/vulkan_device.h
include/vklive/vulkan/vulkan_imgui.h
include/vklive/vulkan/vulkan_nanovg.h
include/vklive/vulkan/vulkan_imgui_texture.h
include/vklive/vulkan/vulkan_model.h
include/vklive/vulkan/vulkan_pass.h
include/vklive/vulkan/vulkan_pipeline.h
include/vklive/vulkan/vulkan_reflect.h
include/vklive/vulkan/vulkan_render.h
include/vklive/vulkan/vulkan_scene.h
include/vklive/vulkan/vulkan_shader.h
include/vklive/vulkan/vulkan_surface.h
include/vklive/vulkan/vulkan_uniform.h
include/vklive/vulkan/vulkan_utils.h
include/vklive/vulkan/vulkan_window.h
include/vklive/vulkan/nanovg_vk.h
)
set(EXTERNAL_DIR libs)
set(CLIP_SOURCE
${EXTERNAL_DIR}/clip/clip.cpp
${EXTERNAL_DIR}/clip/image.cpp
)
if(WIN32)
LIST(APPEND CLIP_SOURCE
${EXTERNAL_DIR}/clip/clip_win.cpp)
endif()
if (UNIX)
if (APPLE)
LIST(APPEND CLIP_SOURCE
${EXTERNAL_DIR}/clip/clip_osx.mm)
else()
LIST(APPEND CLIP_SOURCE
${EXTERNAL_DIR}/clip/clip_x11.cpp)
endif() # APPLE
endif() # UNIX
set(VK_SOURCES
src/camera.cpp
#src/imgui/imgui_utils.cpp
src/model.cpp
src/process/process.cpp
src/scene.cpp
src/validation.cpp
src/python_scripting.cpp
libs/mpc/mpc.c
include/vklive/IDevice.h
include/vklive/camera.h
include/vklive/model.h
include/vklive/process/process.h
include/vklive/scene.h
include/vklive/validation.h
include/vklive/python_scripting.h
)
set(LIB_SOURCES
${VULKAN_SOURCES}
${VK_SOURCES}
)
set(APP_SOURCES
TODO.md
README.md
app/src/config.cpp
app/src/controller.cpp
app/src/editor.cpp
app/src/main.cpp
app/src/window_render.cpp
app/src/window_targets.cpp
app/src/window_sequencer.cpp
app/src/menu.cpp
app/src/project.cpp
app/include/app/config.h
app/include/app/controller.h
app/include/app/editor.h
app/include/app/menu.h
app/include/app/project.h
app/include/app/window_sequencer.h
app/include/app/window_render.h
app/include/app/window_targets.h
)
set_source_files_properties (libs/mpc/mpc.c PROPERTIES SKIP_PRECOMPILE_HEADERS 1)
set_source_files_properties (src/python_scripting.cpp PROPERTIES SKIP_PRECOMPILE_HEADERS 1)
add_library(vklive ${LIB_SOURCES})
target_link_libraries(vklive
PUBLIC
Vulkan::Vulkan
reproc++
assimp::assimp
fmt::fmt-header-only
range-v3
range-v3-meta
range-v3::meta
range-v3-concepts
Zing::Zing
lodepng
)
target_precompile_headers(vklive
PRIVATE
include/vklive/vulkan/vulkan_context.h
)
if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
target_link_libraries(vklive PUBLIC atomic)
endif()
if(WIN32)
# Symbols for release builds on windows
target_compile_options(vklive PRIVATE "$<$<CONFIG:Release>:/Zi>")
target_link_options(vklive PRIVATE "$<$<CONFIG:Release>:/DEBUG>")
target_link_options(vklive PRIVATE "$<$<CONFIG:Release>:/OPT:REF>")
target_link_options(vklive PRIVATE "$<$<CONFIG:Release>:/OPT:ICF>")
endif()
target_include_directories(vklive
PUBLIC
${CMAKE_CURRENT_LIST_DIR}/include
PRIVATE
${CMAKE_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/libs
${TSL_ORDERED_MAP_INCLUDE_DIRS}
)
# App
set(APP_ROOT ${CMAKE_CURRENT_LIST_DIR}/app)
include(${APP_ROOT}/cmake/demo_common.cmake)
set(RESOURCE_FOLDER ${CMAKE_CURRENT_LIST_DIR}/app/res)
add_project_meta(META_FILES_TO_INCLUDE ${CMAKE_CURRENT_LIST_DIR}/app/res/app.manifest)
add_executable(Rezonality ${OS_BUNDLE} ${APP_SOURCES} ${CLIP_SOURCE} ${META_FILES_TO_INCLUDE})
target_include_directories(Rezonality
PRIVATE
${CMAKE_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/zep/include
${CMAKE_CURRENT_LIST_DIR}/app/include
${CMAKE_CURRENT_LIST_DIR}/libs
${STB_INCLUDE_DIRS}
)
target_link_libraries(Rezonality
PUBLIC
vklive
tinyfiledialogs::tinyfiledialogs
PRIVATE
$<TARGET_NAME_IF_EXISTS:SDL2::SDL2main>
$<IF:$<TARGET_EXISTS:SDL2::SDL2>,SDL2::SDL2,SDL2::SDL2-static>
unofficial::concurrentqueue::concurrentqueue
clipp::clipp
unofficial::nativefiledialog::nfd
unofficial::spirv-reflect
gli
Zing::Zing
)
if(WIN32)
# Symbols
target_compile_options(Rezonality PRIVATE "$<$<CONFIG:Release>:/Zi>")
target_link_options(Rezonality PRIVATE "$<$<CONFIG:Release>:/DEBUG>")
target_link_options(Rezonality PRIVATE "$<$<CONFIG:Release>:/OPT:REF>")
target_link_options(Rezonality PRIVATE "$<$<CONFIG:Release>:/OPT:ICF>")
endif()
if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
target_link_libraries(Rezonality PRIVATE X11 Xext xcb)
endif()
if (DEFINED ZEP_LIB)
target_link_libraries(Rezonality PRIVATE Zep::Zep)
endif()
if (APPLE)
install(TARGETS Rezonality
EXPORT rezonality-targets
COMPONENT binaries
BUNDLE DESTINATION . COMPONENT Runtime
RUNTIME DESTINATION bin COMPONENT Runtime
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
INCLUDES DESTINATION ${LIBLEGACY_INCLUDE_DIRS})
else()
if (FALSE)
# Artifacts are seperate, not in the bundle
install(
DIRECTORY
${REZONALITY_ROOT}/run_tree
TYPE BIN
)
install(TARGETS Rezonality
EXPORT rezonality-targets
COMPONENT binaries
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
INCLUDES DESTINATION ${LIBLEGACY_INCLUDE_DIRS}
)
endif()
endif()
source_group (vklive//vulkan FILES ${VULKAN_SOURCES})
source_group (vklive FILES ${VK_SOURCES})
source_group (app FILES ${APP_SOURCES})