meson: do not use source_root() when possible

source_root() function is deprecated in Meson version 0.56.0 because
it returns the source root of the parent project if called from a
subproject.

Why would anyone need Mesa as a meson subproject?
It would be used as subproject in a project generated by command buffer
"decompiler" for Freedreno.

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Reviewed-by: Eric Engestrom <eric@igalia.com>
Reviewed-by: David Heidelberg <david.heidelberg@collabora.com>
Acked-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19901>
This commit is contained in:
Danylo Piliaiev
2022-11-01 17:42:08 +01:00
committed by Marge Bot
parent 74ad255c8c
commit 703d85485f
14 changed files with 33 additions and 19 deletions

View File

@@ -22,7 +22,8 @@ project(
'mesa',
['c', 'cpp'],
version : run_command(
[find_program('python3', 'python'), 'bin/meson_get_version.py'],
[find_program('python3', 'python'), 'bin/meson_get_version.py',
meson.version().version_compare('>= 0.56') ? meson.project_source_root() : meson.source_root()],
check : true
).stdout(),
license : 'MIT',
@@ -2289,6 +2290,14 @@ gcc_lto_quirk = (cc.get_id() == 'gcc') ? ['-fno-lto'] : []
devenv = environment()
dir_compiler_nir = join_paths(meson.current_source_dir(), 'src/compiler/nir/')
if meson.version().version_compare('>= 0.56')
dir_source_root = meson.project_source_root()
else
# source_root() returns a source root of the parent project if called from
# a subproject, which makes impossible to use Mesa as a meson subproject.
dir_source_root = meson.source_root()
endif
subdir('include')
subdir('bin')