123456789101112131415161718 |
- function(add_shader)
- cmake_parse_arguments(args
- "" "NAME" "SOURCES" ${ARGN}
- )
- if("${args_NAME}" STREQUAL "")
- message( FATAL_ERROR "add_shader misses NAME" )
- endif()
- set(output ${CMAKE_SOURCE_DIR}/shaders/${args_NAME}.spv)
- add_custom_command(
- OUTPUT ${output}
- COMMAND glslangValidator -V -o ${output} ${args_SOURCES}
- WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
- DEPENDS ${args_SOURCES}
- )
- add_custom_target(${args_NAME} ALL DEPENDS ${output})
- endfunction()
|