meson: use glslang --depfile argument when possible

This reduces the amount of manual dependency tracking developers need to
do. This is turned on if glslang >= 11.3.0 is used, or 11.9.0 on
Windows, but otherwise the status quo is maintained. This means I have
not removed any use of `depend_files`. We could make make these hard
requirements and remove the use of `depend_files` too.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28329>
This commit is contained in:
Dylan Baker
2024-03-21 11:47:59 -07:00
committed by Marge Bot
parent 32e43fe77c
commit 46644ba371
9 changed files with 76 additions and 17 deletions

View File

@@ -623,8 +623,22 @@ if vdpau_drivers_path == ''
vdpau_drivers_path = join_paths(get_option('libdir'), 'vdpau')
endif
prog_glslang = find_program('glslangValidator', native : true, required : with_vulkan_overlay_layer or with_aco_tests or with_amd_vk or with_intel_vk)
# 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,
required : with_vulkan_overlay_layer or with_aco_tests or with_amd_vk or with_intel_vk)
if prog_glslang.found()
# 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 run_command(prog_glslang, ['--version'], check : false).stdout().split(':')[2].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