blob: a064c1c9a6ee03318c9682c69db5416c0ebcd851 [file] [log] [blame]
Ramesh Iyyarbb410df2020-08-03 03:13:04 -05001# SPDX-License-Identifier: Apache-2.0
2
3project('phosphor-debug-collector',
4 'cpp',
5 default_options: [
6 'cpp_std=c++17',
7 'warning_level=3',
PriyangaRamasamy01c66462021-02-23 05:46:25 -06008 'werror=true',
9 'buildtype=debugoptimized'
Ramesh Iyyarbb410df2020-08-03 03:13:04 -050010 ],
11 version: '1.0',
12 license: 'Apache-2.0'
13 )
14
Patrick Williamsabbe1592021-10-01 16:04:19 -050015cpp = meson.get_compiler('cpp')
16
Ramesh Iyyarbb410df2020-08-03 03:13:04 -050017# Checking dependency external library
18
Patrick Williamsabbe1592021-10-01 16:04:19 -050019cppfs = cpp.find_library('stdc++fs')
Ramesh Iyyarbb410df2020-08-03 03:13:04 -050020libsystemd = dependency('libsystemd', version : '>=221')
George Liu73e0bab2021-06-29 15:57:43 +080021
22sdbusplus_dep = dependency('sdbusplus', required: false)
23if sdbusplus_dep.found()
24 sdbusplusplus_prog = find_program('sdbus++')
25 sdbuspp_gen_meson_prog = find_program('sdbus++-gen-meson')
26else
27 sdbusplus_proj = subproject('sdbusplus', required: true)
28 sdbusplus_dep = sdbusplus_proj.get_variable('sdbusplus_dep')
29 sdbusplusplus_prog = sdbusplus_proj.get_variable('sdbusplusplus_prog')
30 sdbuspp_gen_meson_prog = sdbusplus_proj.get_variable(
31 'sdbuspp_gen_meson_prog'
32 )
33endif
34phosphor_dbus_interfaces_dep = dependency(
35 'phosphor-dbus-interfaces',
36 fallback: [
37 'phosphor-dbus-interfaces',
38 'phosphor_dbus_interfaces_dep'
39 ],
40)
41phosphor_logging_dep = dependency(
42 'phosphor-logging',
43 fallback: [
44 'phosphor-logging',
45 'phosphor_logging_dep'
46 ],
47)
Ramesh Iyyarbb410df2020-08-03 03:13:04 -050048
George Liu858fbb22021-07-01 12:25:44 +080049fmt_dep = dependency('fmt', required: false)
50if not fmt_dep.found()
51 fmt_proj = import('cmake').subproject(
52 'fmt',
53 cmake_options: [
54 '-DCMAKE_POSITION_INDEPENDENT_CODE=ON',
55 '-DMASTER_PROJECT=OFF'
56 ],
57 required: false)
58 assert(fmt_proj.found(), 'fmtlib is required')
59 fmt_dep = fmt_proj.dependency('fmt')
60endif
61
Patrick Williamsabbe1592021-10-01 16:04:19 -050062# Get Cereal dependency.
63cereal_dep = dependency('cereal', required: false)
64has_cereal = cpp.has_header_symbol(
65 'cereal/cereal.hpp',
66 'cereal::specialize',
67 dependencies: cereal_dep,
68 required: false)
69if not has_cereal
70 cereal_opts = import('cmake').subproject_options()
71 cereal_opts.add_cmake_defines({'BUILD_TESTS': 'OFF'})
72 cereal_proj = import('cmake').subproject(
73 'cereal',
74 options: cereal_opts,
75 required: false)
76 assert(cereal_proj.found(), 'cereal is required')
77 cereal_dep = cereal_proj.dependency('cereal')
78endif
79
PriyangaRamasamy01c66462021-02-23 05:46:25 -060080# Disable FORTIFY_SOURCE when compiling with no optimization
81if(get_option('optimization') == '0')
82 add_project_arguments('-U_FORTIFY_SOURCE',language:['cpp','c'])
83 message('Disabling FORTIFY_SOURCE as optimization is set to 0')
84endif
85
Ramesh Iyyarbb410df2020-08-03 03:13:04 -050086# Configuration header file(config.h) generation
87
88conf_data = configuration_data()
89
90conf_data.set_quoted('DUMP_BUSNAME', get_option('DUMP_BUSNAME'),
91 description : 'The Dbus busname to own'
92 )
93conf_data.set_quoted('DUMP_OBJPATH', get_option('DUMP_OBJPATH'),
94 description : 'The Dump manager Dbus root'
95 )
Dhruvaraj Subhashchandranfef66a92020-09-06 13:10:59 -050096conf_data.set_quoted('BMC_DUMP_OBJPATH', get_option('BMC_DUMP_OBJPATH'),
97 description : 'The BMC Dump manager Dbus path'
98 )
Ramesh Iyyarbb410df2020-08-03 03:13:04 -050099conf_data.set_quoted('CORE_FILE_DIR', get_option('CORE_FILE_DIR'),
100 description : 'Directory where core dumps are placed'
101 )
102conf_data.set_quoted('OBJ_INTERNAL', get_option('OBJ_INTERNAL'),
103 description : 'Internal Dump manager Dbus object path'
104 )
Dhruvaraj Subhashchandranfef66a92020-09-06 13:10:59 -0500105conf_data.set_quoted('BMC_DUMP_OBJ_ENTRY', get_option('BMC_DUMP_OBJ_ENTRY'),
106 description : 'The BMC dump entry DBus object path'
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500107 )
108conf_data.set_quoted('BMC_DUMP_PATH', get_option('BMC_DUMP_PATH'),
109 description : 'Directory where bmc dumps are placed')
George Liuff92ffe2021-02-09 15:01:53 +0800110conf_data.set_quoted('SYSTEMD_PSTORE_PATH', get_option('SYSTEMD_PSTORE_PATH'),
111 description : 'Path to the systemd pstore directory')
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500112conf_data.set('BMC_DUMP_MAX_SIZE', get_option('BMC_DUMP_MAX_SIZE'),
113 description : 'Maximum size of one bmc dump in kilo bytes'
114 )
115conf_data.set('BMC_DUMP_MIN_SPACE_REQD', get_option('BMC_DUMP_MIN_SPACE_REQD'),
116 description : 'Minimum space required for one bmc dump in kilo bytes'
117 )
118conf_data.set('BMC_DUMP_TOTAL_SIZE', get_option('BMC_DUMP_TOTAL_SIZE'),
119 description : 'Total size of the dump in kilo bytes'
120 )
121conf_data.set_quoted('OBJ_LOGGING', '/xyz/openbmc_project/logging',
122 description : 'The log manager DBus object path'
123 )
124conf_data.set_quoted('ELOG_ID_PERSIST_PATH', get_option('ELOG_ID_PERSIST_PATH'),
125 description : 'Path of file for storing elog id\'s, which have associated dumps'
126 )
127conf_data.set('CLASS_VERSION', get_option('CLASS_VERSION'),
128 description : 'Class version to register with Cereal'
129 )
130conf_data.set('ERROR_MAP_YAML', get_option('ERROR_MAP_YAML'),
131 description : 'YAML filepath containing error object paths'
132 )
Chirag Sharmae22aca72021-01-18 09:55:29 -0600133conf_data.set('JFFS_CORE_FILE_WORKAROUND', get_option('jffs-workaround').enabled(),
134 description : 'Turn on jffs workaround for core file'
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500135 )
136
137configure_file(configuration : conf_data,
138 output : 'config.h'
139 )
140
141subdir('xyz/openbmc_project/Dump/Internal/Create')
142
143python = find_program('python3')
144errors_map_gen_file_loc = meson.source_root()
145errors_map_gen_file_loc += '/errors_map_gen.py'
146
147errors_map_hpp = custom_target(
148 'errors_map.hpp',
149 command : [
150 python,
151 errors_map_gen_file_loc,
152 '-i',
153 get_option('ERROR_MAP_YAML')
154 ],
155 depend_files : [ 'errors_map.mako.hpp',
156 'errors_map_gen.py',
157 get_option('ERROR_MAP_YAML')
158 ],
159 output : 'errors_map.hpp'
160 )
161
162phosphor_dump_manager_sources = [
163 'dump_entry.cpp',
164 'dump_manager.cpp',
Dhruvaraj Subhashchandranfef66a92020-09-06 13:10:59 -0500165 'dump_manager_bmc.cpp',
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500166 'dump_manager_main.cpp',
167 'dump_serialize.cpp',
168 'elog_watch.cpp',
169 errors_map_hpp,
170 server_hpp,
171 server_cpp,
172 'watch.cpp',
173 'bmc_dump_entry.cpp',
174 'dump_utils.cpp',
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500175 'dump_offload.cpp'
176 ]
177
178phosphor_dump_manager_dependency = [
George Liu73e0bab2021-06-29 15:57:43 +0800179 phosphor_dbus_interfaces_dep,
180 sdbusplus_dep,
181 phosphor_logging_dep,
George Liu858fbb22021-07-01 12:25:44 +0800182 cppfs,
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 cppfs,
209 fmt_dep
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500210 ]
211
212phosphor_dump_monitor_install = true
213
Ramesh Iyyar3af5c322020-12-04 00:38:42 -0600214phosphor_dump_monitor_incdir = []
215
George Liuff92ffe2021-02-09 15:01:53 +0800216phosphor_ramoops_monitor_sources = [
217 'ramoops_manager.cpp',
218 'ramoops_manager_main.cpp',
219 'watch.cpp'
220 ]
221
222phosphor_ramoops_monitor_dependency = [
George Liu858fbb22021-07-01 12:25:44 +0800223 phosphor_dbus_interfaces_dep,
224 phosphor_logging_dep,
225 cppfs,
226 fmt_dep
George Liuff92ffe2021-02-09 15:01:53 +0800227 ]
228
229phosphor_ramoops_monitor_install = true
230
231phosphor_ramoops_monitor_incdir = []
232
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500233executables = [[ 'phosphor-dump-manager',
234 phosphor_dump_manager_sources,
235 phosphor_dump_manager_dependency,
Ramesh Iyyar3af5c322020-12-04 00:38:42 -0600236 phosphor_dump_manager_install,
237 phosphor_dump_manager_incdir
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500238 ],
239 [ 'phosphor-dump-monitor',
240 phosphor_dump_monitor_sources,
241 phosphor_dump_monitor_dependency,
Ramesh Iyyar3af5c322020-12-04 00:38:42 -0600242 phosphor_dump_monitor_install,
243 phosphor_dump_monitor_incdir
George Liuff92ffe2021-02-09 15:01:53 +0800244 ],
245 [ 'phosphor-ramoops-monitor',
246 phosphor_ramoops_monitor_sources,
247 phosphor_ramoops_monitor_dependency,
248 phosphor_ramoops_monitor_install,
249 phosphor_ramoops_monitor_incdir
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500250 ]
251 ]
252
253foreach executable : executables
254 binary = executable(
255 executable[0],
256 executable[1],
257 dependencies: executable[2],
Ramesh Iyyar3af5c322020-12-04 00:38:42 -0600258 install : executable[3],
259 include_directories : executable[4]
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500260 )
261endforeach
Chirag Sharma50427252020-08-11 12:11:38 -0500262
263if get_option('tests').enabled()
264 subdir('test')
265endif