This repository has been archived by the owner on Nov 1, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 15
/
CMakeLists.txt
224 lines (199 loc) · 10.9 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
cmake_minimum_required(VERSION 3.13)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
add_compile_definitions(_ENABLE_EXTENDED_ALIGNED_STORAGE )
project(Wisp)
option(WISP_BUILD_TESTS "Enable Wisp Tests" ON)
option(WISP_LOG_TO_STDOUT "Allow printing to stdout" ON)
option(WISP_BUILD_SHARED "Build Wisp as a shared library" OFF)
if (WISP_BUILD_SHARED)
set(BUILD_SHARED_LIBS ON)
message(STATUS "Building wisp as a SHARED library")
else()
add_definitions(-DWISPRENDERER_STATIC_DEFINE)
message(STATUS "Building wisp as a STATIC library")
set(BUILD_SHARED_LIBS OFF)
endif()
if (WISP_LOG_TO_STDOUT)
message(STATUS "Wisp Renderer is allowed to print to stdout")
add_definitions(-DWISPRENDERER_LOG_TO_STDOUT)
endif()
#Detect whether we have HBAO+ SDK available.
if(EXISTS ${CMAKE_SOURCE_DIR}/deps/hbao+)
message(STATUS "Found NVIDIA Gameworks HBAO+")
set(NVIDIA_GAMEWORKS_HBAO_LIB ${CMAKE_SOURCE_DIR}/GFSDK_SSAO_D3D12.win64.lib)
add_definitions(-DNVIDIA_GAMEWORKS_HBAO)
configure_file(${CMAKE_SOURCE_DIR}/deps/hbao+/lib/GFSDK_SSAO_D3D12.win64.dll ${CMAKE_SOURCE_DIR} COPYONLY)
configure_file(${CMAKE_SOURCE_DIR}/deps/hbao+/lib/GFSDK_SSAO_D3D12.win64.lib ${CMAKE_SOURCE_DIR} COPYONLY)
else()
message(STATUS "Failed to find NVIDIA Gameworks HBAO+")
endif()
#Detect whether we have the AnselSDK available.
if(EXISTS ${CMAKE_SOURCE_DIR}/deps/ansel)
message(STATUS "Found NVIDIA Gameworks Ansel")
set(NVIDIA_GAMEWORKS_ANSEL_LIB ${CMAKE_SOURCE_DIR}/AnselSDK64.lib)
add_definitions(-DNVIDIA_GAMEWORKS_ANSEL)
configure_file(${CMAKE_SOURCE_DIR}/deps/ansel/lib/AnselSDK64.lib ${CMAKE_SOURCE_DIR} COPYONLY)
configure_file(${CMAKE_SOURCE_DIR}/deps/ansel/redist/AnselSDK64.dll ${CMAKE_SOURCE_DIR} COPYONLY)
else()
message(STATUS "Failed to find NVIDIA Gameworks Ansel")
endif()
##### OUTPUT DIRECTORIES #####
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
configure_file(${CMAKE_SOURCE_DIR}/deps/fallback/Bin/dxrfallbackcompiler.dll ${CMAKE_SOURCE_DIR} COPYONLY)
configure_file(${CMAKE_SOURCE_DIR}/deps/fallback/Bin/dxil.dll ${CMAKE_SOURCE_DIR} COPYONLY)
configure_file(${CMAKE_SOURCE_DIR}/deps/fallback/Bin/dxcompiler.dll ${CMAKE_SOURCE_DIR} COPYONLY)
##### SOURCES #####
file(GLOB HEADERS CONFIGURE_DEPENDS] "${CMAKE_CURRENT_SOURCE_DIR}/src/*.hpp")
file(GLOB SOURCES CONFIGURE_DEPENDS] "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp")
file(GLOB FG_HEADERS CONFIGURE_DEPENDS] "${CMAKE_CURRENT_SOURCE_DIR}/src/frame_graph/*.hpp")
file(GLOB FG_SOURCES CONFIGURE_DEPENDS] "${CMAKE_CURRENT_SOURCE_DIR}/src/frame_graph/*.cpp")
file(GLOB SG_HEADERS CONFIGURE_DEPENDS] "${CMAKE_CURRENT_SOURCE_DIR}/src/scene_graph/*.hpp")
file(GLOB SG_SOURCES CONFIGURE_DEPENDS] "${CMAKE_CURRENT_SOURCE_DIR}/src/scene_graph/*.cpp")
file(GLOB RT_HEADERS CONFIGURE_DEPENDS] "${CMAKE_CURRENT_SOURCE_DIR}/src/render_tasks/*.hpp")
file(GLOB RT_SOURCES CONFIGURE_DEPENDS] "${CMAKE_CURRENT_SOURCE_DIR}/src/render_tasks/*.cpp")
file(GLOB D3D12_HEADERS CONFIGURE_DEPENDS] "${CMAKE_CURRENT_SOURCE_DIR}/src/d3d12/*.hpp")
file(GLOB D3D12_SOURCES CONFIGURE_DEPENDS] "${CMAKE_CURRENT_SOURCE_DIR}/src/d3d12/*.cpp")
file(GLOB UTIL_HEADERS CONFIGURE_DEPENDS] "${CMAKE_CURRENT_SOURCE_DIR}/src/util/*.hpp")
file(GLOB UTIL_SOURCES CONFIGURE_DEPENDS] "${CMAKE_CURRENT_SOURCE_DIR}/src/util/*.cpp")
file(GLOB IMGUI_HEADERS CONFIGURE_DEPENDS] "${CMAKE_CURRENT_SOURCE_DIR}/src/imgui/*.hpp")
file(GLOB IMGUI_SOURCES CONFIGURE_DEPENDS] "${CMAKE_CURRENT_SOURCE_DIR}/src/imgui/*.cpp")
source_group("High Level API" FILES ${SOURCES} ${HEADERS})
source_group("Frame Graph" FILES ${FG_SOURCES} ${FG_HEADERS})
source_group("Scene Graph" FILES ${SG_SOURCES} ${SG_HEADERS})
source_group("Render Tasks" FILES ${RT_SOURCES} ${RT_HEADERS})
source_group("D3D12" FILES ${D3D12_SOURCES} ${D3D12_HEADERS})
source_group("Utility" FILES ${UTIL_SOURCES} ${UTIL_HEADERS})
source_group("ImGui" FILES ${IMGUI_SOURCES} ${IMGUI_HEADERS})
set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT")
set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd")
set (CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /MT")
# Bullet Options
set(BUILD_CPU_DEMOSON OFF CACHE BOOL "" FORCE)
set(USE_GRAPHICAL_BENCHMARKON OFF CACHE BOOL "" FORCE)
set(BUILD_ENETON OFF CACHE BOOL "" FORCE)
set(BUILD_CLSOCKETON OFF CACHE BOOL "" FORCE)
set(BUILD_BULLET2_DEMOSON OFF CACHE BOOL "" FORCE)
set(BUILD_EXTRASON OFF CACHE BOOL "" FORCE)
set(BUILD_UNIT_TESTSON OFF CACHE BOOL "" FORCE)
set(USE_GRAPHICAL_BENCHMARKON OFF CACHE BOOL "" FORCE)
set(BUILD_STATIC_LIBON ON CACHE BOOL "" FORCE)
set(NO_EXPORTON ON CACHE BOOL "" FORCE)
## dependencies ##
add_subdirectory(${CMAKE_SOURCE_DIR}/deps/fmt ${CMAKE_BINARY_DIR}/fmt)
add_subdirectory(${CMAKE_SOURCE_DIR}/deps/DirectXTex ${CMAKE_BINARY_DIR}/DirectXTex)
add_subdirectory(${CMAKE_SOURCE_DIR}/deps/fallback ${CMAKE_BINARY_DIR}/fallback)
add_subdirectory(${CMAKE_SOURCE_DIR}/deps/bullet3 ${CMAKE_BINARY_DIR}/bullet3)
set(ASSIMP_BUILD_SHARED_LIBS OFF)
set(ASSIMP_NO_EXPORT ON CACHE BOOL "" FORCE)
set(ASSIMP_BUILD_TESTS OFF CACHE BOOL "" FORCE)
set(ASSIMP_BUILD_ALL_IMPORTERS_BY_DEFAULT OFF)
set(ASSIMP_BUILD_ALL_EXPORTERS_BY_DEFAULT OFF)
#IMPORTERS
set( ASSIMP_BUILD_AMF_IMPORTER OFF )
set( ASSIMP_BUILD_3DS_IMPORTER OFF )
set( ASSIMP_BUILD_AC_IMPORTER OFF )
set( ASSIMP_BUILD_ASE_IMPORTER OFF )
set( ASSIMP_BUILD_ASSBIN_IMPORTER OFF )
set( ASSIMP_BUILD_ASSXML_IMPORTER OFF )
set( ASSIMP_BUILD_B3D_IMPORTER OFF )
set( ASSIMP_BUILD_BVH_IMPORTER OFF )
set( ASSIMP_BUILD_COLLADA_IMPORTER OFF )
set( ASSIMP_BUILD_DXF_IMPORTER OFF )
set( ASSIMP_BUILD_CSM_IMPORTER OFF )
set( ASSIMP_BUILD_HMP_IMPORTER OFF )
set( ASSIMP_BUILD_IRRMESH_IMPORTER OFF )
set( ASSIMP_BUILD_IRR_IMPORTER OFF )
set( ASSIMP_BUILD_LWO_IMPORTER OFF )
set( ASSIMP_BUILD_LWS_IMPORTER OFF )
set( ASSIMP_BUILD_MD2_IMPORTER OFF )
set( ASSIMP_BUILD_MD3_IMPORTER OFF )
set( ASSIMP_BUILD_MD5_IMPORTER OFF )
set( ASSIMP_BUILD_MDC_IMPORTER OFF )
set( ASSIMP_BUILD_MDL_IMPORTER OFF )
set( ASSIMP_BUILD_NFF_IMPORTER OFF )
set( ASSIMP_BUILD_NDO_IMPORTER OFF )
set( ASSIMP_BUILD_OFF_IMPORTER OFF )
set( ASSIMMP_BUILD_OBJ_IMPORTER ON ) #ON
set( ASSIMP_BUILD_OGRE_IMPORTER OFF )
set( ASSIMP_BUILD_OPENGEX_IMPORTER OFF )
set( ASSIMP_BUILD_PLY_IMPORTER OFF )
set( ASSIMP_BUILD_MS3D_IMPORTER OFF )
set( ASSIMP_BUILD_COB_IMPORTER OFF )
set( ASSIMP_BUILD_BLEND_IMPORTER OFF )
set( ASSIMP_BUILD_IFC_IMPORTER OFF )
set( ASSIMP_BUILD_XGL_IMPORTER OFF )
set( ASSIMMP_BUILD_FBX_IMPORTER ON ) #ON
set( ASSIMP_BUILD_Q3D_IMPORTER OFF )
set( ASSIMP_BUILD_Q3BSP_IMPORTER OFF )
set( ASSIMP_BUILD_RAW_IMPORTER ON ) #ON
set( ASSIMP_BUILD_SIB_IMPORTER ON ) #ON
set( ASSIMP_BUILD_SMD_IMPORTER ON ) #ON
set( ASSIMP_BUILD_STL_IMPORTER OFF )
set( ASSIMP_BUILD_TERRAGEN_IMPORTER OFF )
set( ASSIMP_BUILD_3D_IMPORTER OFF )
set( ASSIMP_BUILD_X_IMPORTER OFF )
set( ASSIMP_BUILD_X3D_IMPORTER OFF )
set( ASSIMP_BUILD_GLTF_IMPORTER ON ) #ON
set( ASSIMP_BUILD_3MF_IMPORTER OFF )
set( ASSIMP_BUILD_MMD_IMPORTER OFF )
# END IMPORTERS
#set(ASSIMP_BUILD_ALL_IMPORTERS_BY_DEFAULT CACHE INTERNAL FALSE)
#set(ASSIMP_BUILD_ALL_IMPORTERS_BY_DEFAULT OFF)
add_subdirectory(${CMAKE_SOURCE_DIR}/deps/assimp ${CMAKE_BINARY_DIR}/assimp)
## dependencies options ##
set(FMT_TEST OFF)
set(FMT_DOC OFF)
set(FMT_PEDANTIC OFF)
set(FMT_WERROR OFF)
## dependencies sorting ##
set_target_properties (fmt PROPERTIES FOLDER ThirdParty)
set_target_properties (DirectXTex PROPERTIES FOLDER ThirdParty)
if (MSVC)
target_compile_options(fmt PRIVATE /W0)
target_compile_options(DirectXTex PRIVATE /W0)
endif()
set_target_properties(Bullet3Common PROPERTIES FOLDER "ThirdParty/Bullet")
set_target_properties(BulletCollision PROPERTIES FOLDER "ThirdParty/Bullet")
set_target_properties(BulletDynamics PROPERTIES FOLDER "ThirdParty/Bullet")
set_target_properties(BulletInverseDynamics PROPERTIES FOLDER "ThirdParty/Bullet")
set_target_properties(BulletSoftBody PROPERTIES FOLDER "ThirdParty/Bullet")
set_target_properties(LinearMath PROPERTIES FOLDER "ThirdParty/Bullet")
set_target_properties(assimp PROPERTIES FOLDER ThirdParty)
set_target_properties(assimp_cmd PROPERTIES FOLDER ThirdParty)
set_target_properties(IrrXML PROPERTIES FOLDER ThirdParty)
set_target_properties(UpdateAssimpLibsDebugSymbolsAndDLLs PROPERTIES FOLDER ThirdParty)
set_target_properties(zlib PROPERTIES FOLDER ThirdParty)
set_target_properties(zlibstatic PROPERTIES FOLDER ThirdParty)
#set_target_properties(unit PROPERTIES FOLDER ThirdParty)
set_target_properties(uninstall PROPERTIES FOLDER ThirdParty)
if(WISP_BUILD_SHARED)
set(WISP_LIB_TYPE SHARED)
else()
set(WISP_LIB_TYPE STATIC)
endif()
add_library(WispRenderer ${WISP_LIB_TYPE} ${HEADERS} ${SOURCES} ${IMGUI_HEADERS} ${IMGUI_SOURCES} ${UTIL_HEADERS} ${UTIL_SOURCES} ${RT_HEADERS} ${RT_SOURCES} ${FG_HEADERS} ${FG_SOURCES} ${SG_HEADERS} ${SG_SOURCES} ${D3D12_SOURCES} ${D3D12_HEADERS})
set_target_properties(WispRenderer PROPERTIES CXX_STANDARD 20)
set_target_properties(WispRenderer PROPERTIES CXX_EXTENSIONS OFF)
set_target_properties(WispRenderer PROPERTIES CMAKE_CXX_STANDARD_REQUIRED ON)
if (MSVC)
target_compile_options(WispRenderer PRIVATE /W4 /permissive- /MP /Gm-)
endif()
target_include_directories(WispRenderer PUBLIC ${CMAKE_SOURCE_DIR}/deps/DirectXTex/DirectXTex/)
target_include_directories(WispRenderer PUBLIC ${CMAKE_SOURCE_DIR}/deps/fmt/include)
target_include_directories(WispRenderer PUBLIC ${CMAKE_SOURCE_DIR}/deps/tinygltf)
target_include_directories(WispRenderer PUBLIC ${CMAKE_SOURCE_DIR}/deps/assimp/include)
target_include_directories(WispRenderer PUBLIC ${CMAKE_SOURCE_DIR}/deps/fallback/Include)
target_include_directories(WispRenderer PUBLIC ${CMAKE_SOURCE_DIR}/deps/hbao+/include)
target_include_directories(WispRenderer PUBLIC ${CMAKE_SOURCE_DIR}/deps/ansel/include)
target_include_directories(WispRenderer PUBLIC ${CMAKE_SOURCE_DIR}/deps/crashpad)
target_include_directories(WispRenderer PUBLIC ${CMAKE_SOURCE_DIR}/deps/crashpad/third_party/mini_chromium/mini_chromium)
target_include_directories(WispRenderer PUBLIC ${CMAKE_SOURCE_DIR}/deps/bullet3/src)
link_directories(${CMAKE_SOURCE_DIR}/deps/crashpad/out/$(ConfigurationName)/obj/ ${CMAKE_SOURCE_DIR}/deps/crashpad/out/$(ConfigurationName)/obj/client/ ${CMAKE_SOURCE_DIR}/deps/crashpad/out/$(ConfigurationName)/obj/util/ ${CMAKE_SOURCE_DIR}/deps/crashpad/out/$(ConfigurationName)/obj/third_party/mini_chromium/mini_chromium/base/)
target_link_libraries(WispRenderer DXRFallback dxguid.lib d3d12.lib dxgi.lib d3dcompiler.lib dxcompiler DirectXTex fmt assimp ${NVIDIA_GAMEWORKS_HBAO_LIB} ${NVIDIA_GAMEWORKS_ANSEL_LIB} crashpad_client crashpad_util base)
set_target_properties(WispRenderer PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/../")
if (WISP_BUILD_TESTS)
add_subdirectory(tests ${CMAKE_BINARY_DIR}/tests)
set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT Demo)
endif()