forked from NVIDIAGameWorks/RTXDI
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
71 lines (60 loc) · 2.25 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
include("${DONUT_PATH}/compileshaders.cmake")
file(GLOB shaders "*.h*" "LightingPasses/*.h*" "DebugViz/*.h*" "../rtxdi-runtime/shaders/*.hlsl" "../rtxdi-runtime/include/*.hlsli")
set(project rtxdi-sample)
set(folder "RTXDI SDK")
set(shaders_target rtxdi-sample-shaders)
add_custom_target(${shaders_target}
DEPENDS ShaderMake
SOURCES ${shaders} Shaders.cfg)
if(TARGET NRD)
set(NRD_OPTIONS -I "${CMAKE_CURRENT_SOURCE_DIR}/../NRD/Shaders/Include" -D WITH_NRD -D NRD_USE_OCT_NORMAL_ENCODING=0 -D NRD_USE_MATERIAL_ID=0)
else()
set(NRD_OPTIONS --relaxedInclude NRD.hlsli)
endif()
set (OUTPUT_PATH_BASE "${CMAKE_BINARY_DIR}/bin/shaders/rtxdi-sample")
if (WIN32)
set (USE_API_OPTION --useAPI)
else()
set (USE_API_OPTION "")
endif()
if (DONUT_WITH_DX12)
set(DX12_COMPILER_OPTIONS
--platform DXIL
--shaderModel 6_5
--binaryBlob
--outputExt .bin
-I ${DONUT_SHADER_INCLUDE_DIR}
-I ${CMAKE_CURRENT_SOURCE_DIR}/../rtxdi-runtime/include
--relaxedInclude "../Types.h"
${NRD_OPTIONS}
${USE_API_OPTION}
--compiler ${DXC_PATH})
add_custom_command(TARGET ${shaders_target} PRE_BUILD
COMMAND ShaderMake
--config ${CMAKE_CURRENT_SOURCE_DIR}/Shaders.cfg
--out ${OUTPUT_PATH_BASE}/dxil
${DX12_COMPILER_OPTIONS})
endif()
if (DONUT_WITH_VULKAN)
set(VULKAN_COMPILER_OPTIONS
--platform SPIRV
--shaderModel 6_5
--vulkanVersion 1.2
--binaryBlob
--outputExt .bin
-I ${DONUT_SHADER_INCLUDE_DIR}
-I ${CMAKE_CURRENT_SOURCE_DIR}/../rtxdi-runtime/include
--relaxedInclude "../Types.h"
${NRD_OPTIONS}
${USE_API_OPTION}
${NVRHI_DEFAULT_VK_REGISTER_OFFSETS}
-D SPIRV
--compiler ${DXC_SPIRV_PATH})
add_custom_command(TARGET ${shaders_target} PRE_BUILD
COMMAND ShaderMake
--config ${CMAKE_CURRENT_SOURCE_DIR}/Shaders.cfg
--out ${OUTPUT_PATH_BASE}/spirv
${VULKAN_COMPILER_OPTIONS})
endif()
set_target_properties(${shaders_target} PROPERTIES FOLDER ${folder})
set_source_files_properties(${shaders} PROPERTIES VS_TOOL_OVERRIDE "None")