1
0
mirror of https://github.com/ThrowTheSwitch/Unity.git synced 2026-01-23 08:25:58 +01:00

Implement review feedback for Meson updates.

1. Call the version extraction script directly instead
   of through a Python returned from `find_program()`.

2. We don't need to use `meson.project_source_root()` as
   `find_program()` will search relative to the current meson.build
   script.

3. Lower the required version back to `>= 0.37.0`, and modify
   some things to get rid of warnings with this version selected.
   The use of `summary()`, `dict`, and positional arguments in
   `pkgconfig.generate()` generate warnings with this version so
   remove `summary()` and dict()`, also pass keyword arguments to
   `pkgconfig.generate()`.
This commit is contained in:
Andrew McNulty
2023-02-14 09:18:13 +01:00
parent 44bc9e6dbe
commit 43378c4262
2 changed files with 12 additions and 21 deletions

View File

@@ -10,23 +10,21 @@ project('unity', 'c',
# Set project version to value extracted from unity.h header
version: run_command(
[
find_program('python', 'python3'),
'auto' / 'extract_version.py',
'src' / 'unity.h'
'auto/extract_version.py',
'src/unity.h'
],
check: true
).stdout().strip(),
# `meson.project_source_root()` introduced in 0.56.0
meson_version: '>=0.56.0',
meson_version: '>=0.37.0',
default_options: [
'werror=true',
'c_std=c11'
]
)
build_fixture = get_option('extension_fixture').enabled()
build_memory = get_option('extension_memory').enabled()
build_fixture = get_option('extension_fixture')
build_memory = get_option('extension_memory')
unity_src = []
unity_inc = []
@@ -57,24 +55,17 @@ unity_dep = declare_dependency(
# Generate pkg-config file.
pkg = import('pkgconfig')
pkg.generate(unity_lib,
pkg.generate(
name: meson.project_name(),
version: meson.project_version(),
libraries: [ unity_lib ],
description: 'C Unit testing framework.'
)
# 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'),
find_program('auto/generate_test_runner.rb'),
output: '@BASENAME@_Runner.c',
arguments: ['@INPUT@', '@OUTPUT@']
)
# Summarize.
summary(
{
'Fixture extension': build_fixture,
'Memory extension': build_memory,
},
section: 'Extensions',
bool_yn: true
)

View File

@@ -1,2 +1,2 @@
option('extension_fixture', type: 'feature', value: 'disabled', description: 'Whether to use the fixture extension.')
option('extension_memory', type: 'feature', value: 'disabled', description: 'Whether to use the memory extension.')
option('extension_fixture', type: 'boolean', value: 'false', description: 'Whether to enable the fixture extension.')
option('extension_memory', type: 'boolean', value: 'false', description: 'Whether to enable the memory extension.')