blob: 3566a89418780ac4db7774359685a3240033e180 [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')
30
31phosphor_dbus_interfaces_dep = dependency('phosphor-dbus-interfaces')
32phosphor_logging_dep = dependency('phosphor-logging')
Ramesh Iyyarbb410df2020-08-03 03:13:04 -050033
George Liu858fbb22021-07-01 12:25:44 +080034fmt_dep = dependency('fmt', required: false)
35if not fmt_dep.found()
36 fmt_proj = import('cmake').subproject(
37 'fmt',
38 cmake_options: [
39 '-DCMAKE_POSITION_INDEPENDENT_CODE=ON',
40 '-DMASTER_PROJECT=OFF'
41 ],
42 required: false)
43 assert(fmt_proj.found(), 'fmtlib is required')
44 fmt_dep = fmt_proj.dependency('fmt')
45endif
46
Patrick Williamsabbe1592021-10-01 16:04:19 -050047# Get Cereal dependency.
48cereal_dep = dependency('cereal', required: false)
49has_cereal = cpp.has_header_symbol(
50 'cereal/cereal.hpp',
51 'cereal::specialize',
52 dependencies: cereal_dep,
53 required: false)
54if not has_cereal
55 cereal_opts = import('cmake').subproject_options()
56 cereal_opts.add_cmake_defines({'BUILD_TESTS': 'OFF'})
57 cereal_proj = import('cmake').subproject(
58 'cereal',
59 options: cereal_opts,
60 required: false)
61 assert(cereal_proj.found(), 'cereal is required')
62 cereal_dep = cereal_proj.dependency('cereal')
63endif
64
PriyangaRamasamy01c66462021-02-23 05:46:25 -060065# Disable FORTIFY_SOURCE when compiling with no optimization
66if(get_option('optimization') == '0')
67 add_project_arguments('-U_FORTIFY_SOURCE',language:['cpp','c'])
68 message('Disabling FORTIFY_SOURCE as optimization is set to 0')
69endif
70
Ramesh Iyyarbb410df2020-08-03 03:13:04 -050071# Configuration header file(config.h) generation
72
73conf_data = configuration_data()
74
75conf_data.set_quoted('DUMP_BUSNAME', get_option('DUMP_BUSNAME'),
76 description : 'The Dbus busname to own'
77 )
78conf_data.set_quoted('DUMP_OBJPATH', get_option('DUMP_OBJPATH'),
79 description : 'The Dump manager Dbus root'
80 )
Dhruvaraj Subhashchandranfef66a92020-09-06 13:10:59 -050081conf_data.set_quoted('BMC_DUMP_OBJPATH', get_option('BMC_DUMP_OBJPATH'),
82 description : 'The BMC Dump manager Dbus path'
83 )
Ramesh Iyyarbb410df2020-08-03 03:13:04 -050084conf_data.set_quoted('CORE_FILE_DIR', get_option('CORE_FILE_DIR'),
85 description : 'Directory where core dumps are placed'
86 )
87conf_data.set_quoted('OBJ_INTERNAL', get_option('OBJ_INTERNAL'),
88 description : 'Internal Dump manager Dbus object path'
89 )
Dhruvaraj Subhashchandranfef66a92020-09-06 13:10:59 -050090conf_data.set_quoted('BMC_DUMP_OBJ_ENTRY', get_option('BMC_DUMP_OBJ_ENTRY'),
91 description : 'The BMC dump entry DBus object path'
Ramesh Iyyarbb410df2020-08-03 03:13:04 -050092 )
93conf_data.set_quoted('BMC_DUMP_PATH', get_option('BMC_DUMP_PATH'),
94 description : 'Directory where bmc dumps are placed')
George Liuff92ffe2021-02-09 15:01:53 +080095conf_data.set_quoted('SYSTEMD_PSTORE_PATH', get_option('SYSTEMD_PSTORE_PATH'),
96 description : 'Path to the systemd pstore directory')
Ramesh Iyyarbb410df2020-08-03 03:13:04 -050097conf_data.set('BMC_DUMP_MAX_SIZE', get_option('BMC_DUMP_MAX_SIZE'),
98 description : 'Maximum size of one bmc dump in kilo bytes'
99 )
100conf_data.set('BMC_DUMP_MIN_SPACE_REQD', get_option('BMC_DUMP_MIN_SPACE_REQD'),
101 description : 'Minimum space required for one bmc dump in kilo bytes'
102 )
103conf_data.set('BMC_DUMP_TOTAL_SIZE', get_option('BMC_DUMP_TOTAL_SIZE'),
104 description : 'Total size of the dump in kilo bytes'
105 )
106conf_data.set_quoted('OBJ_LOGGING', '/xyz/openbmc_project/logging',
107 description : 'The log manager DBus object path'
108 )
109conf_data.set_quoted('ELOG_ID_PERSIST_PATH', get_option('ELOG_ID_PERSIST_PATH'),
110 description : 'Path of file for storing elog id\'s, which have associated dumps'
111 )
112conf_data.set('CLASS_VERSION', get_option('CLASS_VERSION'),
113 description : 'Class version to register with Cereal'
114 )
115conf_data.set('ERROR_MAP_YAML', get_option('ERROR_MAP_YAML'),
116 description : 'YAML filepath containing error object paths'
117 )
Chirag Sharmae22aca72021-01-18 09:55:29 -0600118conf_data.set('JFFS_CORE_FILE_WORKAROUND', get_option('jffs-workaround').enabled(),
119 description : 'Turn on jffs workaround for core file'
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500120 )
Claire Weinan919f71c2022-03-01 19:02:07 -0800121conf_data.set_quoted('FAULTLOG_DUMP_OBJ_ENTRY', get_option('FAULTLOG_DUMP_OBJ_ENTRY'),
122 description : 'The Fault Log dump entry DBus object path'
123 )
124conf_data.set_quoted('FAULTLOG_DUMP_OBJPATH', get_option('FAULTLOG_DUMP_OBJPATH'),
125 description : 'The Fault Log Dump manager Dbus path'
126 )
127conf_data.set_quoted('FAULTLOG_DUMP_PATH', get_option('FAULTLOG_DUMP_PATH'),
128 description : 'Directory where fault logs are placed'
129 )
Xie Ningfc69f352022-05-17 16:06:52 +0800130conf_data.set('BMC_DUMP_ROTATE_CONFIG', get_option('dump_rotate_config').enabled(),
131 description : 'Turn on rotate config for bmc dump'
132 )
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500133
134configure_file(configuration : conf_data,
135 output : 'config.h'
136 )
137
138subdir('xyz/openbmc_project/Dump/Internal/Create')
139
140python = find_program('python3')
Patrick Williamsce836882021-10-01 16:09:35 -0500141errors_map_gen_file_loc = meson.project_source_root()
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500142errors_map_gen_file_loc += '/errors_map_gen.py'
143
144errors_map_hpp = custom_target(
145 'errors_map.hpp',
146 command : [
147 python,
148 errors_map_gen_file_loc,
149 '-i',
150 get_option('ERROR_MAP_YAML')
151 ],
152 depend_files : [ 'errors_map.mako.hpp',
153 'errors_map_gen.py',
154 get_option('ERROR_MAP_YAML')
155 ],
156 output : 'errors_map.hpp'
157 )
158
159phosphor_dump_manager_sources = [
160 'dump_entry.cpp',
161 'dump_manager.cpp',
Dhruvaraj Subhashchandranfef66a92020-09-06 13:10:59 -0500162 'dump_manager_bmc.cpp',
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500163 'dump_manager_main.cpp',
164 'dump_serialize.cpp',
165 'elog_watch.cpp',
166 errors_map_hpp,
167 server_hpp,
168 server_cpp,
169 'watch.cpp',
170 'bmc_dump_entry.cpp',
171 'dump_utils.cpp',
Claire Weinan919f71c2022-03-01 19:02:07 -0800172 'dump_offload.cpp',
173 'dump_manager_faultlog.cpp',
174 'faultlog_dump_entry.cpp',
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500175 ]
176
177phosphor_dump_manager_dependency = [
George Liu73e0bab2021-06-29 15:57:43 +0800178 phosphor_dbus_interfaces_dep,
179 sdbusplus_dep,
180 phosphor_logging_dep,
Patrick Williamsabbe1592021-10-01 16:04:19 -0500181 fmt_dep,
182 cereal_dep,
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500183 ]
184
185phosphor_dump_manager_install = true
186
Ramesh Iyyar3af5c322020-12-04 00:38:42 -0600187phosphor_dump_manager_incdir = []
188
Ramesh Iyyar131994b2020-12-03 08:35:36 -0600189# To get host transport based interface to take respective host
190# dump actions. It will contain required sources and dependency
191# list for phosphor_dump_manager.
192subdir('host-transport-extensions')
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500193
Dhruvaraj Subhashchandran8b9b4692020-09-24 11:59:42 -0500194#pick any architecture specific dumps
195subdir('dump-extensions')
196
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500197phosphor_dump_monitor_sources = [
198 'core_manager.cpp',
199 'core_manager_main.cpp',
200 'watch.cpp'
201 ]
202
203phosphor_dump_monitor_dependency = [
George Liu73e0bab2021-06-29 15:57:43 +0800204 phosphor_dbus_interfaces_dep,
205 phosphor_logging_dep,
George Liu858fbb22021-07-01 12:25:44 +0800206 fmt_dep
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500207 ]
208
209phosphor_dump_monitor_install = true
210
Ramesh Iyyar3af5c322020-12-04 00:38:42 -0600211phosphor_dump_monitor_incdir = []
212
George Liuff92ffe2021-02-09 15:01:53 +0800213phosphor_ramoops_monitor_sources = [
214 'ramoops_manager.cpp',
215 'ramoops_manager_main.cpp',
216 'watch.cpp'
217 ]
218
219phosphor_ramoops_monitor_dependency = [
George Liu858fbb22021-07-01 12:25:44 +0800220 phosphor_dbus_interfaces_dep,
221 phosphor_logging_dep,
George Liu858fbb22021-07-01 12:25:44 +0800222 fmt_dep
George Liuff92ffe2021-02-09 15:01:53 +0800223 ]
224
225phosphor_ramoops_monitor_install = true
226
227phosphor_ramoops_monitor_incdir = []
228
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500229executables = [[ 'phosphor-dump-manager',
230 phosphor_dump_manager_sources,
231 phosphor_dump_manager_dependency,
Ramesh Iyyar3af5c322020-12-04 00:38:42 -0600232 phosphor_dump_manager_install,
233 phosphor_dump_manager_incdir
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500234 ],
235 [ 'phosphor-dump-monitor',
236 phosphor_dump_monitor_sources,
237 phosphor_dump_monitor_dependency,
Ramesh Iyyar3af5c322020-12-04 00:38:42 -0600238 phosphor_dump_monitor_install,
239 phosphor_dump_monitor_incdir
George Liuff92ffe2021-02-09 15:01:53 +0800240 ],
241 [ 'phosphor-ramoops-monitor',
242 phosphor_ramoops_monitor_sources,
243 phosphor_ramoops_monitor_dependency,
244 phosphor_ramoops_monitor_install,
245 phosphor_ramoops_monitor_incdir
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500246 ]
247 ]
248
249foreach executable : executables
250 binary = executable(
251 executable[0],
252 executable[1],
253 dependencies: executable[2],
Ramesh Iyyar3af5c322020-12-04 00:38:42 -0600254 install : executable[3],
255 include_directories : executable[4]
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500256 )
257endforeach
Chirag Sharma50427252020-08-11 12:11:38 -0500258
Dhruvaraj Subhashchandran9f557362021-05-12 06:28:20 -0500259unit_subs = configuration_data()
260unit_subs.set('bindir', join_paths(get_option('prefix'), get_option('bindir')))
261systemd_system_unit_dir = dependency('systemd').get_pkgconfig_variable(
262 'systemdsystemunitdir',
263 define_variable: ['prefix', get_option('prefix')])
264foreach u : unit_files
265 configure_file(
266 configuration: unit_subs,
267 input: u.get('input'),
268 install: true,
269 install_dir: systemd_system_unit_dir,
270 output: u.get('output')
271 )
272endforeach
273
Chirag Sharma50427252020-08-11 12:11:38 -0500274if get_option('tests').enabled()
275 subdir('test')
276endif