forked from openbmc/phosphor-logging
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmeson.build
203 lines (183 loc) · 5.15 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
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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
project('phosphor-logging', 'cpp',
meson_version: '>=1.1.1',
default_options: [
'buildtype=debugoptimized',
'cpp_std=c++23',
'warning_level=3',
'werror=true',
'libonly=' + (meson.is_subproject() ? 'true' : 'false'),
'tests=' + (meson.is_subproject() ? 'disabled' : 'auto'),
],
version: '1.0.0',
)
enable_rsyslog_fwd_actions_conf = get_option('enable_rsyslog_fwd_actions_conf')
enable_log_streaming = get_option('enable_log_streaming')
# Define a preprocessor macro if the option is enabled
if enable_rsyslog_fwd_actions_conf
add_project_arguments('-DENABLE_RSYSLOG_FWD_ACTIONS_CONF', language: 'cpp')
endif
if enable_log_streaming
add_project_arguments('-DENABLE_LOG_STREAMING', language: 'cpp')
endif
cpp = meson.get_compiler('cpp')
python_prog = find_program('python3', native: true)
systemd_dep = dependency('systemd')
sdbusplus_dep = dependency('sdbusplus')
sdbusplusplus_prog = find_program('sdbus++', native: true)
sdbuspp_gen_meson_prog = find_program('sdbus++-gen-meson', native: true)
sdbusplusplus_depfiles = files()
if sdbusplus_dep.type_name() == 'internal'
sdbusplusplus_depfiles = subproject('sdbusplus').get_variable('sdbusplusplus_depfiles')
endif
pdi_dep = dependency('phosphor-dbus-interfaces')
# Find the installed YAML directory, either from a configure option or
# by pulling it from the PDI dependency.
yamldir = get_option('yamldir')
if yamldir == ''
yamldir = pdi_dep.get_variable('yamldir')
endif
subdir('config')
subdir('tools')
subdir('lib')
if get_option('libonly')
subdir_done()
endif
sdeventplus_dep = dependency('sdeventplus')
nlohmann_json_dep = dependency('nlohmann/json.hpp', required: false)
# Get Cereal dependency.
cereal_dep = dependency('cereal', required: false)
has_cereal = cpp.has_header_symbol(
'cereal/cereal.hpp',
'cereal::specialize',
dependencies: cereal_dep,
required: false)
if not has_cereal
cereal_opts = import('cmake').subproject_options()
cereal_opts.add_cmake_defines({'BUILD_TESTS': 'OFF', 'SKIP_PERFORMANCE_COMPARISON': 'ON'})
cereal_proj = import('cmake').subproject(
'cereal',
options: cereal_opts,
required: false)
assert(cereal_proj.found(), 'cereal is required')
cereal_dep = cereal_proj.dependency('cereal')
endif
# Generate sdbus++ files.
generated_sources = []
generated_others = []
subdir('gen')
subdir('gen/xyz')
# Generate callouts-gen.hpp.
callouts_gen = custom_target('callouts-gen.hpp'.underscorify(),
input: [
'callouts/callouts.py',
'callouts/callouts-gen.mako.hpp',
get_option('callout_yaml'),
],
output: 'callouts-gen.hpp',
command: [ python_prog, '@INPUT0@', '-i', '@INPUT2@', '-o', '@OUTPUT0@' ],
)
# Generate elog-lookup.cpp
elog_lookup_gen = custom_target('elog-lookup.cpp'.underscorify(),
input: files(
'tools/elog-gen.py',
'tools/phosphor-logging/templates/elog-lookup-template.mako.cpp',
),
output: 'elog-lookup.cpp',
command: [
python_prog, '@INPUT0@',
'-t', '',
'-m', '@INPUT1@',
'-y', yamldir,
'-u', meson.current_source_dir() / 'tools/',
'-o', '@OUTPUT0@',
],
)
# Generate elog-process-metadata.cpp
elog_process_gen = custom_target('elog-process-metadata.cpp'.underscorify(),
input: files(
'tools/elog-gen.py',
'tools/phosphor-logging/templates/elog-process-metadata.mako.cpp',
),
output: 'elog-process-metadata.cpp',
command: [
python_prog, '@INPUT0@',
'-t', '',
'-m', '@INPUT1@',
'-y', yamldir,
'-u', meson.current_source_dir() / 'tools/',
'-o', '@OUTPUT0@',
],
)
log_manager_ext_sources = []
log_manager_ext_deps = []
log_manager_ext_args = []
subdir('extensions')
subdir('phosphor-rsyslog-config')
log_sources = []
if enable_log_streaming
log_sources = [
'log_streamer.cpp',
]
endif
# Generate daemon.
log_manager_sources = [
generated_sources,
callouts_gen,
elog_lookup_gen,
elog_process_gen,
files(
'elog_entry.cpp',
'elog_meta.cpp',
'elog_serialize.cpp',
'extensions.cpp',
'log_manager.cpp',
'util.cpp',
)
]
log_manager_deps = [
cereal_dep,
conf_h_dep,
pdi_dep,
phosphor_logging_dep,
sdbusplus_dep,
sdeventplus_dep,
nlohmann_json_dep,
]
executable('phosphor-log-manager',
log_sources,
log_manager_sources,
log_manager_ext_sources,
'log_manager_main.cpp',
include_directories: include_directories('gen'),
cpp_args: log_manager_ext_args,
dependencies: [
log_manager_deps,
log_manager_ext_deps,
],
install: true,
)
# Generate test executables which run in obmc env (qemu, real hardware).
executable('logging-test',
'logging_test.cpp',
dependencies: [
pdi_dep,
phosphor_logging_dep,
sdbusplus_dep,
],
install: true,
)
executable('callout-test',
'callouts/callout_test.cpp',
dependencies: [
conf_h_dep,
pdi_dep,
phosphor_logging_dep,
sdbusplus_dep,
sdeventplus_dep,
],
install: true,
)
subdir('dist')
if not get_option('tests').disabled()
subdir('test')
endif