blob: 63e5979a7bc3661c630308411d0f2d54c61cfc19 [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
Patrick Williamsabbe1592021-10-01 16:04:19 -050020cppfs = cpp.find_library('stdc++fs')
Ramesh Iyyarbb410df2020-08-03 03:13:04 -050021libsystemd = dependency('libsystemd', version : '>=221')
George Liu73e0bab2021-06-29 15:57:43 +080022
23sdbusplus_dep = dependency('sdbusplus', required: false)
24if sdbusplus_dep.found()
25 sdbusplusplus_prog = find_program('sdbus++')
26 sdbuspp_gen_meson_prog = find_program('sdbus++-gen-meson')
27else
28 sdbusplus_proj = subproject('sdbusplus', required: true)
29 sdbusplus_dep = sdbusplus_proj.get_variable('sdbusplus_dep')
30 sdbusplusplus_prog = sdbusplus_proj.get_variable('sdbusplusplus_prog')
31 sdbuspp_gen_meson_prog = sdbusplus_proj.get_variable(
32 'sdbuspp_gen_meson_prog'
33 )
34endif
35phosphor_dbus_interfaces_dep = dependency(
36 'phosphor-dbus-interfaces',
37 fallback: [
38 'phosphor-dbus-interfaces',
39 'phosphor_dbus_interfaces_dep'
40 ],
41)
42phosphor_logging_dep = dependency(
43 'phosphor-logging',
44 fallback: [
45 'phosphor-logging',
46 'phosphor_logging_dep'
47 ],
48)
Ramesh Iyyarbb410df2020-08-03 03:13:04 -050049
George Liu858fbb22021-07-01 12:25:44 +080050fmt_dep = dependency('fmt', required: false)
51if not fmt_dep.found()
52 fmt_proj = import('cmake').subproject(
53 'fmt',
54 cmake_options: [
55 '-DCMAKE_POSITION_INDEPENDENT_CODE=ON',
56 '-DMASTER_PROJECT=OFF'
57 ],
58 required: false)
59 assert(fmt_proj.found(), 'fmtlib is required')
60 fmt_dep = fmt_proj.dependency('fmt')
61endif
62
Patrick Williamsabbe1592021-10-01 16:04:19 -050063# Get Cereal dependency.
64cereal_dep = dependency('cereal', required: false)
65has_cereal = cpp.has_header_symbol(
66 'cereal/cereal.hpp',
67 'cereal::specialize',
68 dependencies: cereal_dep,
69 required: false)
70if not has_cereal
71 cereal_opts = import('cmake').subproject_options()
72 cereal_opts.add_cmake_defines({'BUILD_TESTS': 'OFF'})
73 cereal_proj = import('cmake').subproject(
74 'cereal',
75 options: cereal_opts,
76 required: false)
77 assert(cereal_proj.found(), 'cereal is required')
78 cereal_dep = cereal_proj.dependency('cereal')
79endif
80
PriyangaRamasamy01c66462021-02-23 05:46:25 -060081# Disable FORTIFY_SOURCE when compiling with no optimization
82if(get_option('optimization') == '0')
83 add_project_arguments('-U_FORTIFY_SOURCE',language:['cpp','c'])
84 message('Disabling FORTIFY_SOURCE as optimization is set to 0')
85endif
86
Ramesh Iyyarbb410df2020-08-03 03:13:04 -050087# Configuration header file(config.h) generation
88
89conf_data = configuration_data()
90
91conf_data.set_quoted('DUMP_BUSNAME', get_option('DUMP_BUSNAME'),
92 description : 'The Dbus busname to own'
93 )
94conf_data.set_quoted('DUMP_OBJPATH', get_option('DUMP_OBJPATH'),
95 description : 'The Dump manager Dbus root'
96 )
Dhruvaraj Subhashchandranfef66a92020-09-06 13:10:59 -050097conf_data.set_quoted('BMC_DUMP_OBJPATH', get_option('BMC_DUMP_OBJPATH'),
98 description : 'The BMC Dump manager Dbus path'
99 )
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500100conf_data.set_quoted('CORE_FILE_DIR', get_option('CORE_FILE_DIR'),
101 description : 'Directory where core dumps are placed'
102 )
103conf_data.set_quoted('OBJ_INTERNAL', get_option('OBJ_INTERNAL'),
104 description : 'Internal Dump manager Dbus object path'
105 )
Dhruvaraj Subhashchandranfef66a92020-09-06 13:10:59 -0500106conf_data.set_quoted('BMC_DUMP_OBJ_ENTRY', get_option('BMC_DUMP_OBJ_ENTRY'),
107 description : 'The BMC dump entry DBus object path'
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500108 )
109conf_data.set_quoted('BMC_DUMP_PATH', get_option('BMC_DUMP_PATH'),
110 description : 'Directory where bmc dumps are placed')
George Liuff92ffe2021-02-09 15:01:53 +0800111conf_data.set_quoted('SYSTEMD_PSTORE_PATH', get_option('SYSTEMD_PSTORE_PATH'),
112 description : 'Path to the systemd pstore directory')
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500113conf_data.set('BMC_DUMP_MAX_SIZE', get_option('BMC_DUMP_MAX_SIZE'),
114 description : 'Maximum size of one bmc dump in kilo bytes'
115 )
116conf_data.set('BMC_DUMP_MIN_SPACE_REQD', get_option('BMC_DUMP_MIN_SPACE_REQD'),
117 description : 'Minimum space required for one bmc dump in kilo bytes'
118 )
119conf_data.set('BMC_DUMP_TOTAL_SIZE', get_option('BMC_DUMP_TOTAL_SIZE'),
120 description : 'Total size of the dump in kilo bytes'
121 )
122conf_data.set_quoted('OBJ_LOGGING', '/xyz/openbmc_project/logging',
123 description : 'The log manager DBus object path'
124 )
125conf_data.set_quoted('ELOG_ID_PERSIST_PATH', get_option('ELOG_ID_PERSIST_PATH'),
126 description : 'Path of file for storing elog id\'s, which have associated dumps'
127 )
128conf_data.set('CLASS_VERSION', get_option('CLASS_VERSION'),
129 description : 'Class version to register with Cereal'
130 )
131conf_data.set('ERROR_MAP_YAML', get_option('ERROR_MAP_YAML'),
132 description : 'YAML filepath containing error object paths'
133 )
Chirag Sharmae22aca72021-01-18 09:55:29 -0600134conf_data.set('JFFS_CORE_FILE_WORKAROUND', get_option('jffs-workaround').enabled(),
135 description : 'Turn on jffs workaround for core file'
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500136 )
137
138configure_file(configuration : conf_data,
139 output : 'config.h'
140 )
141
142subdir('xyz/openbmc_project/Dump/Internal/Create')
143
144python = find_program('python3')
145errors_map_gen_file_loc = meson.source_root()
146errors_map_gen_file_loc += '/errors_map_gen.py'
147
148errors_map_hpp = custom_target(
149 'errors_map.hpp',
150 command : [
151 python,
152 errors_map_gen_file_loc,
153 '-i',
154 get_option('ERROR_MAP_YAML')
155 ],
156 depend_files : [ 'errors_map.mako.hpp',
157 'errors_map_gen.py',
158 get_option('ERROR_MAP_YAML')
159 ],
160 output : 'errors_map.hpp'
161 )
162
163phosphor_dump_manager_sources = [
164 'dump_entry.cpp',
165 'dump_manager.cpp',
Dhruvaraj Subhashchandranfef66a92020-09-06 13:10:59 -0500166 'dump_manager_bmc.cpp',
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500167 'dump_manager_main.cpp',
168 'dump_serialize.cpp',
169 'elog_watch.cpp',
170 errors_map_hpp,
171 server_hpp,
172 server_cpp,
173 'watch.cpp',
174 'bmc_dump_entry.cpp',
175 'dump_utils.cpp',
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500176 'dump_offload.cpp'
177 ]
178
179phosphor_dump_manager_dependency = [
George Liu73e0bab2021-06-29 15:57:43 +0800180 phosphor_dbus_interfaces_dep,
181 sdbusplus_dep,
182 phosphor_logging_dep,
George Liu858fbb22021-07-01 12:25:44 +0800183 cppfs,
Patrick Williamsabbe1592021-10-01 16:04:19 -0500184 fmt_dep,
185 cereal_dep,
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500186 ]
187
188phosphor_dump_manager_install = true
189
Ramesh Iyyar3af5c322020-12-04 00:38:42 -0600190phosphor_dump_manager_incdir = []
191
Ramesh Iyyar131994b2020-12-03 08:35:36 -0600192# To get host transport based interface to take respective host
193# dump actions. It will contain required sources and dependency
194# list for phosphor_dump_manager.
195subdir('host-transport-extensions')
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500196
Dhruvaraj Subhashchandran8b9b4692020-09-24 11:59:42 -0500197#pick any architecture specific dumps
198subdir('dump-extensions')
199
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500200phosphor_dump_monitor_sources = [
201 'core_manager.cpp',
202 'core_manager_main.cpp',
203 'watch.cpp'
204 ]
205
206phosphor_dump_monitor_dependency = [
George Liu73e0bab2021-06-29 15:57:43 +0800207 phosphor_dbus_interfaces_dep,
208 phosphor_logging_dep,
George Liu858fbb22021-07-01 12:25:44 +0800209 cppfs,
210 fmt_dep
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500211 ]
212
213phosphor_dump_monitor_install = true
214
Ramesh Iyyar3af5c322020-12-04 00:38:42 -0600215phosphor_dump_monitor_incdir = []
216
George Liuff92ffe2021-02-09 15:01:53 +0800217phosphor_ramoops_monitor_sources = [
218 'ramoops_manager.cpp',
219 'ramoops_manager_main.cpp',
220 'watch.cpp'
221 ]
222
223phosphor_ramoops_monitor_dependency = [
George Liu858fbb22021-07-01 12:25:44 +0800224 phosphor_dbus_interfaces_dep,
225 phosphor_logging_dep,
226 cppfs,
227 fmt_dep
George Liuff92ffe2021-02-09 15:01:53 +0800228 ]
229
230phosphor_ramoops_monitor_install = true
231
232phosphor_ramoops_monitor_incdir = []
233
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500234executables = [[ 'phosphor-dump-manager',
235 phosphor_dump_manager_sources,
236 phosphor_dump_manager_dependency,
Ramesh Iyyar3af5c322020-12-04 00:38:42 -0600237 phosphor_dump_manager_install,
238 phosphor_dump_manager_incdir
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500239 ],
240 [ 'phosphor-dump-monitor',
241 phosphor_dump_monitor_sources,
242 phosphor_dump_monitor_dependency,
Ramesh Iyyar3af5c322020-12-04 00:38:42 -0600243 phosphor_dump_monitor_install,
244 phosphor_dump_monitor_incdir
George Liuff92ffe2021-02-09 15:01:53 +0800245 ],
246 [ 'phosphor-ramoops-monitor',
247 phosphor_ramoops_monitor_sources,
248 phosphor_ramoops_monitor_dependency,
249 phosphor_ramoops_monitor_install,
250 phosphor_ramoops_monitor_incdir
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500251 ]
252 ]
253
254foreach executable : executables
255 binary = executable(
256 executable[0],
257 executable[1],
258 dependencies: executable[2],
Ramesh Iyyar3af5c322020-12-04 00:38:42 -0600259 install : executable[3],
260 include_directories : executable[4]
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500261 )
262endforeach
Chirag Sharma50427252020-08-11 12:11:38 -0500263
264if get_option('tests').enabled()
265 subdir('test')
266endif