Skip to content

Commit 7c50b05

Browse files
AnastaZIukdeprilula28
authored andcommitted
Force DXC targets to initialize with cpp 11 standard (TODO: add a runtime validation for checking that maximum allowed standard for building entire DXC stuff is cpp 14 unless DXC team supports more recent standards) and generator-expression fixed MSVC runtime depending on our NBL_DYNAMIC_MSVC_RUNTIME option - make both dxc and dxcompiler targets compile without issues with Nabla solution
1 parent b4f22a0 commit 7c50b05

File tree

1 file changed

+8
-46
lines changed

1 file changed

+8
-46
lines changed

3rdparty/dxc/CMakeLists.txt

Lines changed: 8 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -37,53 +37,15 @@ set(SKIP_SPIRV_TOOLS_INSTALL ON CACHE INTERNAL "Skip SPIRV-Tools install")
3737
set(SPIRV_SKIP_TESTS ON CACHE INTERNAL "Skip SPIRV-Tools tests")
3838
set(SPIRV_SKIP_EXECUTABLES ON CACHE INTERNAL "Skip SPIRV-Tools executable build")
3939

40-
add_subdirectory(dxc dxc)
41-
42-
set(_NBL_DXC_TARGETS_WITH_FORCED_LOW_STANDARD_
43-
dxcompiler
44-
LLVMSupport
45-
llvm-tblgen
46-
clangCodeGen
47-
LLVMDxilDia
48-
LLVMAnalysis
49-
LLVMTransformUtils
50-
LLVMScalarOpts
51-
)
52-
53-
foreach(_NBL_DXC_TARGET_WITH_FORCED_LOW_STANDARD_ IN LISTS _NBL_DXC_TARGETS_WITH_FORCED_LOW_STANDARD_)
54-
set_property(TARGET ${_NBL_DXC_TARGET_WITH_FORCED_LOW_STANDARD_} PROPERTY CXX_STANDARD 11)
55-
endforeach()
56-
40+
set(CMAKE_CXX_STANDARD 11)
41+
if(NBL_DYNAMIC_MSVC_RUNTIME)
42+
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL")
43+
else()
44+
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
45+
endif()
5746

58-
# TODO: change them
59-
#set(_DXC_CURRENT_CONFIG_ "$<IF:$<CONFIG:Debug>,Debug,Release>")
60-
#set(DXC_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/dxc" CACHE INTERNAL "")
61-
#set(DXC_BINARY_DIR_EP "${CMAKE_CURRENT_BINARY_DIR}/external/dxc" CACHE INTERNAL "")
62-
#set(DXC_BINARY_DIR_GE "${DXC_BINARY_DIR_EP}/build" CACHE INTERNAL "")
63-
#set(DXC_BIN_DIR "${DXC_BINARY_DIR_GE}/Release/bin" CACHE INTERNAL "") # hardcoded
64-
#set(DXC_LIB_DIR "${DXC_BINARY_DIR_GE}/${_DXC_CURRENT_CONFIG_}/lib" CACHE INTERNAL "") # library path depends on the configuration
65-
#set(DXC_EXECUTABLE "${DXC_BIN_DIR}/dxc.exe" CACHE INTERNAL "")
66-
#set(DXC_DXCOMPILER_LIB "${DXC_LIB_DIR}/dxcompiler.lib" CACHE INTERNAL "")
67-
68-
# DXC External Project
69-
# builds DXC executable target and dxcompiler library target
70-
# we cannot include it to Nabla's BS because DXC's BS isn't supposed to be added via submodule
71-
# - there are troubles with linker input paths and include/link search directory paths
72-
73-
#ExternalProject_Add(dxc
74-
# DOWNLOAD_COMMAND ""
75-
# SOURCE_DIR "${DXC_SOURCE_DIR}"
76-
# BINARY_DIR "${DXC_BINARY_DIR_EP}"
77-
# BUILD_COMMAND "${CMAKE_COMMAND}" --build "${DXC_BINARY_DIR_GE}" --config Release --target dxc -v # DXC executable will be compiled always in Release mode
78-
# COMMAND "${CMAKE_COMMAND}" --build "${DXC_BINARY_DIR_GE}" --config ${_DXC_CURRENT_CONFIG_} --target dxcompiler -v
79-
# CONFIGURE_COMMAND "${CMAKE_COMMAND}" -S "${DXC_SOURCE_DIR}" -B "${DXC_BINARY_DIR_GE}" -G "${CMAKE_GENERATOR}" "-Ax64" -T "${CMAKE_GENERATOR_TOOLSET}" ${DXC_CMAKE_ARGS}
80-
# INSTALL_COMMAND ""
81-
# TEST_COMMAND ""
82-
# LOG_INSTALL 1
83-
#)
84-
85-
unset(DXC_CMAKE_ARGS)
86-
unset(_DXC_CURRENT_CONFIG_)
47+
add_subdirectory(dxc dxc)
48+
set(CMAKE_CXX_STANDARD 20) # it's mandatory
8749

8850
#if(_NBL_ENABLE_DXC_COMPILE_TESTS_)
8951
# add_subdirectory(CT CT)

0 commit comments

Comments
 (0)