Replies: 3 comments 5 replies
-
|
glslang is a pain. what does As an aside to your question, here's the code from mesa (mostly written by me) to check if glslang supports depfile generation of its own, which you may find helpful. # GLSL has interesting version output and Meson doesn't parse it correctly as of
# Meson 1.4.0
prog_glslang = find_program('glslangValidator', native : true)
if prog_glslang.found()
_glslang_version = run_command(prog_glslang, ['--version'], check : false).stdout().split(':')[2]
# Check if glslang has depfile support. Support was added in 11.3.0, but
# Windows path support was broken until 11.9.0.
#
# It is intentional to check the build machine, since we need to ensure that
# glslang will output valid paths on the build platform
_glslang_check = build_machine.system() == 'windows' ? '>= 11.9.0' : '>= 11.3.0'
if _glslang_version.version_compare(_glslang_check)
glslang_depfile = ['--depfile', '@DEPFILE@']
else
glslang_depfile = []
endif
if run_command(prog_glslang, [ '--quiet', '--version' ], check : false).returncode() == 0
glslang_quiet = ['--quiet']
else
glslang_quiet = []
endif
endif |
Beta Was this translation helpful? Give feedback.
-
|
Actually I was testing with an older version of Meson, with Meson 1.9.1 the problem is no longer that everything is rebuilt, but instead I have to run ninja two times after changing the source file, because the first time only generates the embedded file again but doesn't recompile the program. I don't think it is related to glslang, the shaders don't include anything for now, so their only dependency is the input file. Here is another minimal example without glslang: meson.build: project('demo', 'c',
version: '1.0.0',
default_options: ['c_std=c23']
)
generated_file = custom_target('generate_output',
input: 'demo.txt.in',
output: 'demo.txt',
command: ['sed', 's/Meson/World/g', '@INPUT@'],
capture: true,
)
exe = executable('demo',
'main.c',
dependencies: [declare_dependency(sources: generated_file)],
c_args: ['--embed-dir=' + meson.current_build_dir()],
)main.c: #include <stdio.h>
static const unsigned char text[] = {
#embed "demo.txt" suffix(,)
0
};
int main(void) {
printf("%s", text);
}demo.txt.in: The build after |
Beta Was this translation helpful? Give feedback.
-
|
Reproduced with both Meson 1.8.5 and 1.9.1, but it seems to be a ninja bug. I cannot reproduce it with samurai and I could even reproduce without Meson at all, replacing its output-capture wrapper with a script like this ( and a minimal Note that wihle build.ninja has an order-only dependency on Removing |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I want compile shaders from their glsl source to spir-v and then embed them in C sources (using C23 #embed).
This seems to work if I create custom_targets like
and then either add spirv_shaders directly to the sources of an executable, or create a dependency with
shaders_dep = declare_dependency(sources: spirv_shaders)and add that to the executable as a dependency.But in both cases, whenever I make changes to a shader, apparently all C files are recompiled, not just the ones which actually embed the updated spv. How do I make meson/ninja use the compiler's
-MDoutput correctly to only recompile the C sources that need to be recompiled?Beta Was this translation helpful? Give feedback.
All reactions