meson: add support for meson devenv
with vulkan
Meson devenv is a feature added in meson 0.58 (thus the features is version guarded) that allows creating a shell environment with environment variables automatically setup for running the project inside the build dir. Some variables (such as LD_LIBRARY_PATH and PATH) are set automatically, others must be added by the project. For vulkan is is relativley simple, we create a new, uninstalled, icd file for each driver and set the VK_ICD_FILENAMES variable appropriately. This can be used with: ```sh meson devenv -C $builddir ``` then, vulkan applications will automatically use the uninstall vulkan driver, no need to install. Reviewed-by: Adam Jackson <ajax@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14826>
This commit is contained in:
@@ -2167,10 +2167,16 @@ endif
|
|||||||
# as GCC LTO drops them. See: https://bugs.freedesktop.org/show_bug.cgi?id=109391
|
# as GCC LTO drops them. See: https://bugs.freedesktop.org/show_bug.cgi?id=109391
|
||||||
gcc_lto_quirk = (cc.get_id() == 'gcc') ? ['-fno-lto'] : []
|
gcc_lto_quirk = (cc.get_id() == 'gcc') ? ['-fno-lto'] : []
|
||||||
|
|
||||||
|
devenv = environment()
|
||||||
|
|
||||||
subdir('include')
|
subdir('include')
|
||||||
subdir('bin')
|
subdir('bin')
|
||||||
subdir('src')
|
subdir('src')
|
||||||
|
|
||||||
|
if meson.version().version_compare('>= 0.58')
|
||||||
|
meson.add_devenv(devenv)
|
||||||
|
endif
|
||||||
|
|
||||||
lines = ['',
|
lines = ['',
|
||||||
'prefix: ' + get_option('prefix'),
|
'prefix: ' + get_option('prefix'),
|
||||||
'libdir: ' + get_option('libdir'),
|
'libdir: ' + get_option('libdir'),
|
||||||
|
@@ -165,3 +165,21 @@ broadcom_icd = custom_target(
|
|||||||
install_dir : with_vulkan_icd_dir,
|
install_dir : with_vulkan_icd_dir,
|
||||||
install : true,
|
install : true,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if meson.version().version_compare('>= 0.58')
|
||||||
|
_dev_icdname = 'broadcom_devenv_icd.@0@.json'.format(host_machine.cpu())
|
||||||
|
custom_target(
|
||||||
|
'broadcom_devenv_icd',
|
||||||
|
input : [vk_icd_gen, vk_api_xml],
|
||||||
|
output : _dev_icdname,
|
||||||
|
command : [
|
||||||
|
prog_python, '@INPUT0@',
|
||||||
|
'--api-version', '1.3', '--xml', '@INPUT1@',
|
||||||
|
'--lib-path', meson.current_build_dir() / 'libvulkan_broadcom.so',
|
||||||
|
'--out', '@OUTPUT@',
|
||||||
|
],
|
||||||
|
build_by_default : true,
|
||||||
|
)
|
||||||
|
|
||||||
|
devenv.append('VK_ICD_FILENAMES', meson.current_build_dir() / _dev_icdname)
|
||||||
|
endif
|
||||||
|
@@ -181,3 +181,21 @@ freedreno_icd = custom_target(
|
|||||||
install_dir : with_vulkan_icd_dir,
|
install_dir : with_vulkan_icd_dir,
|
||||||
install : true,
|
install : true,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if meson.version().version_compare('>= 0.58')
|
||||||
|
_dev_icdname = 'freedreno_devenv_icd.@0@.json'.format(host_machine.cpu())
|
||||||
|
custom_target(
|
||||||
|
'freedreno_devenv_icd',
|
||||||
|
input : [vk_icd_gen, vk_api_xml],
|
||||||
|
output : _dev_icdname,
|
||||||
|
command : [
|
||||||
|
prog_python, '@INPUT0@',
|
||||||
|
'--api-version', '1.1', '--xml', '@INPUT1@',
|
||||||
|
'--lib-path', meson.current_build_dir() / 'libvulkan_freedreno.so',
|
||||||
|
'--out', '@OUTPUT@',
|
||||||
|
],
|
||||||
|
build_by_default : true,
|
||||||
|
)
|
||||||
|
|
||||||
|
devenv.append('VK_ICD_FILENAMES', meson.current_build_dir() / _dev_icdname)
|
||||||
|
endif
|
||||||
|
@@ -40,3 +40,21 @@ lvp_icd = custom_target(
|
|||||||
install_dir : with_vulkan_icd_dir,
|
install_dir : with_vulkan_icd_dir,
|
||||||
install : true,
|
install : true,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if meson.version().version_compare('>= 0.58')
|
||||||
|
_dev_icdname = 'lvp_devenv_icd.@0@.json'.format(host_machine.cpu())
|
||||||
|
custom_target(
|
||||||
|
'lvp_devenv_icd',
|
||||||
|
input : [vk_icd_gen, vk_api_xml],
|
||||||
|
output : _dev_icdname,
|
||||||
|
command : [
|
||||||
|
prog_python, '@INPUT0@',
|
||||||
|
'--api-version', '1.1', '--xml', '@INPUT1@',
|
||||||
|
'--lib-path', meson.current_build_dir() / 'libvulkan_lvp.so',
|
||||||
|
'--out', '@OUTPUT@',
|
||||||
|
],
|
||||||
|
build_by_default : true,
|
||||||
|
)
|
||||||
|
|
||||||
|
devenv.append('VK_ICD_FILENAMES', meson.current_build_dir() / _dev_icdname)
|
||||||
|
endif
|
||||||
|
@@ -49,6 +49,24 @@ intel_icd = custom_target(
|
|||||||
install : true,
|
install : true,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if meson.version().version_compare('>= 0.58')
|
||||||
|
_dev_icdname = 'intel_devenv_icd.@0@.json'.format(host_machine.cpu())
|
||||||
|
custom_target(
|
||||||
|
'intel_devenv_icd',
|
||||||
|
input : [vk_icd_gen, vk_api_xml],
|
||||||
|
output : _dev_icdname,
|
||||||
|
command : [
|
||||||
|
prog_python, '@INPUT0@',
|
||||||
|
'--api-version', '1.3', '--xml', '@INPUT1@',
|
||||||
|
'--lib-path', meson.current_build_dir() / 'libvulkan_intel.so',
|
||||||
|
'--out', '@OUTPUT@',
|
||||||
|
],
|
||||||
|
build_by_default : true,
|
||||||
|
)
|
||||||
|
|
||||||
|
devenv.append('VK_ICD_FILENAMES', meson.current_build_dir() / _dev_icdname)
|
||||||
|
endif
|
||||||
|
|
||||||
libanv_per_hw_ver_libs = []
|
libanv_per_hw_ver_libs = []
|
||||||
anv_per_hw_ver_files = files(
|
anv_per_hw_ver_files = files(
|
||||||
'genX_blorp_exec.c',
|
'genX_blorp_exec.c',
|
||||||
|
@@ -154,3 +154,21 @@ panfrost_icd = custom_target(
|
|||||||
install_dir : with_vulkan_icd_dir,
|
install_dir : with_vulkan_icd_dir,
|
||||||
install : true,
|
install : true,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if meson.version().version_compare('>= 0.58')
|
||||||
|
_dev_icdname = 'panfrost_devenv_icd.@0@.json'.format(host_machine.cpu())
|
||||||
|
custom_target(
|
||||||
|
'panfrost_devenv_icd',
|
||||||
|
input : [vk_icd_gen, vk_api_xml],
|
||||||
|
output : _dev_icdname,
|
||||||
|
command : [
|
||||||
|
prog_python, '@INPUT0@',
|
||||||
|
'--api-version', '1.1', '--xml', '@INPUT1@',
|
||||||
|
'--lib-path', meson.current_build_dir() / 'libvulkan_panfrost.so',
|
||||||
|
'--out', '@OUTPUT@',
|
||||||
|
],
|
||||||
|
build_by_default : true,
|
||||||
|
)
|
||||||
|
|
||||||
|
devenv.append('VK_ICD_FILENAMES', meson.current_build_dir() / _dev_icdname)
|
||||||
|
endif
|
||||||
|
@@ -30,6 +30,24 @@ virtio_icd = custom_target(
|
|||||||
install : true,
|
install : true,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if meson.version().version_compare('>= 0.58')
|
||||||
|
_dev_icdname = 'virtio_devenv_icd.@0@.json'.format(host_machine.cpu())
|
||||||
|
custom_target(
|
||||||
|
'virtio_devenv_icd',
|
||||||
|
input : [vk_icd_gen, vk_api_xml],
|
||||||
|
output : _dev_icdname,
|
||||||
|
command : [
|
||||||
|
prog_python, '@INPUT0@',
|
||||||
|
'--api-version', '1.2', '--xml', '@INPUT1@',
|
||||||
|
'--lib-path', meson.current_build_dir() / 'libvulkan_virtio.so',
|
||||||
|
'--out', '@OUTPUT@',
|
||||||
|
],
|
||||||
|
build_by_default : true,
|
||||||
|
)
|
||||||
|
|
||||||
|
devenv.append('VK_ICD_FILENAMES', meson.current_build_dir() / _dev_icdname)
|
||||||
|
endif
|
||||||
|
|
||||||
libvn_files = files(
|
libvn_files = files(
|
||||||
'vn_buffer.c',
|
'vn_buffer.c',
|
||||||
'vn_command_buffer.c',
|
'vn_command_buffer.c',
|
||||||
|
Reference in New Issue
Block a user