Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix build error when SLANG_ENABLE_TESTS is set to OFF #6420

44 changes: 25 additions & 19 deletions tools/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading