-
Notifications
You must be signed in to change notification settings - Fork 44
/
meson.build
100 lines (80 loc) · 2.47 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
project('DSPatch', 'cpp',
default_options: [
'cpp_std=c++17',
'warning_level=3',
'werror=true'
]
)
if host_machine.system() == 'darwin'
env = environment()
env.set('MACOSX_DEPLOYMENT_TARGET', '10.13')
add_project_arguments(['-mmacosx-version-min=10.13', '-arch', 'arm64', '-arch', 'x86_64'], language: 'cpp')
add_project_link_arguments(['-mmacosx-version-min=10.13', '-arch', 'arm64', '-arch', 'x86_64'], language: 'cpp')
endif
# Add code coverage
opencppcoverage = find_program('opencppcoverage', required: false)
opencppcoverage_args = [
'--sources', meson.project_name(),
'--excluded_sources', 'tests',
'--excluded_sources', 'tutorial'
]
if opencppcoverage.found()
run_target('codecoverage',
command: [
opencppcoverage,
'--input_coverage', 'Tests.cov',
'--export_type', 'html:coverage'
]
)
endif
# Add formatting
format_first = []
if find_program('clang-format', required: false).found()
if host_machine.system() == 'windows'
format_command = meson.current_source_dir() + '/scripts/clang-format.bat'
else
format_command = ['bash', meson.current_source_dir() + '/scripts/clang-format.sh']
endif
format_first = custom_target(
output: 'formatting',
command: format_command,
build_always: true
)
endif
# Add static code analysis
if find_program('cppcheck', required: false).found()
if host_machine.system() == 'windows'
extra_cppcheck_args = ['-D_WIN32']
else
extra_cppcheck_args = []
endif
custom_target(
input: format_first,
output: 'static code analysis',
command: [
'cppcheck',
'--error-exitcode=1',
'--enable=all',
'--check-level=exhaustive',
'--inconclusive',
'--inline-suppr',
'--force',
'--quiet',
'--suppress=missingIncludeSystem',
'--suppress=*:' + meson.current_source_dir() + '/include/fast_any/any.h',
'-i', meson.current_source_dir() + '/build',
'-I', meson.current_source_dir() + '/include',
extra_cppcheck_args,
meson.current_source_dir()
],
build_always: true
)
endif
# Configure DSPatch
dspatch_dep = declare_dependency(
include_directories: include_directories('include'),
dependencies: dependency('threads')
)
# Add subdirectories
subdir('tests')
subdir('tutorial')