-
Notifications
You must be signed in to change notification settings - Fork 3
/
meson.build
121 lines (109 loc) · 2.62 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
project('molch', ['cpp', 'c'],
default_options: [
'cpp_std=c++17',
'c_std=c99',
'werror=true',
'b_pch=true',
'b_pie=true',
],
license: ['ISC'])
c_compiler = meson.get_compiler('c')
cpp_compiler = meson.get_compiler('cpp')
common_flags = [
'-pedantic',
'-Wall',
'-Wextra',
'-Wwrite-strings',
'-Winit-self',
'-Wformat=2',
'-Wcast-qual',
'-Wswitch-default',
'-Wconversion',
'-fstack-protector-all',
'-Wcomma',
'-Wdouble-promotion',
'-Wno-parentheses',
'-fPIC',
'-Wunused-macros',
'-Wmissing-variable-declarations',
'-Wnull-dereference',
'-Wimplicit-fallthrough',
'-Wunused-parameter',
'-Wstrict-aliasing=1',
'-Walloc-zero',
'-Walloca',
'-Wduplicated-branches',
'-Wduplicated-cond',
'-Wfloat-equal',
'-Wtrampolines',
'-Wredundant-decls',
'-Wlogical-op',
'-Wno-type-limits',
'-fno-sanitize-recover=all',
'-Wunreachable-code',
'-Wdocumentation',
'-Wmissing-noreturn',
'-Wswitch-enum',
'-fvisibility=hidden',
'-Wno-unknown-warning-option',
'-Wno-tautological-constant-compare',
'-Wno-pragmas',
]
c_flags = [
'-Wmissing-prototypes',
]
cpp_flags = [
'-Wnoexcept',
'-Wno-error=noexcept',
'-Wstrict-null-sentinel',
'-Wold-style-cast',
'-Woverloaded-virtual',
'-Wsign-promo',
'-Wmultiple-inheritance',
'-Wvirtual-inheritance',
'-Wuninitialized',
'-Wsuggest-override',
'-Wconditionally-supported',
'-Wzero-as-null-pointer-constant',
'-Wrange-loop-analysis',
'-Wunused-exception-parameter',
]
if ['debugoptimized', 'release'].contains(get_option('buildtype'))
common_flags += [
'-O3',
'-U_FORTIFY_SOURCE',
'-D_FORTIFY_SOURCE=2'
]
endif
supported_c_flags = c_compiler.get_supported_arguments(common_flags + c_flags)
supported_cpp_flags = cpp_compiler.get_supported_arguments(common_flags + cpp_flags)
add_project_arguments(supported_c_flags, language: 'c')
add_project_arguments(supported_cpp_flags, language: 'cpp')
linker_flags = [
'-znoexecstack',
'-znow',
'-zrelro',
'-ztext',
]
supported_c_linker_flags = c_compiler.get_supported_link_arguments(linker_flags)
supported_cpp_linker_flags = cpp_compiler.get_supported_link_arguments(linker_flags)
add_project_link_arguments(supported_c_linker_flags, language: 'c')
add_project_link_arguments(supported_cpp_linker_flags, language: 'cpp')
#valgrind
valgrind = find_program('valgrind', required: false)
if valgrind.found()
add_test_setup(
'valgrind',
exe_wrapper: [
valgrind,
'--suppressions=' + join_paths(meson.current_source_dir(), 'valgrind.supp'),
'--trace-children=yes',
'--leak-check=full',
'--error-exitcode=10'
],
timeout_multiplier: 100)
endif
subdir('include')
subdir('lib')
subdir('test')
subdir('bindings')