-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmeson.build
75 lines (62 loc) · 1.54 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
project(
'shvc',
'c',
version: files('version'),
license: 'GPL-3.0-or-later',
default_options: 'c_std=c17',
meson_version: '>=0.57.0',
)
cc = meson.get_compiler('c')
isnuttx = cc.get_define('__NuttX__') != '' # Won't be defined outside NuttX
fs = import('fs')
add_project_arguments('-D_GNU_SOURCE', language: 'c')
add_project_arguments('-DPROJECT_VERSION="@0@"'.format(meson.project_version()), language: 'c')
if not isnuttx
argp = cc.has_function('argp_parse') ? declare_dependency() : cc.find_library('argp')
else
argp = declare_dependency()
endif
gperf = generator(find_program('gperf'),
output: '@[email protected]',
arguments: ['@EXTRA_ARGS@', '--output-file=@OUTPUT@', '@INPUT@']
)
subdir('include')
subdir('libfoo')
foo_opt = get_option('foo')
if foo_opt
subdir('src')
endif
test_buildtypes = ['debug', 'debugoptimized']
tests_opt = get_option('tests')
if (
not isnuttx
and not meson.is_subproject()
and (
tests_opt.enabled()
or (tests_opt.auto()
and get_option('buildtype') in test_buildtypes)
)
)
subdir('tests')
endif
cppcheck = find_program('cppcheck', required: false)
if cppcheck.found()
run_target(
'cppcheck',
command: [
cppcheck,
'--project=' + join_paths(
meson.project_build_root(),
'compile_commands.json',
),
'--suppress=*:*subprojects*',
],
)
endif
flawfinder = find_program('flawfinder', required: false)
if flawfinder.found()
run_target(
'flawfinder',
command: [flawfinder, '--error-level=5', meson.project_source_root()],
)
endif