Updates to Meson build system:

1. Use cross-platform `/` operator for path construction.

2. Use `meson.project_source_root()` for correct path resolution of
   generate_test_runner.rb path when used as a subproject.

3. Bump the minimum required Meson version to '0.56.0' as this is
   needed for the above changes.
This commit is contained in:
Andrew McNulty
2023-02-13 15:55:47 +01:00
parent 5204c1bacf
commit 699a391c78

View File

@ -5,21 +5,22 @@
# license: MIT
#
project('unity', 'c',
license: 'MIT',
meson_version: '>=0.37.0',
default_options: ['werror=true', 'c_std=c11'])
license: 'MIT',
# `meson.project_source_root()` introduced in 0.56.0
meson_version: '>=0.56.0',
default_options: [
'werror=true',
'c_std=c11'
]
)
subdir('src')
unity_dep = declare_dependency(link_with: unity_lib, include_directories: unity_dir)
# Get the generate_test_runner script relative to itself or the parent project if it is being used as a subproject
# NOTE: This could be (and probably is) a complete hack - but I haven't yet been able to find a better way....
if meson.is_subproject()
gen_test_runner_path = find_program(meson.source_root() / 'subprojects/unity/auto/generate_test_runner.rb')
else
gen_test_runner_path = find_program('subprojects/unity/auto/generate_test_runner.rb')
endif
# Create a generator that we can access from the parent project
gen_test_runner = generator(gen_test_runner_path, output: '@BASENAME@_Runner.c', arguments: ['@INPUT@', '@OUTPUT@'] )
# Create a generator that can be used by consumers of our build system to generate
# test runners.
gen_test_runner = generator(
find_program(meson.project_source_root() / 'auto' / 'generate_test_runner.rb'),
output: '@BASENAME@_Runner.c',
arguments: ['@INPUT@', '@OUTPUT@']
)