LibSL
LibSL copied to clipboard
AutoBindShader.cmake doesn't obey transitive dependencies
Given the following shader files:
/// toto.glsl
#include "shared.glsl"
void main() { gl_FragColor = f(); }
/// shared.glsl
vec4 f() { return vec4(1.0, 0.0, 0.0, 1.0); }
And in the associated CMakeLists.txt
auto_bind_shaders(sometarget toto)
Editing shared.glsl will not retrigger a rebuild of the auto-bound toto.h. The current work-around is to touch toto.glsl before compiling which is tedious and error-prone with a complex include hierarchy.
One solution would be to have a first pass of AutoBindShader.py return a list of all transitive dependencies for each input file and use that in the add_custom_command in target_bind_shaders. This would still require a re-run of CMake when the include hierarchy changes but this is a good first step.