Repository navigation
Expand file tree
/
Copy pathmeson.build
More file actions
163 lines (134 loc) · 3.55 KB
/
Copy pathmeson.build
File metadata and controls
163 lines (134 loc) · 3.55 KB
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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
project('CM4all Cash', 'cpp', version: '0.13',
meson_version: '>= 1.2',
default_options : [
'cpp_std=c++23',
'warning_level=3',
'fmt:cpp_std=c++23',
],
)
version_h = configuration_data()
version_h.set_quoted('VERSION', meson.project_version())
configure_file(output: 'version.h', configuration: version_h)
compiler = meson.get_compiler('cpp')
debug = get_option('b_ndebug') != 'true'
conf = configuration_data()
common_flags = [
'-D_GNU_SOURCE',
]
test_common_flags = [
'-Wcast-align',
'-Wcast-qual',
'-Wdouble-promotion',
'-Wfloat-equal',
'-Wmissing-declarations',
'-Wmissing-format-attribute',
'-Wmissing-noreturn',
'-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: 'cpp')
add_global_arguments(compiler.get_supported_arguments(test_global_cxxflags), language: 'cpp')
add_project_arguments(compiler.get_supported_arguments(test_cxxflags), language: 'cpp')
libsystemd = dependency('libsystemd', required: get_option('systemd'))
inc = include_directories('src', 'libcommon/src')
libcommon_require_uring = true
subdir('libcommon/src/util')
subdir('libcommon/src/lib/cap')
subdir('libcommon/src/lib/fmt')
subdir('libcommon/src/co')
subdir('libcommon/src/io')
subdir('libcommon/src/io/linux')
subdir('libcommon/src/io/uring')
subdir('libcommon/src/system')
subdir('libcommon/src/event')
subdir('libcommon/src/event/co')
if libsystemd.found()
subdir('libcommon/src/net')
subdir('libcommon/src/event/systemd')
libsystemd = event_systemd_dep
endif
conf.set('HAVE_LIBSYSTEMD', libsystemd.found())
conf.set('HAVE_LIBCAP', cap_dep.found())
conf.set('HAVE_MALLOC_TRIM', compiler.has_function('malloc_trim', prefix: '#include <malloc.h>'))
configure_file(output: 'config.h', configuration: conf)
executable('cm4all-cash',
'src/system/SetupProcess.cxx',
'src/Main.cxx',
'src/Options.cxx',
'src/Config.cxx',
'src/Cull.cxx',
'src/DevCachefiles.cxx',
'src/Walk.cxx',
'src/Chdir.cxx',
include_directories: inc,
dependencies: [
io_linux_dep,
event_co_dep,
event_dep,
util_dep,
fmt_dep,
cap_dep,
libsystemd,
],
install: true,
install_dir: 'sbin',
)
install_data('cachefilesd.conf', install_dir: get_option('sysconfdir'))
if get_option('test').allowed()
subdir('libcommon/src/time')
subdir('test')
subdir('libcommon/test/util')
subdir('libcommon/test/co')
endif