Archived
1
Fork 0
This repository has been archived on 2025-04-12. You can view files and clone it, but cannot push or open issues or pull requests.
graph/cmake/BuildShaders.cmake

16 lines
539 B
CMake
Executable file

function(add_shaders target)
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/shaders)
foreach(src IN LISTS ARGN)
add_custom_command(
OUTPUT ${src}.spv
COMMAND glslangValidator -V ${CMAKE_CURRENT_SOURCE_DIR}/${src} -o ${CMAKE_CURRENT_BINARY_DIR}/${src}.spv
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${src}
)
list(APPEND SPV_FILES ${src}.spv)
endforeach()
add_custom_target(BuildShaders DEPENDS ${SPV_FILES})
add_dependencies(${target} BuildShaders)
endfunction()