# Collect all shader sources and feed them to the simv_shaders custom target.
file(GLOB_RECURSE SHADER_SOURCES CONFIGURE_DEPENDS
    "${CMAKE_CURRENT_SOURCE_DIR}/editor/*.vert"
    "${CMAKE_CURRENT_SOURCE_DIR}/editor/*.frag"
)

if(SHADER_SOURCES)
    # INCLUDE root is `shaders/` so that #include "common/foo.glsl" would resolve
    # to shaders/common/foo.glsl if a shader needs a shared helper.
    simv_compile_shaders(simv_shaders
        ${SHADER_SOURCES}
        INCLUDES "${CMAKE_CURRENT_SOURCE_DIR}"
    )
else()
    # Empty placeholder so dependent targets don't break when no shaders exist yet.
    add_custom_target(simv_shaders ALL COMMAND ${CMAKE_COMMAND} -E true)
endif()
