blob: 75b57bf2c5969c3a500ae67dc8bf42292c87e856 [file] [log] [blame]
Ramesh Iyyarbb410df2020-08-03 03:13:04 -05001# SPDX-License-Identifier: Apache-2.0
2
3project('phosphor-debug-collector',
4 'cpp',
Patrick Williams8f4cc942021-10-01 16:05:41 -05005 meson_version: '>= 0.57.0',
Ramesh Iyyarbb410df2020-08-03 03:13:04 -05006 default_options: [
Patrick Williams8f4cc942021-10-01 16:05:41 -05007 'cpp_std=c++20',
Ramesh Iyyarbb410df2020-08-03 03:13:04 -05008 'warning_level=3',
PriyangaRamasamy01c66462021-02-23 05:46:25 -06009 'werror=true',
10 'buildtype=debugoptimized'
Ramesh Iyyarbb410df2020-08-03 03:13:04 -050011 ],
12 version: '1.0',
13 license: 'Apache-2.0'
14 )
15
Patrick Williamsabbe1592021-10-01 16:04:19 -050016cpp = meson.get_compiler('cpp')
17
Dhruvaraj Subhashchandran9f557362021-05-12 06:28:20 -050018# list of unit files, the path as input and service name
19# as output
20# eg: unit_file += {'input:'<path>, 'output':<service name>}
21unit_files = []
22
Ramesh Iyyarbb410df2020-08-03 03:13:04 -050023# Checking dependency external library
24
Ramesh Iyyarbb410df2020-08-03 03:13:04 -050025libsystemd = dependency('libsystemd', version : '>=221')
George Liu73e0bab2021-06-29 15:57:43 +080026
Patrick Williams02634e52022-03-21 11:16:11 -050027sdbusplus_dep = dependency('sdbusplus')
28sdbusplusplus_prog = find_program('sdbus++')
29sdbuspp_gen_meson_prog = find_program('sdbus++-gen-meson')
Marri Devender Rao3ed02c32022-06-28 23:12:14 -050030sdeventplus_dep = dependency('sdeventplus')
Patrick Williams02634e52022-03-21 11:16:11 -050031
32phosphor_dbus_interfaces_dep = dependency('phosphor-dbus-interfaces')
33phosphor_logging_dep = dependency('phosphor-logging')
Ramesh Iyyarbb410df2020-08-03 03:13:04 -050034
George Liu858fbb22021-07-01 12:25:44 +080035fmt_dep = dependency('fmt', required: false)
36if not fmt_dep.found()
37 fmt_proj = import('cmake').subproject(
38 'fmt',
39 cmake_options: [
40 '-DCMAKE_POSITION_INDEPENDENT_CODE=ON',
41 '-DMASTER_PROJECT=OFF'
42 ],
43 required: false)
44 assert(fmt_proj.found(), 'fmtlib is required')
45 fmt_dep = fmt_proj.dependency('fmt')
46endif
47
Patrick Williamsabbe1592021-10-01 16:04:19 -050048# Get Cereal dependency.
49cereal_dep = dependency('cereal', required: false)
50has_cereal = cpp.has_header_symbol(
51 'cereal/cereal.hpp',
52 'cereal::specialize',
53 dependencies: cereal_dep,
54 required: false)
55if not has_cereal
56 cereal_opts = import('cmake').subproject_options()
57 cereal_opts.add_cmake_defines({'BUILD_TESTS': 'OFF'})
58 cereal_proj = import('cmake').subproject(
59 'cereal',
60 options: cereal_opts,
61 required: false)
62 assert(cereal_proj.found(), 'cereal is required')
63 cereal_dep = cereal_proj.dependency('cereal')
64endif
65
PriyangaRamasamy01c66462021-02-23 05:46:25 -060066# Disable FORTIFY_SOURCE when compiling with no optimization
67if(get_option('optimization') == '0')
68 add_project_arguments('-U_FORTIFY_SOURCE',language:['cpp','c'])
69 message('Disabling FORTIFY_SOURCE as optimization is set to 0')
70endif
71
Ramesh Iyyarbb410df2020-08-03 03:13:04 -050072# Configuration header file(config.h) generation
73
74conf_data = configuration_data()
75
76conf_data.set_quoted('DUMP_BUSNAME', get_option('DUMP_BUSNAME'),
77 description : 'The Dbus busname to own'
78 )
79conf_data.set_quoted('DUMP_OBJPATH', get_option('DUMP_OBJPATH'),
80 description : 'The Dump manager Dbus root'
81 )
Dhruvaraj Subhashchandranfef66a92020-09-06 13:10:59 -050082conf_data.set_quoted('BMC_DUMP_OBJPATH', get_option('BMC_DUMP_OBJPATH'),
83 description : 'The BMC Dump manager Dbus path'
84 )
Ramesh Iyyarbb410df2020-08-03 03:13:04 -050085conf_data.set_quoted('CORE_FILE_DIR', get_option('CORE_FILE_DIR'),
86 description : 'Directory where core dumps are placed'
87 )
88conf_data.set_quoted('OBJ_INTERNAL', get_option('OBJ_INTERNAL'),
89 description : 'Internal Dump manager Dbus object path'
90 )
Dhruvaraj Subhashchandranfef66a92020-09-06 13:10:59 -050091conf_data.set_quoted('BMC_DUMP_OBJ_ENTRY', get_option('BMC_DUMP_OBJ_ENTRY'),
92 description : 'The BMC dump entry DBus object path'
Ramesh Iyyarbb410df2020-08-03 03:13:04 -050093 )
94conf_data.set_quoted('BMC_DUMP_PATH', get_option('BMC_DUMP_PATH'),
95 description : 'Directory where bmc dumps are placed')
George Liuff92ffe2021-02-09 15:01:53 +080096conf_data.set_quoted('SYSTEMD_PSTORE_PATH', get_option('SYSTEMD_PSTORE_PATH'),
97 description : 'Path to the systemd pstore directory')
Ramesh Iyyarbb410df2020-08-03 03:13:04 -050098conf_data.set('BMC_DUMP_MAX_SIZE', get_option('BMC_DUMP_MAX_SIZE'),
99 description : 'Maximum size of one bmc dump in kilo bytes'
100 )
101conf_data.set('BMC_DUMP_MIN_SPACE_REQD', get_option('BMC_DUMP_MIN_SPACE_REQD'),
102 description : 'Minimum space required for one bmc dump in kilo bytes'
103 )
104conf_data.set('BMC_DUMP_TOTAL_SIZE', get_option('BMC_DUMP_TOTAL_SIZE'),
105 description : 'Total size of the dump in kilo bytes'
106 )
107conf_data.set_quoted('OBJ_LOGGING', '/xyz/openbmc_project/logging',
108 description : 'The log manager DBus object path'
109 )
110conf_data.set_quoted('ELOG_ID_PERSIST_PATH', get_option('ELOG_ID_PERSIST_PATH'),
111 description : 'Path of file for storing elog id\'s, which have associated dumps'
112 )
113conf_data.set('CLASS_VERSION', get_option('CLASS_VERSION'),
114 description : 'Class version to register with Cereal'
115 )
116conf_data.set('ERROR_MAP_YAML', get_option('ERROR_MAP_YAML'),
117 description : 'YAML filepath containing error object paths'
118 )
Chirag Sharmae22aca72021-01-18 09:55:29 -0600119conf_data.set('JFFS_CORE_FILE_WORKAROUND', get_option('jffs-workaround').enabled(),
120 description : 'Turn on jffs workaround for core file'
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500121 )
Claire Weinan919f71c2022-03-01 19:02:07 -0800122conf_data.set_quoted('FAULTLOG_DUMP_OBJ_ENTRY', get_option('FAULTLOG_DUMP_OBJ_ENTRY'),
123 description : 'The Fault Log dump entry DBus object path'
124 )
125conf_data.set_quoted('FAULTLOG_DUMP_OBJPATH', get_option('FAULTLOG_DUMP_OBJPATH'),
126 description : 'The Fault Log Dump manager Dbus path'
127 )
128conf_data.set_quoted('FAULTLOG_DUMP_PATH', get_option('FAULTLOG_DUMP_PATH'),
129 description : 'Directory where fault logs are placed'
130 )
Xie Ningfc69f352022-05-17 16:06:52 +0800131conf_data.set('BMC_DUMP_ROTATE_CONFIG', get_option('dump_rotate_config').enabled(),
132 description : 'Turn on rotate config for bmc dump'
133 )
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500134
135configure_file(configuration : conf_data,
136 output : 'config.h'
137 )
138
139subdir('xyz/openbmc_project/Dump/Internal/Create')
140
141python = find_program('python3')
Patrick Williamsce836882021-10-01 16:09:35 -0500142errors_map_gen_file_loc = meson.project_source_root()
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500143errors_map_gen_file_loc += '/errors_map_gen.py'
144
145errors_map_hpp = custom_target(
146 'errors_map.hpp',
147 command : [
148 python,
149 errors_map_gen_file_loc,
150 '-i',
151 get_option('ERROR_MAP_YAML')
152 ],
153 depend_files : [ 'errors_map.mako.hpp',
154 'errors_map_gen.py',
155 get_option('ERROR_MAP_YAML')
156 ],
157 output : 'errors_map.hpp'
158 )
159
160phosphor_dump_manager_sources = [
161 'dump_entry.cpp',
162 'dump_manager.cpp',
Dhruvaraj Subhashchandranfef66a92020-09-06 13:10:59 -0500163 'dump_manager_bmc.cpp',
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500164 'dump_manager_main.cpp',
165 'dump_serialize.cpp',
166 'elog_watch.cpp',
167 errors_map_hpp,
168 server_hpp,
169 server_cpp,
170 'watch.cpp',
171 'bmc_dump_entry.cpp',
172 'dump_utils.cpp',
Claire Weinan919f71c2022-03-01 19:02:07 -0800173 'dump_offload.cpp',
174 'dump_manager_faultlog.cpp',
175 'faultlog_dump_entry.cpp',
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500176 ]
177
178phosphor_dump_manager_dependency = [
George Liu73e0bab2021-06-29 15:57:43 +0800179 phosphor_dbus_interfaces_dep,
180 sdbusplus_dep,
Marri Devender Rao3ed02c32022-06-28 23:12:14 -0500181 sdeventplus_dep,
George Liu73e0bab2021-06-29 15:57:43 +0800182 phosphor_logging_dep,
Patrick Williamsabbe1592021-10-01 16:04:19 -0500183 fmt_dep,
184 cereal_dep,
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500185 ]
186
187phosphor_dump_manager_install = true
188
Ramesh Iyyar3af5c322020-12-04 00:38:42 -0600189phosphor_dump_manager_incdir = []
190
Ramesh Iyyar131994b2020-12-03 08:35:36 -0600191# To get host transport based interface to take respective host
192# dump actions. It will contain required sources and dependency
193# list for phosphor_dump_manager.
194subdir('host-transport-extensions')
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500195
Dhruvaraj Subhashchandran8b9b4692020-09-24 11:59:42 -0500196#pick any architecture specific dumps
197subdir('dump-extensions')
198
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500199phosphor_dump_monitor_sources = [
200 'core_manager.cpp',
201 'core_manager_main.cpp',
202 'watch.cpp'
203 ]
204
205phosphor_dump_monitor_dependency = [
George Liu73e0bab2021-06-29 15:57:43 +0800206 phosphor_dbus_interfaces_dep,
207 phosphor_logging_dep,
George Liu858fbb22021-07-01 12:25:44 +0800208 fmt_dep
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500209 ]
210
211phosphor_dump_monitor_install = true
212
Ramesh Iyyar3af5c322020-12-04 00:38:42 -0600213phosphor_dump_monitor_incdir = []
214
George Liuff92ffe2021-02-09 15:01:53 +0800215phosphor_ramoops_monitor_sources = [
216 'ramoops_manager.cpp',
217 'ramoops_manager_main.cpp',
218 'watch.cpp'
219 ]
220
221phosphor_ramoops_monitor_dependency = [
George Liu858fbb22021-07-01 12:25:44 +0800222 phosphor_dbus_interfaces_dep,
223 phosphor_logging_dep,
George Liu858fbb22021-07-01 12:25:44 +0800224 fmt_dep
George Liuff92ffe2021-02-09 15:01:53 +0800225 ]
226
227phosphor_ramoops_monitor_install = true
228
229phosphor_ramoops_monitor_incdir = []
230
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500231executables = [[ 'phosphor-dump-manager',
232 phosphor_dump_manager_sources,
233 phosphor_dump_manager_dependency,
Ramesh Iyyar3af5c322020-12-04 00:38:42 -0600234 phosphor_dump_manager_install,
235 phosphor_dump_manager_incdir
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500236 ],
237 [ 'phosphor-dump-monitor',
238 phosphor_dump_monitor_sources,
239 phosphor_dump_monitor_dependency,
Ramesh Iyyar3af5c322020-12-04 00:38:42 -0600240 phosphor_dump_monitor_install,
241 phosphor_dump_monitor_incdir
George Liuff92ffe2021-02-09 15:01:53 +0800242 ],
243 [ 'phosphor-ramoops-monitor',
244 phosphor_ramoops_monitor_sources,
245 phosphor_ramoops_monitor_dependency,
246 phosphor_ramoops_monitor_install,
247 phosphor_ramoops_monitor_incdir
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500248 ]
249 ]
250
251foreach executable : executables
252 binary = executable(
253 executable[0],
254 executable[1],
255 dependencies: executable[2],
Ramesh Iyyar3af5c322020-12-04 00:38:42 -0600256 install : executable[3],
257 include_directories : executable[4]
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500258 )
259endforeach
Chirag Sharma50427252020-08-11 12:11:38 -0500260
Dhruvaraj Subhashchandran9f557362021-05-12 06:28:20 -0500261unit_subs = configuration_data()
262unit_subs.set('bindir', join_paths(get_option('prefix'), get_option('bindir')))
263systemd_system_unit_dir = dependency('systemd').get_pkgconfig_variable(
264 'systemdsystemunitdir',
265 define_variable: ['prefix', get_option('prefix')])
266foreach u : unit_files
267 configure_file(
268 configuration: unit_subs,
269 input: u.get('input'),
270 install: true,
271 install_dir: systemd_system_unit_dir,
272 output: u.get('output')
273 )
274endforeach
275
Chirag Sharma50427252020-08-11 12:11:38 -0500276if get_option('tests').enabled()
277 subdir('test')
278endif