Skip to content

Commit 514b321

Browse files
AnastaZIukdeprilula28
authored andcommitted
save work: attempt 1 of fixing DXC in order to make it support being added via sub-directory - update DXC submodule with WX flag mess corrections and temporary uncomment and exchange CMake variables to try to build DXC via sub-directory
1 parent ccc30fa commit 514b321

File tree

3 files changed

+71
-61
lines changed

3 files changed

+71
-61
lines changed

3rdparty/CMakeLists.txt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -120,13 +120,13 @@ set(ZLIB_LIBRARY # for PNGLIB purposes
120120
CACHE INTERNAL "" FORCE)
121121

122122

123-
set(SPIRV_HEADERS_SKIP_INSTALL ON CACHE INTERNAL "Skip SPIRV-Headers install")
124-
set(SPIRV_HEADERS_SKIP_EXAMPLES ON CACHE INTERNAL "Skip SPIRV-Headers examples")
125-
add_subdirectory(dxc/dxc/external/SPIRV-Headers dxc/external/SPIRV-Headers EXCLUDE_FROM_ALL)
126-
set(SKIP_SPIRV_TOOLS_INSTALL ON CACHE INTERNAL "Skip SPIRV-Tools install")
127-
set(SPIRV_SKIP_TESTS ON CACHE INTERNAL "Skip SPIRV-Tools tests")
128-
set(SPIRV_SKIP_EXECUTABLES ON CACHE INTERNAL "Skip SPIRV-Tools executable build")
129-
add_subdirectory(dxc/dxc/external/SPIRV-Tools dxc/external/SPIRV-Tools EXCLUDE_FROM_ALL)
123+
#set(SPIRV_HEADERS_SKIP_INSTALL ON CACHE INTERNAL "Skip SPIRV-Headers install")
124+
#set(SPIRV_HEADERS_SKIP_EXAMPLES ON CACHE INTERNAL "Skip SPIRV-Headers examples")
125+
#add_subdirectory(dxc/dxc/external/SPIRV-Headers dxc/external/SPIRV-Headers EXCLUDE_FROM_ALL)
126+
#set(SKIP_SPIRV_TOOLS_INSTALL ON CACHE INTERNAL "Skip SPIRV-Tools install")
127+
#set(SPIRV_SKIP_TESTS ON CACHE INTERNAL "Skip SPIRV-Tools tests")
128+
#set(SPIRV_SKIP_EXECUTABLES ON CACHE INTERNAL "Skip SPIRV-Tools executable build")
129+
#add_subdirectory(dxc/dxc/external/SPIRV-Tools dxc/external/SPIRV-Tools EXCLUDE_FROM_ALL)
130130
set(SKIP_GLSLANG_INSTALL ON CACHE INTERNAL "Skip glslang install")
131131
set(ENABLE_SPVREMAPPER OFF CACHE INTERNAL "SPVRemapper is a spirv compression experimental library")
132132
set(ENABLE_GLSLANG_BINARIES OFF CACHE INTERNAL "Build glslangValidator and spirv-remap?")

3rdparty/dxc/CMakeLists.txt

Lines changed: 63 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,74 @@
1-
list(APPEND DXC_CMAKE_ARGS "-DHLSL_OPTIONAL_PROJS_IN_DEFAULT:BOOL=OFF")
2-
list(APPEND DXC_CMAKE_ARGS "-DHLSL_ENABLE_ANALYZE:BOOL=OFF")
3-
list(APPEND DXC_CMAKE_ARGS "-DHLSL_OFFICIAL_BUILD:BOOL=OFF")
4-
list(APPEND DXC_CMAKE_ARGS "-DHLSL_ENABLE_FIXED_VER:BOOL=OFF")
5-
list(APPEND DXC_CMAKE_ARGS "-DHLSL_ENABLE_FIXED_VER:BOOL=OFF")
6-
list(APPEND DXC_CMAKE_ARGS "-DHLSL_FIXED_VERSION_LOCATION:STRING=")
7-
list(APPEND DXC_CMAKE_ARGS "-DHLSL_BUILD_DXILCONV:BOOL=ON")
8-
list(APPEND DXC_CMAKE_ARGS "-DCLANG_VENDOR:STRING=")
9-
list(APPEND DXC_CMAKE_ARGS "-DENABLE_SPIRV_CODEGEN:BOOL=ON")
10-
list(APPEND DXC_CMAKE_ARGS "-DSPIRV_BUILD_TESTS:BOOL=OFF")
11-
list(APPEND DXC_CMAKE_ARGS "-DCLANG_ENABLE_ARCMT:BOOL=OFF")
12-
list(APPEND DXC_CMAKE_ARGS "-DCLANG_ENABLE_STATIC_ANALYZER:BOOL=OFF")
13-
list(APPEND DXC_CMAKE_ARGS "-DCLANG_INCLUDE_TESTS:BOOL=Off")
14-
list(APPEND DXC_CMAKE_ARGS "-DLLVM_INCLUDE_TESTS:BOOL=Off")
15-
list(APPEND DXC_CMAKE_ARGS "-DHLSL_INCLUDE_TESTS:BOOL=OFF")
16-
list(APPEND DXC_CMAKE_ARGS "-DLLVM_TARGETS_TO_BUILD:STRING=None")
17-
list(APPEND DXC_CMAKE_ARGS "-DLLVM_INCLUDE_DOCS:BOOL=OFF")
18-
list(APPEND DXC_CMAKE_ARGS "-DLLVM_INCLUDE_TESTS:BOOL=OFF")
19-
list(APPEND DXC_CMAKE_ARGS "-DLLVM_INCLUDE_EXAMPLES:BOOL=OFF")
20-
list(APPEND DXC_CMAKE_ARGS "-DLIBCLANG_BUILD_STATIC:BOOL=ON")
21-
list(APPEND DXC_CMAKE_ARGS "-DLLVM_OPTIMIZED_TABLEGEN:BOOL=OFF")
22-
list(APPEND DXC_CMAKE_ARGS "-DLLVM_REQUIRES_EH:BOOL=ON")
23-
list(APPEND DXC_CMAKE_ARGS "-DLLVM_APPEND_VC_REV:BOOL=ON")
24-
list(APPEND DXC_CMAKE_ARGS "-DLLVM_ENABLE_RTTI:BOOL=ON")
25-
list(APPEND DXC_CMAKE_ARGS "-DLLVM_ENABLE_EH:BOOL=ON")
26-
list(APPEND DXC_CMAKE_ARGS "-DLLVM_DEFAULT_TARGET_TRIPLE:STRING=dxil-ms-dx")
27-
list(APPEND DXC_CMAKE_ARGS "-DCLANG_BUILD_EXAMPLES:BOOL=OFF")
28-
list(APPEND DXC_CMAKE_ARGS "-DLLVM_REQUIRES_RTTI:BOOL=ON")
29-
list(APPEND DXC_CMAKE_ARGS "-DCLANG_CL:BOOL=OFF")
30-
list(APPEND DXC_CMAKE_ARGS "-DCMAKE_SYSTEM_VERSION=10.0.17763.0")
31-
list(APPEND DXC_CMAKE_ARGS "-DDXC_BUILD_ARCH=x64")
1+
set(HLSL_OPTIONAL_PROJS_IN_DEFAULT OFF CACHE BOOL "")
2+
set(HLSL_ENABLE_ANALYZE OFF CACHE BOOL "")
3+
set(HLSL_OFFICIAL_BUILD OFF CACHE BOOL "")
4+
set(HLSL_ENABLE_FIXED_VER OFF CACHE BOOL "")
5+
set(HLSL_ENABLE_FIXED_VER OFF CACHE BOOL "")
6+
set(HLSL_FIXED_VERSION_LOCATION "" CACHE STRING "")
7+
set(HLSL_BUILD_DXILCONV ON CACHE BOOL "")
8+
set(CLANG_VENDOR "" CACHE STRING "")
9+
set(ENABLE_SPIRV_CODEGEN ON CACHE BOOL "")
10+
set(SPIRV_BUILD_TESTS OFF CACHE BOOL "")
11+
set(CLANG_ENABLE_ARCMT OFF CACHE BOOL "")
12+
set(CLANG_ENABLE_STATIC_ANALYZER OFF CACHE BOOL "")
13+
set(CLANG_INCLUDE_TESTS Off CACHE BOOL "")
14+
set(LLVM_INCLUDE_TESTS Off CACHE BOOL "")
15+
set(HLSL_INCLUDE_TESTS OFF CACHE BOOL "")
16+
set(LLVM_TARGETS_TO_BUILD None CACHE STRING "")
17+
set(LLVM_INCLUDE_DOCS OFF CACHE BOOL "")
18+
set(LLVM_INCLUDE_TESTS OFF CACHE BOOL "")
19+
set(LLVM_INCLUDE_EXAMPLES OFF CACHE BOOL "")
20+
set(LIBCLANG_BUILD_STATIC ON CACHE BOOL "")
21+
set(LLVM_OPTIMIZED_TABLEGEN OFF CACHE BOOL "")
22+
set(LLVM_REQUIRES_EH ON CACHE BOOL "")
23+
set(LLVM_APPEND_VC_REV ON CACHE BOOL "")
24+
set(LLVM_ENABLE_RTTI ON CACHE BOOL "")
25+
set(LLVM_ENABLE_EH ON CACHE BOOL "")
26+
set(LLVM_DEFAULT_TARGET_TRIPLE "dxil-ms-dx" CACHE STRING "")
27+
set(CLANG_BUILD_EXAMPLES OFF CACHE BOOL "")
28+
set(LLVM_REQUIRES_RTTI ON CACHE BOOL "")
29+
set(CLANG_CL OFF CACHE BOOL "")
30+
set(LLVM_ENABLE_WERROR OFF CACHE BOOL "" FORCE)
31+
set(SPIRV_WERROR OFF CACHE BOOL "" FORCE)
32+
#set(CMAKE_SYSTEM_VERSION=10.0.17763.0")
33+
set(DXC_BUILD_ARCH x64 CACHE STRING "")
34+
set(SPIRV_HEADERS_SKIP_INSTALL ON CACHE INTERNAL "Skip SPIRV-Headers install")
35+
set(SPIRV_HEADERS_SKIP_EXAMPLES ON CACHE INTERNAL "Skip SPIRV-Headers examples")
36+
set(SKIP_SPIRV_TOOLS_INSTALL ON CACHE INTERNAL "Skip SPIRV-Tools install")
37+
set(SPIRV_SKIP_TESTS ON CACHE INTERNAL "Skip SPIRV-Tools tests")
38+
set(SPIRV_SKIP_EXECUTABLES ON CACHE INTERNAL "Skip SPIRV-Tools executable build")
3239

33-
set(_DXC_CURRENT_CONFIG_ "$<IF:$<CONFIG:Debug>,Debug,Release>")
34-
set(DXC_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/dxc" CACHE INTERNAL "")
35-
set(DXC_BINARY_DIR_EP "${CMAKE_CURRENT_BINARY_DIR}/external/dxc" CACHE INTERNAL "")
36-
set(DXC_BINARY_DIR_GE "${DXC_BINARY_DIR_EP}/build" CACHE INTERNAL "")
37-
set(DXC_BIN_DIR "${DXC_BINARY_DIR_GE}/Release/bin" CACHE INTERNAL "") # hardcoded
38-
set(DXC_LIB_DIR "${DXC_BINARY_DIR_GE}/${_DXC_CURRENT_CONFIG_}/lib" CACHE INTERNAL "") # library path depends on the configuration
39-
set(DXC_EXECUTABLE "${DXC_BIN_DIR}/dxc.exe" CACHE INTERNAL "")
40-
set(DXC_DXCOMPILER_LIB "${DXC_LIB_DIR}/dxcompiler.lib" CACHE INTERNAL "")
40+
add_subdirectory(dxc dxc)
41+
42+
# TODO: change them
43+
#set(_DXC_CURRENT_CONFIG_ "$<IF:$<CONFIG:Debug>,Debug,Release>")
44+
#set(DXC_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/dxc" CACHE INTERNAL "")
45+
#set(DXC_BINARY_DIR_EP "${CMAKE_CURRENT_BINARY_DIR}/external/dxc" CACHE INTERNAL "")
46+
#set(DXC_BINARY_DIR_GE "${DXC_BINARY_DIR_EP}/build" CACHE INTERNAL "")
47+
#set(DXC_BIN_DIR "${DXC_BINARY_DIR_GE}/Release/bin" CACHE INTERNAL "") # hardcoded
48+
#set(DXC_LIB_DIR "${DXC_BINARY_DIR_GE}/${_DXC_CURRENT_CONFIG_}/lib" CACHE INTERNAL "") # library path depends on the configuration
49+
#set(DXC_EXECUTABLE "${DXC_BIN_DIR}/dxc.exe" CACHE INTERNAL "")
50+
#set(DXC_DXCOMPILER_LIB "${DXC_LIB_DIR}/dxcompiler.lib" CACHE INTERNAL "")
4151

4252
# DXC External Project
4353
# builds DXC executable target and dxcompiler library target
4454
# we cannot include it to Nabla's BS because DXC's BS isn't supposed to be added via submodule
4555
# - there are troubles with linker input paths and include/link search directory paths
4656

47-
ExternalProject_Add(dxc
48-
DOWNLOAD_COMMAND ""
49-
SOURCE_DIR "${DXC_SOURCE_DIR}"
50-
BINARY_DIR "${DXC_BINARY_DIR_EP}"
51-
BUILD_COMMAND "${CMAKE_COMMAND}" --build "${DXC_BINARY_DIR_GE}" --config Release --target dxc -v # DXC executable will be compiled always in Release mode
52-
COMMAND "${CMAKE_COMMAND}" --build "${DXC_BINARY_DIR_GE}" --config ${_DXC_CURRENT_CONFIG_} --target dxcompiler -v
53-
CONFIGURE_COMMAND "${CMAKE_COMMAND}" -S "${DXC_SOURCE_DIR}" -B "${DXC_BINARY_DIR_GE}" -G "${CMAKE_GENERATOR}" "-Ax64" -T "${CMAKE_GENERATOR_TOOLSET}" ${DXC_CMAKE_ARGS}
54-
INSTALL_COMMAND ""
55-
TEST_COMMAND ""
56-
LOG_INSTALL 1
57-
)
57+
#ExternalProject_Add(dxc
58+
# DOWNLOAD_COMMAND ""
59+
# SOURCE_DIR "${DXC_SOURCE_DIR}"
60+
# BINARY_DIR "${DXC_BINARY_DIR_EP}"
61+
# BUILD_COMMAND "${CMAKE_COMMAND}" --build "${DXC_BINARY_DIR_GE}" --config Release --target dxc -v # DXC executable will be compiled always in Release mode
62+
# COMMAND "${CMAKE_COMMAND}" --build "${DXC_BINARY_DIR_GE}" --config ${_DXC_CURRENT_CONFIG_} --target dxcompiler -v
63+
# CONFIGURE_COMMAND "${CMAKE_COMMAND}" -S "${DXC_SOURCE_DIR}" -B "${DXC_BINARY_DIR_GE}" -G "${CMAKE_GENERATOR}" "-Ax64" -T "${CMAKE_GENERATOR_TOOLSET}" ${DXC_CMAKE_ARGS}
64+
# INSTALL_COMMAND ""
65+
# TEST_COMMAND ""
66+
# LOG_INSTALL 1
67+
#)
5868

5969
unset(DXC_CMAKE_ARGS)
6070
unset(_DXC_CURRENT_CONFIG_)
6171

62-
if(_NBL_ENABLE_DXC_COMPILE_TESTS_)
63-
add_subdirectory(CT CT)
64-
endif()
72+
#if(_NBL_ENABLE_DXC_COMPILE_TESTS_)
73+
# add_subdirectory(CT CT)
74+
#endif()

3rdparty/dxc/dxc

Submodule dxc updated 1 file

0 commit comments

Comments
 (0)