-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
175 lines (148 loc) · 6.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
# CMake version
cmake_minimum_required(VERSION 3.18.6 FATAL_ERROR)
cmake_policy(SET CMP0063 NEW) # visibility
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
set(CMAKE_VISIBILITY_INLINES_HIDDEN 1)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED 20)
# Include cmake modules
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/Builds/CMake")
# Declare project
project(VoxFlow)
# Set output directories
set(DEFAULT_CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
# Set enable output of compile commands during generation
set(CMAKE_EXPORT_COMPILE_COMMANDS ON CACHE INTERNAL "")
# Compile options
include(Builds/CMake/CompileOptions.cmake)
# Build type - Release by default
message("CMake build type: " ${CMAKE_BUILD_TYPE})
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
elseif(CMAKE_BUILD_TYPE MATCHES "Debug")
add_definitions(-DVOXFLOW_DEBUG)
endif()
# Build Options
option(BUILD_COVERAGE "Build code coverage" OFF)
option(GPU_RESOURCE_DEBUG_NAME "Enable vulkan object debug name" ON)
option(CHROME_TRACING "Enable Chrome Tracing for CPU profiling" ON)
option(TASKFLOW_PROFILER, "Enable Taskflow Profiler" ON)
if (CMAKE_BUILD_TYPE MATCHES Debug AND CMAKE_COMPILER_IS_GNUCXX AND BUILD_COVERAGE)
include(CodeCoverage)
setup_target_for_coverage(${PROJECT_NAME}_coverage UnitTests coverage)
endif()
if (GPU_RESOURCE_DEBUG_NAME)
add_definitions(-DVK_DEBUG_NAME_ENABLED)
endif()
if (CHROME_TRACING)
add_definitions(-DENABLE_CHROME_TRACING)
endif()
if (TASKFLOW_PROFILER)
# You can visualize profiled json file at https://taskflow.github.io/tfprof/
add_definitions(-DTF_ENABLE_PROFILER=taskflow_profile.json)
endif()
# Overrides
set(CMAKE_MACOSX_RPATH ON)
# Set resource directory
set(RESOURCES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/Resources/")
# Add definitions for third-party dependencies
add_definitions(-DGLM_FORCE_SWIZZLE)
add_definitions(-DGLM_FORCE_RADIANS)
add_definitions(-DGLM_FORCE_CTOR_INIT)
add_definitions(-DGLM_ENABLE_EXPERIMENTAL)
# Includes
include_directories(Dependencies/src)
include_directories(Dependencies/src/vulkan/include)
include_directories(Dependencies/src/vma/src)
include_directories(Dependencies/src/glfw/include)
include_directories(Dependencies/src/glm)
include_directories(Dependencies/src/assimp/include)
include_directories(Dependencies/src/etc2comp/EtcLib/Etc)
include_directories(Dependencies/src/etc2comp/EtcLib/EtcCodec)
include_directories(Dependencies/src/glslang/glslang/Include)
include_directories(Dependencies/src/taskflow)
include_directories(Dependencies/src/stb)
include_directories(Dependencies/src/cubbyflow/Includes)
include_directories(Dependencies/src/glslang)
include_directories(Dependencies/src/glslang/StandAlone)
include_directories(Dependencies/src/glslang/src)
include_directories(Dependencies/src/ImGuizmo/src)
include_directories(Dependencies/src/spdlog/include)
include_directories(Dependencies/src/json/include)
set(VMA_BUILD_SAMPLE OFF CACHE BOOL "")
set(VMA_BUILD_SAMPLE_SHADERS OFF CACHE BOOL "")
set(VMA_STATIC_VULKAN_FUNCTIONS OFF CACHE BOOL "")
set(VMA_DYNAMIC_VULKAN_FUNCTIONS ON CACHE BOOL "")
set(VMA_DEBUG_INITIALIZE_ALLOCATIONS ON CACHE BOOL "")
set(VMA_RECORDING_ENABLED ON CACHE BOOL "")
add_subdirectory(Dependencies/src/vma)
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 "")
add_subdirectory(Dependencies/src/glfw)
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 "")
add_subdirectory(Dependencies/src/assimp)
set(MESHOPT_BUILD_DEMO OFF CACHE BOOL "")
set(MESHOPT_BUILD_TOOLS OFF CACHE BOOL "")
set(MESHOPT_BUILD_SHARED_LIBS OFF CACHE BOOL "")
add_subdirectory(Dependencies/src/meshoptimizer)
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(Dependencies/src/glslang)
if (WIN32)
set(VOLK_STATIC_DEFINES VK_USE_PLATFORM_WIN32_KHR)
elseif()
# TODO
endif()
add_subdirectory(Dependencies/src/volk)
set(SPIRV_CROSS_CLI OFF CACHE BOOL "" FORCE)
set(SPIRV_CROSS_ENABLE_TESTS OFF CACHE BOOL "")
set(SPIRV_CROSS_ENABLE_HLSL OFF CACHE BOOL "")
set(SPIRV_CROSS_ENABLE_MSL OFF CACHE BOOL "")
set(SPIRV_CROSS_ENABLE_CPP ON CACHE BOOL "")
set(SPIRV_CROSS_ENABLE_REFLECT ON CACHE BOOL "")
set(SPIRV_CROSS_ENABLE_C_API OFF CACHE BOOL "")
add_subdirectory(Dependencies/src/spirv-cross)
set(BUILD_TESTS OFF CACHE BOOL "")
set(BUILD_EXAMPLES OFF CACHE BOOL "")
set(USE_CUDA OFF CACHE BOOL "")
set(BUILD_SONARCLOUD ON CACHE BOOL "")
add_subdirectory(Dependencies/src/cubbyflow)
add_subdirectory(Dependencies/src/etc2comp)
add_subdirectory(Dependencies/src/spdlog)
add_subdirectory(Dependencies/src/backward-cpp)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
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 meshoptimizer PROPERTY FOLDER "ThirdPartyLibraries")
set_property(TARGET volk PROPERTY FOLDER "ThirdPartyLibraries")
if(WIN32)
set_property(TARGET UpdateAssimpLibsDebugSymbolsAndDLLs PROPERTY FOLDER "ThirdPartyLibraries")
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")
# Project modules
add_subdirectory(Sources/VoxFlow/Core)
add_subdirectory(Sources/VoxFlow/Editor)
add_subdirectory(Tests/UnitTests)
add_subdirectory(Tests/RenderingTests)