-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathmeson.build
131 lines (115 loc) · 4.53 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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
project('snitch', 'cpp',
default_options: ['cpp_std=c++20', 'default_library=static'],
version: '1.3.1'
)
cpp_arguments = []
cxx = meson.get_compiler('cpp')
compiler_id = cxx.get_id()
host_system = host_machine.system()
is_mingw = host_system == 'windows' and cxx.get_id() == 'gcc'
if get_option('default_library') == 'shared'
if compiler_id == 'msvc' or is_mingw
# Nothing to do; default is already to hide symbols unless exported.
elif compiler_id == 'gcc' or compiler_id == 'clang'
# Set default visibility to "hidden" so only exported symbols are visible.
cpp_arguments += cxx.get_supported_arguments([
'-fvisibility=hidden',
'-fvisibility-inlines-hidden'
])
endif
endif
add_project_arguments(cpp_arguments, language : 'cpp')
add_project_link_arguments(cpp_arguments, language : 'cpp')
include_dirs = include_directories('.', 'include')
headers = files('include/snitch/snitch.hpp',
'include/snitch/snitch_any.hpp',
'include/snitch/snitch_append.hpp',
'include/snitch/snitch_capture.hpp',
'include/snitch/snitch_cli.hpp',
'include/snitch/snitch_concepts.hpp',
'include/snitch/snitch_console.hpp',
'include/snitch/snitch_error_handling.hpp',
'include/snitch/snitch_expression.hpp',
'include/snitch/snitch_file.hpp',
'include/snitch/snitch_fixed_point.hpp',
'include/snitch/snitch_function.hpp',
'include/snitch/snitch_macros_check.hpp',
'include/snitch/snitch_macros_check_base.hpp',
'include/snitch/snitch_macros_consteval.hpp',
'include/snitch/snitch_macros_constexpr.hpp',
'include/snitch/snitch_macros_exceptions.hpp',
'include/snitch/snitch_macros_misc.hpp',
'include/snitch/snitch_macros_reporter.hpp',
'include/snitch/snitch_macros_test_case.hpp',
'include/snitch/snitch_macros_utility.hpp',
'include/snitch/snitch_macros_warnings.hpp',
'include/snitch/snitch_matcher.hpp',
'include/snitch/snitch_registry.hpp',
'include/snitch/snitch_reporter_catch2_xml.hpp',
'include/snitch/snitch_reporter_console.hpp',
'include/snitch/snitch_reporter_teamcity.hpp',
'include/snitch/snitch_section.hpp',
'include/snitch/snitch_string.hpp',
'include/snitch/snitch_string_utility.hpp',
'include/snitch/snitch_test_data.hpp',
'include/snitch/snitch_type_name.hpp',
'include/snitch/snitch_type_id.hpp',
'include/snitch/snitch_vector.hpp')
sources = files('src/snitch_append.cpp',
'src/snitch_capture.cpp',
'src/snitch_cli.cpp',
'src/snitch_console.cpp',
'src/snitch_error_handling.cpp',
'src/snitch_file.cpp',
'src/snitch_main.cpp',
'src/snitch_matcher.cpp',
'src/snitch_registry.cpp',
'src/snitch_reporter_catch2_xml.cpp',
'src/snitch_reporter_console.cpp',
'src/snitch_reporter_teamcity.cpp',
'src/snitch_section.cpp',
'src/snitch_string_utility.cpp',
'src/snitch_test_data.cpp')
if get_option('enable')
if get_option('unity_build')
main = files('src/snitch.cpp')
else
main = sources
endif
else
main = files('src/snitch_main.cpp')
endif
make_snitch_all = files('make_snitch_all.py')
subdir('snitch')
install_headers(headers, subdir: 'snitch')
if get_option('create_library')
snitch = library('snitch',
conf_file, main, headers,
include_directories: include_dirs,
install: true,
)
snitch_dep = declare_dependency(
link_with: snitch,
include_directories: include_dirs
)
import('pkgconfig').generate(
snitch,
filebase: 'snitch',
description: 'Lightweight C++20 testing framework.',
url: 'https://github.com/cschreib/snitch',
)
else
snitch_dep = declare_dependency(include_directories: include_dirs)
endif
if meson.version().version_compare('>=0.54.0')
meson.override_dependency('snitch', snitch_dep)
endif
if get_option('enable')
test('snitch_all_test',
executable('snitch_all_test',
[snitch_all, 'tests/testing.cpp'],
cpp_args: ['-DSNITCH_TEST_WITH_SNITCH', '-DSNITCH_TEST_HEADER_ONLY'],
dependencies: [snitch_dep]
)
)
endif