-
Notifications
You must be signed in to change notification settings - Fork 365
/
Copy pathmeson.build
103 lines (93 loc) · 2.6 KB
/
meson.build
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
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', {}],
['EncodingTest', {}],
# multi-only
['TimerTest', {}],
# link_test
['link_test_2', {'link_with': link_test_lib}],
]
dependent_applications = [
'ensure_utf8',
'ensure_utf8_twice',
]
dependent_applications_definitions = []
dependent_applications_targets = []
foreach app: dependent_applications
app_target = executable(
app, 'applications'/app + '.cpp',
dependencies: CLI11_dep,
)
dependent_applications_targets += app_target
dependent_applications_definitions += '-DCLI11_@0@_EXE="@1@/@2@"'.format(
app.to_upper(), meson.current_build_dir(), 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, depends: dependent_applications_targets)
endforeach