mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2026-02-06 04:06:11 -05:00
Currently, the glslang check is run every time ninja is invoked, even with an up-to-date build directory when GLSL shaders haven't been modified. This is due to glslang not creating any output file: the _check file never exists so ninja keeps trying to generate it by running the command. Unfortunately Meson doesn't support running commands with no outputs [1]. Create an empty output file to fix this by setting `capture: true`. This doesn't work out-of-the-box, because glslang prints messages to stdout, and provides no way to change this [2]. As a result, shader errors are not surfaced back to the user - they end up in the _check file. Workaround this with a thin wrapper which redirects stdout to stderr when invoking glslang. [1]: https://github.com/mesonbuild/meson/issues/11506 [2]: https://github.com/KhronosGroup/glslang/pull/4138
32 lines
608 B
Meson
32 lines
608 B
Meson
check = find_program('./check.sh', native: true)
|
|
embed = find_program('./embed.sh', native: true)
|
|
|
|
shaders = [
|
|
'common.vert',
|
|
'quad.frag',
|
|
'tex_rgba.frag',
|
|
'tex_rgbx.frag',
|
|
'tex_external.frag',
|
|
]
|
|
|
|
foreach name : shaders
|
|
custom_target(
|
|
'gles2-' + name,
|
|
input: name,
|
|
output: name + '_check',
|
|
command: [check, glslang, '@INPUT@'],
|
|
capture: true,
|
|
build_by_default: true,
|
|
)
|
|
|
|
output = name.underscorify() + '_src.h'
|
|
var = name.underscorify() + '_src'
|
|
wlr_files += custom_target(
|
|
output,
|
|
command: [embed, var],
|
|
input: name,
|
|
output: output,
|
|
feed: true,
|
|
capture: true,
|
|
)
|
|
endforeach
|