mirror of https://gitlab.freedesktop.org/mesa/mesa
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:
parent
74ad255c8c
commit
703d85485f
|
@ -20,11 +20,16 @@
|
|||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
|
||||
import argparse
|
||||
import os
|
||||
|
||||
|
||||
def main():
|
||||
filename = os.path.join(os.environ['MESON_SOURCE_ROOT'], 'VERSION')
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('version_dir', help="Directory with VERSION file")
|
||||
args = parser.parse_args()
|
||||
|
||||
filename = os.path.join(args.version_dir, 'VERSION')
|
||||
with open(filename) as f:
|
||||
version = f.read().strip()
|
||||
print(version, end='')
|
||||
|
|
11
meson.build
11
meson.build
|
@ -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')
|
||||
|
|
|
@ -28,7 +28,7 @@ bvh_shaders = [
|
|||
'converter_leaf.comp',
|
||||
]
|
||||
|
||||
bvh_include_dir = meson.source_root() + '/src/amd/vulkan/bvh'
|
||||
bvh_include_dir = dir_source_root + '/src/amd/vulkan/bvh'
|
||||
|
||||
bvh_includes = files(
|
||||
'build_helpers.h',
|
||||
|
|
|
@ -29,7 +29,7 @@ radix_sort_shaders = [
|
|||
'scatter_1_odd.comp'
|
||||
]
|
||||
|
||||
shader_include_dir = meson.source_root() + '/src/amd/vulkan/radix_sort/targets/u64'
|
||||
shader_include_dir = dir_source_root + '/src/amd/vulkan/radix_sort/targets/u64'
|
||||
|
||||
shader_include_files = files(
|
||||
'bufref.h',
|
||||
|
@ -37,7 +37,7 @@ shader_include_files = files(
|
|||
'prefix.h',
|
||||
'push.h',
|
||||
'scatter.glsl',
|
||||
meson.source_root() + '/src/amd/vulkan/radix_sort/targets/u64/config.h'
|
||||
dir_source_root + '/src/amd/vulkan/radix_sort/targets/u64/config.h'
|
||||
)
|
||||
|
||||
radix_sort_spv = []
|
||||
|
|
|
@ -77,7 +77,7 @@ if meson.has_exe_wrapper()
|
|||
join_paths(meson.current_source_dir(), 'warnings_test.py'),
|
||||
'--glsl-compiler', glsl_compiler,
|
||||
'--test-directory', join_paths(
|
||||
meson.source_root(), 'src', 'compiler', 'glsl', 'tests', 'warnings'
|
||||
dir_source_root, 'src', 'compiler', 'glsl', 'tests', 'warnings'
|
||||
),
|
||||
],
|
||||
suite : ['compiler', 'glsl'],
|
||||
|
|
|
@ -68,7 +68,7 @@ if with_tests
|
|||
diff,
|
||||
args: ['-u', files('../.gitlab-ci/reference/afuc_test.fw'), asm_fw],
|
||||
suite: 'freedreno',
|
||||
workdir: meson.source_root()
|
||||
workdir: dir_source_root
|
||||
)
|
||||
endif
|
||||
|
||||
|
@ -112,7 +112,7 @@ if cc.sizeof('size_t') > 4
|
|||
diff,
|
||||
args: ['-u', files('../.gitlab-ci/reference/afuc_test.asm'), disasm_fw],
|
||||
suite: 'freedreno',
|
||||
workdir: meson.source_root()
|
||||
workdir: dir_source_root
|
||||
)
|
||||
endif
|
||||
endif
|
||||
|
|
|
@ -146,7 +146,7 @@ if dep_lua.found() and dep_libarchive.found()
|
|||
diff,
|
||||
args: ['-u', files('../.gitlab-ci/reference/' + name + '.log'), log],
|
||||
suite: 'freedreno',
|
||||
workdir: meson.source_root()
|
||||
workdir: dir_source_root
|
||||
)
|
||||
|
||||
endforeach
|
||||
|
@ -186,7 +186,7 @@ if with_tests
|
|||
diff,
|
||||
args: ['-u', files('../.gitlab-ci/reference/crash.log'), crashdec_output],
|
||||
suite: 'freedreno',
|
||||
workdir: meson.source_root()
|
||||
workdir: dir_source_root
|
||||
)
|
||||
endif
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
inc_freedreno = include_directories(['.', './registers', './registers/adreno', './common'])
|
||||
inc_freedreno_rnn = include_directories('rnn')
|
||||
|
||||
rnn_src_path = meson.source_root() + '/src/freedreno/registers'
|
||||
rnn_src_path = dir_source_root + '/src/freedreno/registers'
|
||||
rnn_install_path = get_option('datadir') + '/freedreno/registers'
|
||||
rnn_path = rnn_src_path + ':' + get_option('prefix') + '/' + rnn_install_path
|
||||
|
||||
|
|
|
@ -82,7 +82,7 @@ tu_tracepoints = custom_target(
|
|||
output: ['tu_tracepoints.c', 'tu_tracepoints.h', 'tu_tracepoints_perfetto.h'],
|
||||
command: [
|
||||
prog_python, '@INPUT@',
|
||||
'-p', join_paths(meson.source_root(), 'src/util/perf/'),
|
||||
'-p', join_paths(dir_source_root, 'src/util/perf/'),
|
||||
'--utrace-src', '@OUTPUT0@',
|
||||
'--utrace-hdr', '@OUTPUT1@',
|
||||
'--perfetto-hdr', '@OUTPUT2@',
|
||||
|
|
|
@ -467,7 +467,7 @@ files_libgallium += custom_target(
|
|||
output: 'u_tracepoints.c',
|
||||
command: [
|
||||
prog_python, '@INPUT@',
|
||||
'-p', join_paths(meson.source_root(), 'src/util/perf/'),
|
||||
'-p', join_paths(dir_source_root, 'src/util/perf/'),
|
||||
'-C', '@OUTPUT@',
|
||||
],
|
||||
depend_files: u_trace_py,
|
||||
|
@ -479,7 +479,7 @@ files_u_tracepoints = custom_target(
|
|||
output: 'u_tracepoints.h',
|
||||
command: [
|
||||
prog_python, '@INPUT@',
|
||||
'-p', join_paths(meson.source_root(), 'src/util/perf/'),
|
||||
'-p', join_paths(dir_source_root, 'src/util/perf/'),
|
||||
'-H', '@OUTPUT@',
|
||||
],
|
||||
depend_files: u_trace_py,
|
||||
|
|
|
@ -225,7 +225,7 @@ freedreno_tracepoints = custom_target(
|
|||
output: ['freedreno_tracepoints.c', 'freedreno_tracepoints.h'],
|
||||
command: [
|
||||
prog_python, '@INPUT@',
|
||||
'-p', join_paths(meson.source_root(), 'src/util/perf/'),
|
||||
'-p', join_paths(dir_source_root, 'src/util/perf/'),
|
||||
'-C', '@OUTPUT0@',
|
||||
'-H', '@OUTPUT1@',
|
||||
],
|
||||
|
|
|
@ -49,7 +49,7 @@ zink_device_info = custom_target(
|
|||
input : ['zink_device_info.py'],
|
||||
output : ['zink_device_info.h', 'zink_device_info.c'],
|
||||
command : [
|
||||
prog_python, '@INPUT@', '@OUTPUT@', join_paths(meson.source_root(), 'src/vulkan/registry/vk.xml')
|
||||
prog_python, '@INPUT@', '@OUTPUT@', join_paths(dir_source_root, 'src/vulkan/registry/vk.xml')
|
||||
]
|
||||
)
|
||||
|
||||
|
@ -58,7 +58,7 @@ zink_instance = custom_target(
|
|||
input : ['zink_instance.py'],
|
||||
output : ['zink_instance.h', 'zink_instance.c'],
|
||||
command : [
|
||||
prog_python, '@INPUT@', '@OUTPUT@', join_paths(meson.source_root(), 'src/vulkan/registry/vk.xml')
|
||||
prog_python, '@INPUT@', '@OUTPUT@', join_paths(dir_source_root, 'src/vulkan/registry/vk.xml')
|
||||
]
|
||||
)
|
||||
|
||||
|
|
|
@ -93,7 +93,7 @@ if with_tests and not with_platform_android
|
|||
depend_files: gen_pack_header_deps
|
||||
)
|
||||
|
||||
genxml_path = join_paths(meson.source_root(),
|
||||
genxml_path = join_paths(dir_source_root,
|
||||
'@0@'.format(gentest_xml[0]))
|
||||
|
||||
test(
|
||||
|
|
|
@ -11,7 +11,7 @@ intel_tracepoint_files = custom_target(
|
|||
'intel_tracepoints.c'],
|
||||
command : [
|
||||
prog_python, '@INPUT@',
|
||||
'-p', join_paths(meson.source_root(), 'src/util/perf/'),
|
||||
'-p', join_paths(dir_source_root, 'src/util/perf/'),
|
||||
'--utrace-hdr', '@OUTPUT0@',
|
||||
'--perfetto-hdr', '@OUTPUT1@',
|
||||
'--utrace-src', '@OUTPUT2@',
|
||||
|
|
Loading…
Reference in New Issue