-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmeson.build
120 lines (96 loc) · 2.32 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
project('CM4all State', 'cpp', version: '0.3',
meson_version: '>= 1.0',
default_options: [
'cpp_std=c++20',
'warning_level=3',
'fmt:cpp_std=c++20',
],
)
debug = get_option('b_ndebug') != 'true'
compiler = meson.get_compiler('cpp')
conf = configuration_data()
common_flags = [
'-D_GNU_SOURCE',
]
test_common_flags = [
'-Wcast-align',
'-Wcast-qual',
'-Wdouble-promotion',
'-Wfloat-equal',
'-Wmissing-declarations',
'-Wmissing-noreturn',
'-Wmissing-format-attribute',
'-Wredundant-decls',
'-Wshadow',
'-Wundef',
'-Wunused',
'-Wvla',
'-Wwrite-strings',
# clang specific warning options:
'-Wunreachable-code-aggressive',
'-Wused-but-marked-unused',
]
test_global_common_flags = [
'-fvisibility=hidden',
]
add_global_link_arguments(
compiler.get_supported_link_arguments(
# make relocations read-only (hardening)
'-Wl,-z,relro',
# no lazy binding, please - not worth it for a daemon
'-Wl,-z,now',
),
language: 'cpp'
)
if not debug
test_global_common_flags += [
'-ffunction-sections',
'-fdata-sections',
]
add_global_link_arguments(
compiler.get_supported_link_arguments(
'-Wl,--gc-sections',
'-Wl,--icf=all',
),
language: 'cpp'
)
endif
test_global_cxxflags = test_global_common_flags + [
]
test_cxxflags = test_common_flags + [
'-fno-threadsafe-statics',
'-fmerge-all-constants',
'-Wcomma-subscript',
'-Wextra-semi',
'-Wmismatched-tags',
'-Woverloaded-virtual',
'-Wsign-promo',
'-Wvolatile',
'-Wvirtual-inheritance',
'-Wno-missing-field-initializers',
# a vtable without a dtor is just fine
'-Wno-non-virtual-dtor',
# clang specific warning options:
'-Wcomma',
'-Wheader-hygiene',
'-Winconsistent-missing-destructor-override',
]
add_global_arguments(common_flags, language: 'c')
add_global_arguments(common_flags, language: 'cpp')
add_global_arguments(compiler.get_supported_arguments(test_global_cxxflags), language: 'cpp')
add_project_arguments(compiler.get_supported_arguments(test_cxxflags), language: 'cpp')
inc = include_directories('.', 'src', 'libcommon/src')
subdir('libcommon/src/util')
subdir('libcommon/src/lib/fmt')
subdir('libcommon/src/io')
executable(
'cm4all-state',
'src/Main.cxx',
include_directories: inc,
dependencies: [
fmt_dep,
io_dep,
],
install: true,
)
subdir('doc')