vulkan: Consistently form driver library names as prefix + name + suffix

This consistently uses `NAME.dll` on Windows, `libNAME.dylib` on Darwin
derivatives such as macOS, and `libNAME.so` on Linux, *BSD and so on.
It's also consistent about using the local variable name `icd_file_name`
for this name in every Vulkan driver, which was already the case in many
but not all drivers.

Some of these drivers probably don't make sense (or don't work) on
Windows and/or macOS, but if this is kept consistent for all drivers,
it should avoid the need for driver-specific commits like
commit 611e9f29e "lavapipe: fix icd generation for windows",
commit 951f3287 "lavapipe: set empty dll prefix",
commit 13e7a39f "lavapipe: fixes for macOS support",
commit 7008e655 "radv: Update JSON generator if Windows" and so on,
each time a driver is found to be relevant on more platforms than
previously believed.

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:40:14 +01:00 committed by Marge Bot
parent 2a14b7224b
commit be8cac52d3
14 changed files with 41 additions and 26 deletions

View file

@ -20,10 +20,13 @@ project(
if host_machine.system() == 'darwin'
add_languages('objc', native : false)
add_project_arguments('-fobjc-arc', language : 'objc')
libname_prefix = 'lib'
libname_suffix = 'dylib'
elif host_machine.system() == 'windows'
libname_prefix = ''
libname_suffix = 'dll'
else
libname_prefix = 'lib'
libname_suffix = 'so'
endif

View file

@ -282,10 +282,9 @@ if with_symbols_check
endif
icd_lib_path = join_paths(get_option('prefix'), get_option('libdir'))
icd_file_name = 'libvulkan_radeon.so'
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)
icd_file_name = 'vulkan_radeon.dll'
endif
icd_command = [

View file

@ -103,10 +103,9 @@ libvulkan_asahi = shared_library(
)
icd_lib_path = join_paths(get_option('prefix'), get_option('libdir'))
icd_file_name = 'libvulkan_asahi.so'
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)
icd_file_name = 'vulkan_asahi.dll'
endif
asahi_icd = custom_target(

View file

@ -122,6 +122,8 @@ if with_symbols_check
)
endif
icd_file_name = libname_prefix + 'vulkan_broadcom.' + libname_suffix
broadcom_icd = custom_target(
'broadcom_icd',
input : [vk_icd_gen, vk_api_xml],
@ -131,7 +133,7 @@ broadcom_icd = custom_target(
'--api-version', '1.3', '--xml', '@INPUT1@',
'--sizeof-pointer', sizeof_pointer,
'--lib-path', join_paths(get_option('prefix'), get_option('libdir'),
'libvulkan_broadcom.so'),
icd_file_name),
'--out', '@OUTPUT@',
],
build_by_default : true,
@ -149,7 +151,7 @@ _dev_icd = custom_target(
prog_python, '@INPUT0@',
'--api-version', '1.3', '--xml', '@INPUT1@',
'--sizeof-pointer', sizeof_pointer,
'--lib-path', meson.current_build_dir() / 'libvulkan_broadcom.so',
'--lib-path', meson.current_build_dir() / icd_file_name,
'--out', '@OUTPUT@',
],
build_by_default : true,

View file

@ -197,6 +197,8 @@ if with_symbols_check
)
endif
icd_file_name = libname_prefix + 'vulkan_freedreno.' + libname_suffix
freedreno_icd = custom_target(
'freedreno_icd',
input : [vk_icd_gen, vk_api_xml],
@ -206,7 +208,7 @@ freedreno_icd = custom_target(
'--api-version', '1.4', '--xml', '@INPUT1@',
'--sizeof-pointer', sizeof_pointer,
'--lib-path', join_paths(get_option('prefix'), get_option('libdir'),
'libvulkan_freedreno.so'),
icd_file_name),
'--out', '@OUTPUT@',
],
build_by_default : true,
@ -224,7 +226,7 @@ _dev_icd = custom_target(
prog_python, '@INPUT0@',
'--api-version', '1.4', '--xml', '@INPUT1@',
'--sizeof-pointer', sizeof_pointer,
'--lib-path', meson.current_build_dir() / 'libvulkan_freedreno.so',
'--lib-path', meson.current_build_dir() / icd_file_name,
'--out', '@OUTPUT@',
],
build_by_default : true,

View file

@ -18,12 +18,12 @@ libvulkan_lvp = shared_library(
install : true,
)
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)
icd_file_name = 'vulkan_lvp.dll'
else
icd_lib_path = join_paths(get_option('prefix'), get_option('libdir'))
icd_file_name = 'libvulkan_lvp.@0@'.format(host_machine.system() == 'darwin' ? 'dylib' : 'so')
endif
icd_command = [

View file

@ -38,6 +38,8 @@ lib_vulkan_gfxstream = shared_library(
install: true,
)
icd_file_name = libname_prefix + 'vulkan_gfxstream.' + libname_suffix
gfxstream_icd = custom_target(
'gfxstream_vk_icd',
input : [vk_icd_gen, vk_api_xml],
@ -47,7 +49,7 @@ gfxstream_icd = custom_target(
'--api-version', '1.1', '--xml', '@INPUT1@',
'--sizeof-pointer', sizeof_pointer,
'--lib-path', join_paths(get_option('prefix'), get_option('libdir'),
'libvulkan_gfxstream.so'),
icd_file_name),
'--out', '@OUTPUT@',
],
build_by_default : true,
@ -64,7 +66,7 @@ _dev_icd = custom_target(
prog_python, '@INPUT0@',
'--api-version', '1.3', '--xml', '@INPUT1@',
'--sizeof-pointer', sizeof_pointer,
'--lib-path', meson.current_build_dir() / 'libvulkan_gfxstream.so',
'--lib-path', meson.current_build_dir() / icd_file_name,
'--out', '@OUTPUT@',
],
build_by_default : true,

View file

@ -136,6 +136,8 @@ if with_symbols_check
)
endif
icd_file_name = libname_prefix + 'vulkan_powervr_mesa.' + libname_suffix
powervr_mesa_icd = custom_target(
'powervr_mesa_icd',
input : [vk_icd_gen, vk_api_xml],
@ -144,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') / 'libvulkan_powervr_mesa.so',
'--lib-path', get_option('prefix') / get_option('libdir') / icd_file_name,
'--out', '@OUTPUT@',
],
build_by_default : true,
@ -161,7 +163,7 @@ _dev_icd = custom_target(
prog_python, '@INPUT0@',
'--api-version', '1.4', '--xml', '@INPUT1@',
'--sizeof-pointer', sizeof_pointer,
'--lib-path', meson.current_build_dir() / 'libvulkan_powervr_mesa.so',
'--lib-path', meson.current_build_dir() / icd_file_name,
'--out', '@OUTPUT@',
],
build_by_default : true,

View file

@ -45,6 +45,8 @@ else
anv_flags += '-DANV_SUPPORT_RT=0'
endif
icd_file_name = libname_prefix + 'vulkan_intel.' + libname_suffix
intel_icd = custom_target(
'intel_icd',
input : [vk_icd_gen, vk_api_xml],
@ -54,7 +56,7 @@ intel_icd = custom_target(
'--api-version', '1.4', '--xml', '@INPUT1@',
'--sizeof-pointer', sizeof_pointer,
'--lib-path', join_paths(get_option('prefix'), get_option('libdir'),
'libvulkan_intel.so'),
icd_file_name),
'--out', '@OUTPUT@',
],
build_by_default : true,
@ -72,7 +74,7 @@ _dev_icd = custom_target(
prog_python, '@INPUT0@',
'--api-version', '1.4', '--xml', '@INPUT1@',
'--sizeof-pointer', sizeof_pointer,
'--lib-path', meson.current_build_dir() / 'libvulkan_intel.so',
'--lib-path', meson.current_build_dir() / icd_file_name,
'--out', '@OUTPUT@',
],
build_by_default : true,

View file

@ -16,6 +16,8 @@ anv_hasvk_entrypoints = custom_target(
depend_files : vk_entrypoints_gen_depend_files,
)
icd_file_name = libname_prefix + 'vulkan_intel_hasvk.' + libname_suffix
intel_hasvk_icd = custom_target(
'intel_hasvk_icd',
input : [vk_icd_gen, vk_api_xml],
@ -25,7 +27,7 @@ intel_hasvk_icd = custom_target(
'--api-version', '1.3', '--xml', '@INPUT1@',
'--sizeof-pointer', sizeof_pointer,
'--lib-path', join_paths(get_option('prefix'), get_option('libdir'),
'libvulkan_intel_hasvk.so'),
icd_file_name),
'--out', '@OUTPUT@',
],
build_by_default : true,
@ -43,7 +45,7 @@ _dev_icd = custom_target(
prog_python, '@INPUT0@',
'--api-version', '1.3', '--xml', '@INPUT1@',
'--sizeof-pointer', sizeof_pointer,
'--lib-path', meson.current_build_dir() / 'libvulkan_intel_hasvk.so',
'--lib-path', meson.current_build_dir() / icd_file_name,
'--out', '@OUTPUT@',
],
build_by_default : true,

View file

@ -73,11 +73,10 @@ libvulkan_dzn = shared_library(
install : true,
)
icd_file_name = 'libvulkan_dzn.so'
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)
icd_file_name = 'vulkan_dzn.dll'
endif

View file

@ -162,10 +162,9 @@ libvulkan_nouveau = shared_library(
)
icd_lib_path = join_paths(get_option('prefix'), get_option('libdir'))
icd_file_name = 'libvulkan_nouveau.so'
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)
icd_file_name = 'vulkan_nouveau.dll'
endif
nouveau_icd = custom_target(

View file

@ -236,6 +236,8 @@ if with_symbols_check
)
endif
icd_file_name = libname_prefix + 'vulkan_panfrost.' + libname_suffix
panfrost_icd = custom_target(
'panfrost_icd',
input : [vk_icd_gen, vk_api_xml],
@ -245,7 +247,7 @@ panfrost_icd = custom_target(
'--api-version', '1.4', '--xml', '@INPUT1@',
'--sizeof-pointer', sizeof_pointer,
'--lib-path', join_paths(get_option('prefix'), get_option('libdir'),
'libvulkan_panfrost.so'),
icd_file_name),
'--out', '@OUTPUT@',
],
build_by_default : true,
@ -263,7 +265,7 @@ _dev_icd = custom_target(
prog_python, '@INPUT0@',
'--api-version', '1.4', '--xml', '@INPUT1@',
'--sizeof-pointer', sizeof_pointer,
'--lib-path', meson.current_build_dir() / 'libvulkan_panfrost.so',
'--lib-path', meson.current_build_dir() / icd_file_name,
'--out', '@OUTPUT@',
],
build_by_default : true,

View file

@ -15,6 +15,8 @@ vn_entrypoints = custom_target(
],
)
icd_file_name = libname_prefix + 'vulkan_virtio.' + libname_suffix
virtio_icd = custom_target(
'virtio_icd',
input : [vk_icd_gen, vk_api_xml],
@ -24,7 +26,7 @@ virtio_icd = custom_target(
'--api-version', '1.4', '--xml', '@INPUT1@',
'--sizeof-pointer', sizeof_pointer,
'--lib-path', join_paths(get_option('prefix'), get_option('libdir'),
'libvulkan_virtio.so'),
icd_file_name),
'--out', '@OUTPUT@',
],
build_by_default : true,
@ -42,7 +44,7 @@ _dev_icd = custom_target(
prog_python, '@INPUT0@',
'--api-version', '1.4', '--xml', '@INPUT1@',
'--sizeof-pointer', sizeof_pointer,
'--lib-path', meson.current_build_dir() / 'libvulkan_virtio.so',
'--lib-path', meson.current_build_dir() / icd_file_name,
'--out', '@OUTPUT@',
],
build_by_default : true,