mirror of
https://github.com/CLIUtils/CLI11.git
synced 2025-05-01 05:03:52 +00:00
Fixes #845 as discussed. Comparing the two approaches of getting `argv`: 1. The "old" way, through `CLI::argv()`: ✔️ Works automatically and almost everywhere ❌ Small abstraction overhead on macOS ❌ Does not work in weird edge-cases such as missing `/proc` 2. This PR, through `app.ensure_utf8`: ✔️ True zero-overhead abstraction: you don't pay for what you don't use ✔️ Less moving parts than the "old" approach, probably can't be broken ❌ Requires extra code to be written by the user (which is sad because ideally everyone should use this by default) --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
102 lines
2.5 KiB
Meson
102 lines
2.5 KiB
Meson
catch2 = dependency('catch2')
|
|
|
|
if catch2.version().version_compare('<3')
|
|
testmain = static_library(
|
|
'catch_main',
|
|
'main.cpp', 'catch.hpp',
|
|
dependencies: catch2,
|
|
)
|
|
testdep = declare_dependency(
|
|
link_with: testmain,
|
|
dependencies: [catch2, CLI11_dep]
|
|
)
|
|
else
|
|
testdep = declare_dependency(
|
|
dependencies: [CLI11_dep, dependency('catch2-with-main')],
|
|
compile_args: '-DCLI11_CATCH3'
|
|
)
|
|
endif
|
|
|
|
link_test_lib = library(
|
|
'link_test_1',
|
|
'link_test_1.cpp',
|
|
dependencies: CLI11_dep,
|
|
)
|
|
|
|
if cxx.get_id() == 'msvc'
|
|
nodeprecated = ['/wd4996']
|
|
else
|
|
nodeprecated = ['-Wno-deprecated-declarations']
|
|
endif
|
|
|
|
boost = dependency('boost', required: false)
|
|
if boost.found()
|
|
boost_dep = declare_dependency(
|
|
dependencies: boost,
|
|
compile_args: '-DCLI11_BOOST_OPTIONAL',
|
|
)
|
|
else
|
|
boost_dep = declare_dependency()
|
|
endif
|
|
|
|
testnames = [
|
|
['HelpersTest', {}],
|
|
['ConfigFileTest', {}],
|
|
['OptionTypeTest', {}],
|
|
['SimpleTest', {}],
|
|
['AppTest', {}],
|
|
['SetTest', {}],
|
|
['TransformTest', {}],
|
|
['CreationTest', {}],
|
|
['SubcommandTest', {}],
|
|
['HelpTest', {}],
|
|
['FormatterTest', {}],
|
|
['NewParseTest', {}],
|
|
['OptionalTest', {'dependencies': boost_dep}],
|
|
['DeprecatedTest', {'cpp_args': nodeprecated}],
|
|
['StringParseTest', {}],
|
|
['ComplexTypeTest', {}],
|
|
['TrueFalseTest', {}],
|
|
['OptionGroupTest', {}],
|
|
# multi-only
|
|
['TimerTest', {}],
|
|
# link_test
|
|
['link_test_2', {'link_with': link_test_lib}],
|
|
]
|
|
|
|
dependent_applications = [
|
|
'system_args',
|
|
'ensure_utf8',
|
|
'ensure_utf8_twice',
|
|
]
|
|
dependent_applications_definitions = []
|
|
#dependent_applications_targets = []
|
|
foreach app: dependent_applications
|
|
app_target = executable(app, 'applications'/app + '.cpp',
|
|
build_by_default: false
|
|
)
|
|
|
|
#dependent_applications_targets += dependency(app_target)
|
|
dependent_applications_definitions += '-DCLI11_@0@_EXE="@1@"'.format(app.to_upper(), app_target)
|
|
endforeach
|
|
|
|
if host_machine.system() == 'windows'
|
|
testnames += [['WindowsTest', {}]]
|
|
endif
|
|
|
|
if boost.found()
|
|
testnames += [['BoostOptionTypeTest', {'dependencies': boost_dep}]]
|
|
endif
|
|
|
|
foreach n: testnames
|
|
name = n[0]
|
|
kwargs = n[1]
|
|
t = executable(name, name + '.cpp',
|
|
cpp_args: kwargs.get('cpp_args', []) + dependent_applications_definitions,
|
|
build_by_default: false,
|
|
dependencies: [testdep] + kwargs.get('dependencies', []),
|
|
link_with: kwargs.get('link_with', [])
|
|
)
|
|
test(name, t)
|
|
endforeach
|