blob: 2b3e7f56134b54517ab6c5e3acbe8787b38984b1 [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
Ramesh Iyyarbb410df2020-08-03 03:13:04 -050018# Checking dependency external library
19
Ramesh Iyyarbb410df2020-08-03 03:13:04 -050020libsystemd = dependency('libsystemd', version : '>=221')
George Liu73e0bab2021-06-29 15:57:43 +080021
Patrick Williams02634e52022-03-21 11:16:11 -050022sdbusplus_dep = dependency('sdbusplus')
23sdbusplusplus_prog = find_program('sdbus++')
24sdbuspp_gen_meson_prog = find_program('sdbus++-gen-meson')
25
26phosphor_dbus_interfaces_dep = dependency('phosphor-dbus-interfaces')
27phosphor_logging_dep = dependency('phosphor-logging')
Ramesh Iyyarbb410df2020-08-03 03:13:04 -050028
George Liu858fbb22021-07-01 12:25:44 +080029fmt_dep = dependency('fmt', required: false)
30if not fmt_dep.found()
31 fmt_proj = import('cmake').subproject(
32 'fmt',
33 cmake_options: [
34 '-DCMAKE_POSITION_INDEPENDENT_CODE=ON',
35 '-DMASTER_PROJECT=OFF'
36 ],
37 required: false)
38 assert(fmt_proj.found(), 'fmtlib is required')
39 fmt_dep = fmt_proj.dependency('fmt')
40endif
41
Patrick Williamsabbe1592021-10-01 16:04:19 -050042# Get Cereal dependency.
43cereal_dep = dependency('cereal', required: false)
44has_cereal = cpp.has_header_symbol(
45 'cereal/cereal.hpp',
46 'cereal::specialize',
47 dependencies: cereal_dep,
48 required: false)
49if not has_cereal
50 cereal_opts = import('cmake').subproject_options()
51 cereal_opts.add_cmake_defines({'BUILD_TESTS': 'OFF'})
52 cereal_proj = import('cmake').subproject(
53 'cereal',
54 options: cereal_opts,
55 required: false)
56 assert(cereal_proj.found(), 'cereal is required')
57 cereal_dep = cereal_proj.dependency('cereal')
58endif
59
PriyangaRamasamy01c66462021-02-23 05:46:25 -060060# Disable FORTIFY_SOURCE when compiling with no optimization
61if(get_option('optimization') == '0')
62 add_project_arguments('-U_FORTIFY_SOURCE',language:['cpp','c'])
63 message('Disabling FORTIFY_SOURCE as optimization is set to 0')
64endif
65
Ramesh Iyyarbb410df2020-08-03 03:13:04 -050066# Configuration header file(config.h) generation
67
68conf_data = configuration_data()
69
70conf_data.set_quoted('DUMP_BUSNAME', get_option('DUMP_BUSNAME'),
71 description : 'The Dbus busname to own'
72 )
73conf_data.set_quoted('DUMP_OBJPATH', get_option('DUMP_OBJPATH'),
74 description : 'The Dump manager Dbus root'
75 )
Dhruvaraj Subhashchandranfef66a92020-09-06 13:10:59 -050076conf_data.set_quoted('BMC_DUMP_OBJPATH', get_option('BMC_DUMP_OBJPATH'),
77 description : 'The BMC Dump manager Dbus path'
78 )
Ramesh Iyyarbb410df2020-08-03 03:13:04 -050079conf_data.set_quoted('CORE_FILE_DIR', get_option('CORE_FILE_DIR'),
80 description : 'Directory where core dumps are placed'
81 )
82conf_data.set_quoted('OBJ_INTERNAL', get_option('OBJ_INTERNAL'),
83 description : 'Internal Dump manager Dbus object path'
84 )
Dhruvaraj Subhashchandranfef66a92020-09-06 13:10:59 -050085conf_data.set_quoted('BMC_DUMP_OBJ_ENTRY', get_option('BMC_DUMP_OBJ_ENTRY'),
86 description : 'The BMC dump entry DBus object path'
Ramesh Iyyarbb410df2020-08-03 03:13:04 -050087 )
88conf_data.set_quoted('BMC_DUMP_PATH', get_option('BMC_DUMP_PATH'),
89 description : 'Directory where bmc dumps are placed')
George Liuff92ffe2021-02-09 15:01:53 +080090conf_data.set_quoted('SYSTEMD_PSTORE_PATH', get_option('SYSTEMD_PSTORE_PATH'),
91 description : 'Path to the systemd pstore directory')
Ramesh Iyyarbb410df2020-08-03 03:13:04 -050092conf_data.set('BMC_DUMP_MAX_SIZE', get_option('BMC_DUMP_MAX_SIZE'),
93 description : 'Maximum size of one bmc dump in kilo bytes'
94 )
95conf_data.set('BMC_DUMP_MIN_SPACE_REQD', get_option('BMC_DUMP_MIN_SPACE_REQD'),
96 description : 'Minimum space required for one bmc dump in kilo bytes'
97 )
98conf_data.set('BMC_DUMP_TOTAL_SIZE', get_option('BMC_DUMP_TOTAL_SIZE'),
99 description : 'Total size of the dump in kilo bytes'
100 )
101conf_data.set_quoted('OBJ_LOGGING', '/xyz/openbmc_project/logging',
102 description : 'The log manager DBus object path'
103 )
104conf_data.set_quoted('ELOG_ID_PERSIST_PATH', get_option('ELOG_ID_PERSIST_PATH'),
105 description : 'Path of file for storing elog id\'s, which have associated dumps'
106 )
107conf_data.set('CLASS_VERSION', get_option('CLASS_VERSION'),
108 description : 'Class version to register with Cereal'
109 )
110conf_data.set('ERROR_MAP_YAML', get_option('ERROR_MAP_YAML'),
111 description : 'YAML filepath containing error object paths'
112 )
Chirag Sharmae22aca72021-01-18 09:55:29 -0600113conf_data.set('JFFS_CORE_FILE_WORKAROUND', get_option('jffs-workaround').enabled(),
114 description : 'Turn on jffs workaround for core file'
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500115 )
Claire Weinan919f71c2022-03-01 19:02:07 -0800116conf_data.set_quoted('FAULTLOG_DUMP_OBJ_ENTRY', get_option('FAULTLOG_DUMP_OBJ_ENTRY'),
117 description : 'The Fault Log dump entry DBus object path'
118 )
119conf_data.set_quoted('FAULTLOG_DUMP_OBJPATH', get_option('FAULTLOG_DUMP_OBJPATH'),
120 description : 'The Fault Log Dump manager Dbus path'
121 )
122conf_data.set_quoted('FAULTLOG_DUMP_PATH', get_option('FAULTLOG_DUMP_PATH'),
123 description : 'Directory where fault logs are placed'
124 )
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500125
126configure_file(configuration : conf_data,
127 output : 'config.h'
128 )
129
130subdir('xyz/openbmc_project/Dump/Internal/Create')
131
132python = find_program('python3')
Patrick Williamsce836882021-10-01 16:09:35 -0500133errors_map_gen_file_loc = meson.project_source_root()
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500134errors_map_gen_file_loc += '/errors_map_gen.py'
135
136errors_map_hpp = custom_target(
137 'errors_map.hpp',
138 command : [
139 python,
140 errors_map_gen_file_loc,
141 '-i',
142 get_option('ERROR_MAP_YAML')
143 ],
144 depend_files : [ 'errors_map.mako.hpp',
145 'errors_map_gen.py',
146 get_option('ERROR_MAP_YAML')
147 ],
148 output : 'errors_map.hpp'
149 )
150
151phosphor_dump_manager_sources = [
152 'dump_entry.cpp',
153 'dump_manager.cpp',
Dhruvaraj Subhashchandranfef66a92020-09-06 13:10:59 -0500154 'dump_manager_bmc.cpp',
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500155 'dump_manager_main.cpp',
156 'dump_serialize.cpp',
157 'elog_watch.cpp',
158 errors_map_hpp,
159 server_hpp,
160 server_cpp,
161 'watch.cpp',
162 'bmc_dump_entry.cpp',
163 'dump_utils.cpp',
Claire Weinan919f71c2022-03-01 19:02:07 -0800164 'dump_offload.cpp',
165 'dump_manager_faultlog.cpp',
166 'faultlog_dump_entry.cpp',
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500167 ]
168
169phosphor_dump_manager_dependency = [
George Liu73e0bab2021-06-29 15:57:43 +0800170 phosphor_dbus_interfaces_dep,
171 sdbusplus_dep,
172 phosphor_logging_dep,
Patrick Williamsabbe1592021-10-01 16:04:19 -0500173 fmt_dep,
174 cereal_dep,
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500175 ]
176
177phosphor_dump_manager_install = true
178
Ramesh Iyyar3af5c322020-12-04 00:38:42 -0600179phosphor_dump_manager_incdir = []
180
Ramesh Iyyar131994b2020-12-03 08:35:36 -0600181# To get host transport based interface to take respective host
182# dump actions. It will contain required sources and dependency
183# list for phosphor_dump_manager.
184subdir('host-transport-extensions')
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500185
Dhruvaraj Subhashchandran8b9b4692020-09-24 11:59:42 -0500186#pick any architecture specific dumps
187subdir('dump-extensions')
188
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500189phosphor_dump_monitor_sources = [
190 'core_manager.cpp',
191 'core_manager_main.cpp',
192 'watch.cpp'
193 ]
194
195phosphor_dump_monitor_dependency = [
George Liu73e0bab2021-06-29 15:57:43 +0800196 phosphor_dbus_interfaces_dep,
197 phosphor_logging_dep,
George Liu858fbb22021-07-01 12:25:44 +0800198 fmt_dep
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500199 ]
200
201phosphor_dump_monitor_install = true
202
Ramesh Iyyar3af5c322020-12-04 00:38:42 -0600203phosphor_dump_monitor_incdir = []
204
George Liuff92ffe2021-02-09 15:01:53 +0800205phosphor_ramoops_monitor_sources = [
206 'ramoops_manager.cpp',
207 'ramoops_manager_main.cpp',
208 'watch.cpp'
209 ]
210
211phosphor_ramoops_monitor_dependency = [
George Liu858fbb22021-07-01 12:25:44 +0800212 phosphor_dbus_interfaces_dep,
213 phosphor_logging_dep,
George Liu858fbb22021-07-01 12:25:44 +0800214 fmt_dep
George Liuff92ffe2021-02-09 15:01:53 +0800215 ]
216
217phosphor_ramoops_monitor_install = true
218
219phosphor_ramoops_monitor_incdir = []
220
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500221executables = [[ 'phosphor-dump-manager',
222 phosphor_dump_manager_sources,
223 phosphor_dump_manager_dependency,
Ramesh Iyyar3af5c322020-12-04 00:38:42 -0600224 phosphor_dump_manager_install,
225 phosphor_dump_manager_incdir
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500226 ],
227 [ 'phosphor-dump-monitor',
228 phosphor_dump_monitor_sources,
229 phosphor_dump_monitor_dependency,
Ramesh Iyyar3af5c322020-12-04 00:38:42 -0600230 phosphor_dump_monitor_install,
231 phosphor_dump_monitor_incdir
George Liuff92ffe2021-02-09 15:01:53 +0800232 ],
233 [ 'phosphor-ramoops-monitor',
234 phosphor_ramoops_monitor_sources,
235 phosphor_ramoops_monitor_dependency,
236 phosphor_ramoops_monitor_install,
237 phosphor_ramoops_monitor_incdir
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500238 ]
239 ]
240
241foreach executable : executables
242 binary = executable(
243 executable[0],
244 executable[1],
245 dependencies: executable[2],
Ramesh Iyyar3af5c322020-12-04 00:38:42 -0600246 install : executable[3],
247 include_directories : executable[4]
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500248 )
249endforeach
Chirag Sharma50427252020-08-11 12:11:38 -0500250
251if get_option('tests').enabled()
252 subdir('test')
253endif