|
@@ -0,0 +1,18 @@
|
|
|
+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_BINARY_DIR}/shader/${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()
|