vulkan: Compute path to write into JSON manifests once, use it everywhere
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run

This reduces duplication: we only need to distinguish between Windows
and Unix in one place.

The previous code was inconsistent about using either the `platforms`
option, or the `host_machine`. Following the logic described in
commit 94379377 "lavapipe: build "Windows" check should use the host machine, not the `platforms` option.",
I've assumed that checking the host machine is the more-correct version
and used that.

Signed-off-by: Simon McVittie <smcv@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37576>
This commit is contained in:
Simon McVittie 2025-09-25 13:53:45 +01:00 committed by Marge Bot
parent be8cac52d3
commit 9d36bf891b
14 changed files with 19 additions and 42 deletions

View file

@ -2273,6 +2273,12 @@ devenv = environment()
dir_compiler_nir = join_paths(meson.current_source_dir(), 'src/compiler/nir/')
dir_source_root = meson.project_source_root()
if host_machine.system() == 'windows'
vulkan_icd_lib_path = import('fs').relative_to(get_option('bindir'), with_vulkan_icd_dir)
else
vulkan_icd_lib_path = get_option('prefix') / get_option('libdir')
endif
subdir('include')
subdir('bin')

View file

@ -281,17 +281,13 @@ if with_symbols_check
)
endif
icd_lib_path = join_paths(get_option('prefix'), get_option('libdir'))
icd_file_name = libname_prefix + 'vulkan_radeon.' + libname_suffix
if with_platform_windows
icd_lib_path = import('fs').relative_to(get_option('bindir'), with_vulkan_icd_dir)
endif
icd_command = [
prog_python, '@INPUT0@',
'--api-version', '1.4', '--xml', '@INPUT1@',
'--sizeof-pointer', sizeof_pointer,
'--lib-path', join_paths(icd_lib_path, icd_file_name),
'--lib-path', vulkan_icd_lib_path / icd_file_name,
'--out', '@OUTPUT@',
]
if with_platform_windows

View file

@ -102,11 +102,7 @@ libvulkan_asahi = shared_library(
install : true,
)
icd_lib_path = join_paths(get_option('prefix'), get_option('libdir'))
icd_file_name = libname_prefix + 'vulkan_asahi.' + libname_suffix
if with_platform_windows
icd_lib_path = import('fs').relative_to(get_option('bindir'), with_vulkan_icd_dir)
endif
asahi_icd = custom_target(
input : [vk_icd_gen, vk_api_xml],
@ -115,7 +111,7 @@ asahi_icd = custom_target(
prog_python, '@INPUT0@',
'--api-version', '1.4', '--xml', '@INPUT1@',
'--sizeof-pointer', sizeof_pointer,
'--lib-path', join_paths(icd_lib_path, icd_file_name),
'--lib-path', vulkan_icd_lib_path / icd_file_name,
'--out', '@OUTPUT@',
],
build_by_default : true,

View file

@ -132,8 +132,7 @@ broadcom_icd = custom_target(
prog_python, '@INPUT0@',
'--api-version', '1.3', '--xml', '@INPUT1@',
'--sizeof-pointer', sizeof_pointer,
'--lib-path', join_paths(get_option('prefix'), get_option('libdir'),
icd_file_name),
'--lib-path', vulkan_icd_lib_path / icd_file_name,
'--out', '@OUTPUT@',
],
build_by_default : true,

View file

@ -207,8 +207,7 @@ freedreno_icd = custom_target(
prog_python, '@INPUT0@',
'--api-version', '1.4', '--xml', '@INPUT1@',
'--sizeof-pointer', sizeof_pointer,
'--lib-path', join_paths(get_option('prefix'), get_option('libdir'),
icd_file_name),
'--lib-path', vulkan_icd_lib_path / icd_file_name,
'--out', '@OUTPUT@',
],
build_by_default : true,

View file

@ -20,17 +20,11 @@ libvulkan_lvp = shared_library(
icd_file_name = libname_prefix + 'vulkan_lvp.' + libname_suffix
if host_machine.system() == 'windows'
icd_lib_path = import('fs').relative_to(get_option('bindir'), with_vulkan_icd_dir)
else
icd_lib_path = join_paths(get_option('prefix'), get_option('libdir'))
endif
icd_command = [
prog_python, '@INPUT0@',
'--api-version', '1.4', '--xml', '@INPUT1@',
'--sizeof-pointer', sizeof_pointer,
'--lib-path', join_paths(icd_lib_path, icd_file_name),
'--lib-path', vulkan_icd_lib_path / icd_file_name,
'--out', '@OUTPUT@',
]
if host_machine.system() == 'windows'

View file

@ -48,8 +48,7 @@ gfxstream_icd = custom_target(
prog_python, '@INPUT0@',
'--api-version', '1.1', '--xml', '@INPUT1@',
'--sizeof-pointer', sizeof_pointer,
'--lib-path', join_paths(get_option('prefix'), get_option('libdir'),
icd_file_name),
'--lib-path', vulkan_icd_lib_path / icd_file_name,
'--out', '@OUTPUT@',
],
build_by_default : true,

View file

@ -146,7 +146,7 @@ powervr_mesa_icd = custom_target(
prog_python, '@INPUT0@',
'--api-version', '1.4', '--xml', '@INPUT1@',
'--sizeof-pointer', sizeof_pointer,
'--lib-path', get_option('prefix') / get_option('libdir') / icd_file_name,
'--lib-path', vulkan_icd_lib_path / icd_file_name,
'--out', '@OUTPUT@',
],
build_by_default : true,

View file

@ -55,8 +55,7 @@ intel_icd = custom_target(
prog_python, '@INPUT0@',
'--api-version', '1.4', '--xml', '@INPUT1@',
'--sizeof-pointer', sizeof_pointer,
'--lib-path', join_paths(get_option('prefix'), get_option('libdir'),
icd_file_name),
'--lib-path', vulkan_icd_lib_path / icd_file_name,
'--out', '@OUTPUT@',
],
build_by_default : true,

View file

@ -26,8 +26,7 @@ intel_hasvk_icd = custom_target(
prog_python, '@INPUT0@',
'--api-version', '1.3', '--xml', '@INPUT1@',
'--sizeof-pointer', sizeof_pointer,
'--lib-path', join_paths(get_option('prefix'), get_option('libdir'),
icd_file_name),
'--lib-path', vulkan_icd_lib_path / icd_file_name,
'--out', '@OUTPUT@',
],
build_by_default : true,

View file

@ -74,17 +74,13 @@ libvulkan_dzn = shared_library(
)
icd_file_name = libname_prefix + 'vulkan_dzn.' + libname_suffix
icd_lib_path = join_paths(get_option('prefix'), get_option('libdir'))
if with_platform_windows
icd_lib_path = import('fs').relative_to(get_option('bindir'), with_vulkan_icd_dir)
endif
icd_command = [
prog_python, '@INPUT0@',
'--api-version', '1.1', '--xml', '@INPUT1@',
'--sizeof-pointer', sizeof_pointer,
'--lib-path', join_paths(icd_lib_path, icd_file_name),
'--lib-path', vulkan_icd_lib_path / icd_file_name,
'--out', '@OUTPUT@',
]

View file

@ -161,11 +161,7 @@ libvulkan_nouveau = shared_library(
install : true,
)
icd_lib_path = join_paths(get_option('prefix'), get_option('libdir'))
icd_file_name = libname_prefix + 'vulkan_nouveau.' + libname_suffix
if with_platform_windows
icd_lib_path = import('fs').relative_to(get_option('bindir'), with_vulkan_icd_dir)
endif
nouveau_icd = custom_target(
'nouveau_icd',
@ -175,7 +171,7 @@ nouveau_icd = custom_target(
prog_python, '@INPUT0@',
'--api-version', '1.4', '--xml', '@INPUT1@',
'--sizeof-pointer', sizeof_pointer,
'--lib-path', join_paths(icd_lib_path, icd_file_name),
'--lib-path', vulkan_icd_lib_path / icd_file_name,
'--out', '@OUTPUT@',
],
build_by_default : true,

View file

@ -246,8 +246,7 @@ panfrost_icd = custom_target(
prog_python, '@INPUT0@',
'--api-version', '1.4', '--xml', '@INPUT1@',
'--sizeof-pointer', sizeof_pointer,
'--lib-path', join_paths(get_option('prefix'), get_option('libdir'),
icd_file_name),
'--lib-path', vulkan_icd_lib_path / icd_file_name,
'--out', '@OUTPUT@',
],
build_by_default : true,

View file

@ -25,8 +25,7 @@ virtio_icd = custom_target(
prog_python, '@INPUT0@',
'--api-version', '1.4', '--xml', '@INPUT1@',
'--sizeof-pointer', sizeof_pointer,
'--lib-path', join_paths(get_option('prefix'), get_option('libdir'),
icd_file_name),
'--lib-path', vulkan_icd_lib_path / icd_file_name,
'--out', '@OUTPUT@',
],
build_by_default : true,