Make the xxd command in shader/meson.build less fragile

This commit is contained in:
刘皓 2025-02-18 22:58:58 -05:00
parent 79f9108748
commit ceea260b82
No known key found for this signature in database
GPG key ID: 7901753DB465B711
2 changed files with 4 additions and 1 deletions

View file

@ -7,6 +7,7 @@ if host_system == 'darwin'
endif
xxd = find_program('xxd', native: true)
xxd_supports_n = run_command(xxd, '-n', 'meson', '-i', meson.current_source_dir() / 'meson.build', check: false).returncode() == 0
git_hash = run_command('git', 'rev-parse', '--short', 'HEAD').stdout().strip()

View file

@ -41,7 +41,9 @@ foreach file : embedded_shaders_f
global_sources += custom_target(embedded_shaders[count],
input: file,
output: '@0@.xxd'.format(embedded_shaders[count]),
command: [
command: xxd_supports_n ? [
xxd, '-n', '___shader_@0@'.format(embedded_shaders[count].replace('.', '_')), '-i', '@INPUT@'
] : [
xxd, '-i', '@INPUT@'
],
capture: true,