Skip to content

Commit 699a391

Browse files
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.
1 parent 5204c1b commit 699a391

File tree

1 file changed

+15
-14
lines changed

1 file changed

+15
-14
lines changed

meson.build

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,22 @@
55
# license: MIT
66
#
77
project('unity', 'c',
8-
license: 'MIT',
9-
meson_version: '>=0.37.0',
10-
default_options: ['werror=true', 'c_std=c11'])
8+
license: 'MIT',
9+
# `meson.project_source_root()` introduced in 0.56.0
10+
meson_version: '>=0.56.0',
11+
default_options: [
12+
'werror=true',
13+
'c_std=c11'
14+
]
15+
)
1116

1217
subdir('src')
1318
unity_dep = declare_dependency(link_with: unity_lib, include_directories: unity_dir)
1419

15-
16-
# Get the generate_test_runner script relative to itself or the parent project if it is being used as a subproject
17-
# NOTE: This could be (and probably is) a complete hack - but I haven't yet been able to find a better way....
18-
if meson.is_subproject()
19-
gen_test_runner_path = find_program(meson.source_root() / 'subprojects/unity/auto/generate_test_runner.rb')
20-
else
21-
gen_test_runner_path = find_program('subprojects/unity/auto/generate_test_runner.rb')
22-
endif
23-
24-
# Create a generator that we can access from the parent project
25-
gen_test_runner = generator(gen_test_runner_path, output: '@BASENAME@_Runner.c', arguments: ['@INPUT@', '@OUTPUT@'] )
20+
# Create a generator that can be used by consumers of our build system to generate
21+
# test runners.
22+
gen_test_runner = generator(
23+
find_program(meson.project_source_root() / 'auto' / 'generate_test_runner.rb'),
24+
output: '@BASENAME@_Runner.c',
25+
arguments: ['@INPUT@', '@OUTPUT@']
26+
)

0 commit comments

Comments
 (0)