mirror of
https://github.com/CLIUtils/CLI11.git
synced 2025-05-03 05:53:52 +00:00
Meson: fixes, cleanups, and modernizations (#1024)
This series cleans up and modernizes the Meson code a bit: - It adds the license SPDX name to the proper field - Sets a minimum version, the version is fairly old, but without setting a version then Meson will never warn about issues, including potentially important ones like "this happens to work in some cases but wasn't intended and doesn't work in all cases" - uses more modern Meson features to make things easier for consumers - Fixes the tests using the ensure_utf8 helpers by ensuring that they're actually built, and placing them in the correct path. - Adds the Meson test to the CI
This commit is contained in:
parent
dc93d7a50c
commit
fe92f34655
3
.github/workflows/tests.yml
vendored
3
.github/workflows/tests.yml
vendored
@ -166,6 +166,9 @@ jobs:
|
|||||||
- name: Build
|
- name: Build
|
||||||
run: meson compile -C build-meson
|
run: meson compile -C build-meson
|
||||||
|
|
||||||
|
- name: Test
|
||||||
|
run: meson test -C build-meson
|
||||||
|
|
||||||
install:
|
install:
|
||||||
name: install tests
|
name: install tests
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
project('CLI11', ['cpp'],
|
project('CLI11', ['cpp'],
|
||||||
version : run_command(find_program('scripts/ExtractVersion.py'), check: true).stdout().strip(),
|
version : run_command(find_program('scripts/ExtractVersion.py'), check: true).stdout().strip(),
|
||||||
|
license : 'BSD-3-clause',
|
||||||
|
meson_version : '>= 0.60',
|
||||||
default_options : ['cpp_std=c++11', 'warning_level=3']
|
default_options : ['cpp_std=c++11', 'warning_level=3']
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -12,6 +14,8 @@ CLI11_dep = declare_dependency(
|
|||||||
version : meson.project_version(),
|
version : meson.project_version(),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
meson.override_dependency('CLI11', CLI11_dep)
|
||||||
|
|
||||||
if get_option('tests')
|
if get_option('tests')
|
||||||
warnings = ['-Wshadow', '-Wsign-conversion', '-Wswitch-enum']
|
warnings = ['-Wshadow', '-Wsign-conversion', '-Wswitch-enum']
|
||||||
if cxx.get_id() == 'gcc' and cxx.version().version_compare('>=4.9')
|
if cxx.get_id() == 'gcc' and cxx.version().version_compare('>=4.9')
|
||||||
|
@ -69,14 +69,16 @@ dependent_applications = [
|
|||||||
'ensure_utf8_twice',
|
'ensure_utf8_twice',
|
||||||
]
|
]
|
||||||
dependent_applications_definitions = []
|
dependent_applications_definitions = []
|
||||||
#dependent_applications_targets = []
|
dependent_applications_targets = []
|
||||||
foreach app: dependent_applications
|
foreach app: dependent_applications
|
||||||
app_target = executable(app, 'applications'/app + '.cpp',
|
app_target = executable(
|
||||||
build_by_default: false
|
app, 'applications'/app + '.cpp',
|
||||||
|
dependencies: CLI11_dep,
|
||||||
)
|
)
|
||||||
|
|
||||||
#dependent_applications_targets += dependency(app_target)
|
dependent_applications_targets += app_target
|
||||||
dependent_applications_definitions += '-DCLI11_@0@_EXE="@1@"'.format(app.to_upper(), app_target)
|
dependent_applications_definitions += '-DCLI11_@0@_EXE="@1@/@2@"'.format(
|
||||||
|
app.to_upper(), meson.current_build_dir(), app_target)
|
||||||
endforeach
|
endforeach
|
||||||
|
|
||||||
if host_machine.system() == 'windows'
|
if host_machine.system() == 'windows'
|
||||||
@ -96,5 +98,5 @@ foreach n: testnames
|
|||||||
dependencies: [testdep] + kwargs.get('dependencies', []),
|
dependencies: [testdep] + kwargs.get('dependencies', []),
|
||||||
link_with: kwargs.get('link_with', [])
|
link_with: kwargs.get('link_with', [])
|
||||||
)
|
)
|
||||||
test(name, t)
|
test(name, t, depends: dependent_applications_targets)
|
||||||
endforeach
|
endforeach
|
||||||
|
Loading…
x
Reference in New Issue
Block a user