Skip to content

Commit c9cdfd0

Browse files
AnastaZIukdeprilula28
authored andcommitted
create rules for building dxcompiler target the way it either doesn't conflict with our build system and has proper up-to-date updates reporting. Optimize our BS limiting therefore DXC targets in Nabla solution from over 120 to 1. Link dxcompiler to nabla given pre-configured link and search include directory paths with respect to configurations. Update 3rdparty/dxc/dxc submodule
1 parent e437ae6 commit c9cdfd0

File tree

4 files changed

+37
-16
lines changed

4 files changed

+37
-16
lines changed

3rdparty/dxc/CMakeLists.txt

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,4 +105,19 @@ set(DXC_EXT_EXECUTABLE "${DXC_UNPACK_DIR}/dxc.exe" CACHE STRING "" FORCE)
105105

106106
if(_NBL_ENABLE_DXC_COMPILE_TESTS_)
107107
add_subdirectory(CT CT)
108-
endif()
108+
endif()
109+
110+
include("${DXC_BUILD_DIR}/nbl/generate/dxc/config/debug.cmake")
111+
include("${DXC_BUILD_DIR}/nbl/generate/dxc/config/release.cmake")
112+
113+
set(DXC_INCLUDE_DIRECTORIES
114+
$<IF:$<CONFIG:Debug>,${NBL_DXC_DEBUG_INCLUDE_DIRECTORIES},${NBL_DXC_RELEASE_INCLUDE_DIRECTORIES}>
115+
CACHE INTERNAL "")
116+
117+
set(DXC_LIB
118+
$<IF:$<CONFIG:Debug>,${NBL_DXC_DEBUG_LIB},${NBL_DXC_RELEASE_LIB}>
119+
CACHE INTERNAL "")
120+
121+
set(DXC_DLL
122+
$<IF:$<CONFIG:Debug>,${NBL_DXC_DEBUG_DLL},${NBL_DXC_RELEASE_DLL}>
123+
CACHE INTERNAL "")

3rdparty/dxc/CT/CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,6 @@ add_custom_target(HLSL_NABLA_COMPILE_TEST DEPENDS ${_NBL_DXC_CT_BIN_OUTPUTS_}
129129
COMMENT "${CMAKE_COMMAND}" -E echo "Launching Nabla HLSL compile test..."
130130
)
131131

132-
add_dependencies(HLSL_NABLA_COMPILE_TEST dxcompiler)
133-
134132
unset(_NBL_DXC_CT_BIN_OUTPUTS_)
135133
unset(_NBL_DXC_CT_BINARY_BIN_)
136134
unset(_NBL_DXC_CT_INCLUDE_ROOT_)

3rdparty/dxc/dxc

Submodule dxc updated 1 file

src/nbl/CMakeLists.txt

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -581,18 +581,26 @@ if(_NBL_COMPILE_WITH_GLI_)
581581
endif()
582582

583583
# DXC
584-
#if(_NBL_ENABLE_DXC_COMPILE_TESTS_)
585-
# add_dependencies(Nabla HLSL_NABLA_COMPILE_TEST)
586-
#else()
587-
# add_dependencies(Nabla dxcompiler)
588-
#endif()
589-
590-
#target_include_directories(Nabla PRIVATE $<TARGET_PROPERTY:dxcompiler,INCLUDE_DIRECTORIES>)
591-
#if(NBL_STATIC_BUILD)
592-
# target_link_libraries(Nabla INTERFACE dxcompiler)
593-
#else()
594-
# target_link_libraries(Nabla PRIVATE dxcompiler)
595-
#endif()
584+
if(_NBL_ENABLE_DXC_COMPILE_TESTS_)
585+
add_dependencies(Nabla HLSL_NABLA_COMPILE_TEST)
586+
endif()
587+
588+
add_custom_command(OUTPUT "${DXC_LIB}" "${DXC_DLL}"
589+
COMMAND "${CMAKE_COMMAND}" --build "${DXC_BUILD_DIR}" --target dxcompiler --config $<IF:$<CONFIG:Debug>,Debug,Release> -v --clean-first
590+
VERBATIM
591+
COMMAND_EXPAND_LISTS
592+
)
593+
594+
add_custom_target(dxcompiler DEPENDS "${DXC_LIB}" "${DXC_DLL}")
595+
add_dependencies(Nabla dxcompiler)
596+
597+
target_include_directories(Nabla PRIVATE "${DXC_INCLUDE_DIRECTORIES}")
598+
if(NBL_STATIC_BUILD)
599+
target_link_libraries(Nabla INTERFACE "${DXC_LIB}")
600+
else()
601+
target_link_libraries(Nabla PRIVATE "${DXC_LIB}")
602+
endif()
603+
596604

597605
# Linux Display Systems
598606
if (UNIX AND NOT ANDROID AND NOT APPLE)

0 commit comments

Comments
 (0)