summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJay Kwak <82421531+jkwak-work@users.noreply.github.com>2025-02-28 15:15:55 -0800
committerGitHub <noreply@github.com>2025-02-28 23:15:55 +0000
commitbca772ca02bbe9c0f1201c7ae177a10ccff84958 (patch)
treee0b9cd2b27d6d26d262393b23c93e613a23b4641
parentefbfa7832afff7e6285713086259abda2456ed55 (diff)
Fix build error when SLANG_ENABLE_TESTS is set to OFF (#6420)
* Fix build error when SLANG_ENABLE_TESTS is set to OFF When SLANG_ENABLE_TESTS is disabled but SLANG_ENABLE_GFX is enabled, cmake was failing. It turned out that gfx build target was trying to copy some of files to the directory where slang-test uses. When SLANG_ENABLE_TESTS is disabled, the directory information became unavailable, because slang-test target became unavailable. This commit makes the copying behavior conditional on SLANG_ENABLE_TESTS in the gfx build target. * format code (#42) Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com> --------- Co-authored-by: slangbot <ellieh+slangbot@nvidia.com> Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com> Co-authored-by: Ellie Hermaszewska <ellieh@nvidia.com>
-rw-r--r--tools/CMakeLists.txt44
1 files changed, 25 insertions, 19 deletions
diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt
index 9968d7ca8..7c2e80e61 100644
--- a/tools/CMakeLists.txt
+++ b/tools/CMakeLists.txt
@@ -156,29 +156,35 @@ if(SLANG_ENABLE_GFX)
${slang_SOURCE_DIR}
${slang_SOURCE_DIR}/include
INCLUDE_DIRECTORIES_PRIVATE ${NVAPI_INCLUDE_DIRS}
- REQUIRES copy-gfx-slang-modules
INSTALL
EXPORT_SET_NAME SlangTargets
FOLDER gfx
)
- set(modules_dest_dir $<TARGET_FILE_DIR:slang-test>)
- add_custom_target(
- copy-gfx-slang-modules
- COMMAND ${CMAKE_COMMAND} -E make_directory ${modules_dest_dir}
- COMMAND
- ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_LIST_DIR}/gfx/gfx.slang
- ${modules_dest_dir}/gfx.slang
- COMMAND
- ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_LIST_DIR}/gfx/slang.slang
- ${modules_dest_dir}/slang.slang
- WORKING_DIRECTORY ${slang_SOURCE_DIR}
- VERBATIM
- )
- set_target_properties(copy-gfx-slang-modules PROPERTIES FOLDER generators)
- install(
- FILES ${modules_dest_dir}/gfx.slang ${modules_dest_dir}/slang.slang
- DESTINATION ${runtime_subdir}
- )
+ if(SLANG_ENABLE_TESTS)
+ set(modules_dest_dir $<TARGET_FILE_DIR:slang-test>)
+ add_custom_target(
+ copy-gfx-slang-modules
+ COMMAND ${CMAKE_COMMAND} -E make_directory ${modules_dest_dir}
+ COMMAND
+ ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_LIST_DIR}/gfx/gfx.slang
+ ${modules_dest_dir}/gfx.slang
+ COMMAND
+ ${CMAKE_COMMAND} -E copy
+ ${CMAKE_CURRENT_LIST_DIR}/gfx/slang.slang
+ ${modules_dest_dir}/slang.slang
+ WORKING_DIRECTORY ${slang_SOURCE_DIR}
+ VERBATIM
+ )
+ set_target_properties(
+ copy-gfx-slang-modules
+ PROPERTIES FOLDER generators
+ )
+ install(
+ FILES ${modules_dest_dir}/gfx.slang ${modules_dest_dir}/slang.slang
+ DESTINATION ${runtime_subdir}
+ )
+ add_dependencies(gfx copy-gfx-slang-modules)
+ endif()
slang_add_target(
gfx-util