meson: replace global_source_root/global_build_root with project_*

global_source_root() and global_build_root() typically shouldn't be used
in case the current project can be used as a subproject as it'll return
the path to the main project[1][2].

Instead, let's do as suggested by the documentation and use
project_source_root() and project_build_root() instead.

[1] https://mesonbuild.com/Reference-manual_builtin_meson.html#mesonglobal_source_root
[2] https://mesonbuild.com/Reference-manual_builtin_meson.html#mesonglobal_build_root

Suggested-by: Eric Engestrom <eric@igalia.com>
Signed-off-by: Quentin Schulz <quentin.schulz@cherry.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36927>
This commit is contained in:
Quentin Schulz 2025-09-15 10:50:44 +02:00 committed by Marge Bot
parent e1765a2914
commit 6afe429b7c

View file

@ -48,7 +48,7 @@ with_mesa_debug = get_option('buildtype') == 'debug'
with_mesa_ndebug = get_option('b_ndebug') == 'true' or (get_option('buildtype') == 'release' and get_option('b_ndebug') == 'if-release')
# We need to set -fmacro-prefix-map properly for driver CL reproducability.
relative_dir = fs.relative_to(meson.global_source_root(), meson.global_build_root())
relative_dir = fs.relative_to(meson.project_source_root(), meson.project_build_root())
cl_args = [
'-fmacro-prefix-map=@0@/='.format(relative_dir),