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:
Dylan Baker
2022-02-01 12:44:25 -08:00
parent 3abe9ccbd4
commit 2f916f2be6
7 changed files with 114 additions and 0 deletions
+18
View File
@@ -49,6 +49,24 @@ intel_icd = custom_target(
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 = []
anv_per_hw_ver_files = files(
'genX_blorp_exec.c',