Move some things around to prepare for multiple pipelines
This commit is contained in:
1 parent
ea82627695
commit
c24d3f4f27
5 files changed
+180
-179
No files matched your search
+8
-7
@@ -13,8 +13,9 @@ find_program(glslc glslc)
|
||||
function(add_shaders target)
|
||||
set(bin_dir "${CMAKE_CURRENT_BINARY_DIR}/${target}")
|
||||
foreach(src ${ARGN})
|
||||
get_filename_component(stage ${src} NAME_WLE)
|
||||
set(bin "${bin_dir}/${stage}.spv")
|
||||
get_filename_component(name ${src} NAME_WLE)
|
||||
string(REGEX MATCH "(vert|frag)$" stage "${name}")
|
||||
set(bin "${bin_dir}/${name}.spv")
|
||||
list(APPEND bins ${bin})
|
||||
add_custom_command(
|
||||
OUTPUT ${bin}
|
||||
@@ -25,16 +26,16 @@ function(add_shaders target)
|
||||
endforeach()
|
||||
add_custom_target(${target}-spirv DEPENDS ${bins})
|
||||
add_library(${target} INTERFACE)
|
||||
target_compile_definitions(${target} INTERFACE
|
||||
VERT_SHADER_SPV="${bin_dir}/vert.spv"
|
||||
FRAG_SHADER_SPV="${bin_dir}/frag.spv")
|
||||
add_dependencies(${target} ${target}-spirv)
|
||||
endfunction()
|
||||
|
||||
add_shaders(shaders
|
||||
vert.glsl
|
||||
frag.glsl
|
||||
model-vert.glsl
|
||||
default-frag.glsl
|
||||
)
|
||||
target_compile_definitions(shaders INTERFACE
|
||||
MODEL_VERT_SHADER_SPV="${CMAKE_CURRENT_BINARY_DIR}/shaders/model-vert.spv"
|
||||
FRAG_SHADER_SPV="${CMAKE_CURRENT_BINARY_DIR}/shaders/default-frag.spv")
|
||||
|
||||
add_executable(demo
|
||||
animation.c
|
||||
|
||||
Reference in new issue
Block a user