blob: 3ef697a005eff7b9bbecfd85c7f55bb6d288530f [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
15# Checking dependency external library
16
17cppfs = meson.get_compiler('cpp').find_library('stdc++fs')
18libsystemd = dependency('libsystemd', version : '>=221')
George Liu73e0bab2021-06-29 15:57:43 +080019
20sdbusplus_dep = dependency('sdbusplus', required: false)
21if sdbusplus_dep.found()
22 sdbusplusplus_prog = find_program('sdbus++')
23 sdbuspp_gen_meson_prog = find_program('sdbus++-gen-meson')
24else
25 sdbusplus_proj = subproject('sdbusplus', required: true)
26 sdbusplus_dep = sdbusplus_proj.get_variable('sdbusplus_dep')
27 sdbusplusplus_prog = sdbusplus_proj.get_variable('sdbusplusplus_prog')
28 sdbuspp_gen_meson_prog = sdbusplus_proj.get_variable(
29 'sdbuspp_gen_meson_prog'
30 )
31endif
32phosphor_dbus_interfaces_dep = dependency(
33 'phosphor-dbus-interfaces',
34 fallback: [
35 'phosphor-dbus-interfaces',
36 'phosphor_dbus_interfaces_dep'
37 ],
38)
39phosphor_logging_dep = dependency(
40 'phosphor-logging',
41 fallback: [
42 'phosphor-logging',
43 'phosphor_logging_dep'
44 ],
45)
Ramesh Iyyarbb410df2020-08-03 03:13:04 -050046
George Liu858fbb22021-07-01 12:25:44 +080047fmt_dep = dependency('fmt', required: false)
48if not fmt_dep.found()
49 fmt_proj = import('cmake').subproject(
50 'fmt',
51 cmake_options: [
52 '-DCMAKE_POSITION_INDEPENDENT_CODE=ON',
53 '-DMASTER_PROJECT=OFF'
54 ],
55 required: false)
56 assert(fmt_proj.found(), 'fmtlib is required')
57 fmt_dep = fmt_proj.dependency('fmt')
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 )
79conf_data.set_quoted('SYSTEM_DUMP_OBJPATH', get_option('SYSTEM_DUMP_OBJPATH'),
80 description : 'The system Dump manager Dbus path'
81 )
Dhruvaraj Subhashchandran62337a92020-11-22 21:24:30 -060082conf_data.set_quoted('RESOURCE_DUMP_OBJPATH', get_option('RESOURCE_DUMP_OBJPATH'),
83 description : 'The resource 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('SYSTEM_DUMP_OBJ_ENTRY', get_option('SYSTEM_DUMP_OBJ_ENTRY'),
92 description : 'The system dump entry DBus object path'
93 )
Dhruvaraj Subhashchandran62337a92020-11-22 21:24:30 -060094conf_data.set_quoted('RESOURCE_DUMP_OBJ_ENTRY', get_option('RESOURCE_DUMP_OBJ_ENTRY'),
95 description : 'The resource dump entry DBus object path'
96 )
Dhruvaraj Subhashchandranfef66a92020-09-06 13:10:59 -050097conf_data.set_quoted('BMC_DUMP_OBJ_ENTRY', get_option('BMC_DUMP_OBJ_ENTRY'),
98 description : 'The BMC dump entry DBus object path'
Ramesh Iyyarbb410df2020-08-03 03:13:04 -050099 )
100conf_data.set_quoted('BMC_DUMP_PATH', get_option('BMC_DUMP_PATH'),
101 description : 'Directory where bmc dumps are placed')
George Liuff92ffe2021-02-09 15:01:53 +0800102conf_data.set_quoted('SYSTEMD_PSTORE_PATH', get_option('SYSTEMD_PSTORE_PATH'),
103 description : 'Path to the systemd pstore directory')
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500104conf_data.set('BMC_DUMP_MAX_SIZE', get_option('BMC_DUMP_MAX_SIZE'),
105 description : 'Maximum size of one bmc dump in kilo bytes'
106 )
107conf_data.set('BMC_DUMP_MIN_SPACE_REQD', get_option('BMC_DUMP_MIN_SPACE_REQD'),
108 description : 'Minimum space required for one bmc dump in kilo bytes'
109 )
110conf_data.set('BMC_DUMP_TOTAL_SIZE', get_option('BMC_DUMP_TOTAL_SIZE'),
111 description : 'Total size of the dump in kilo bytes'
112 )
113conf_data.set_quoted('OBJ_LOGGING', '/xyz/openbmc_project/logging',
114 description : 'The log manager DBus object path'
115 )
116conf_data.set_quoted('ELOG_ID_PERSIST_PATH', get_option('ELOG_ID_PERSIST_PATH'),
117 description : 'Path of file for storing elog id\'s, which have associated dumps'
118 )
119conf_data.set('CLASS_VERSION', get_option('CLASS_VERSION'),
120 description : 'Class version to register with Cereal'
121 )
122conf_data.set('ERROR_MAP_YAML', get_option('ERROR_MAP_YAML'),
123 description : 'YAML filepath containing error object paths'
124 )
Chirag Sharmae22aca72021-01-18 09:55:29 -0600125conf_data.set('JFFS_CORE_FILE_WORKAROUND', get_option('jffs-workaround').enabled(),
126 description : 'Turn on jffs workaround for core file'
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500127 )
128
129configure_file(configuration : conf_data,
130 output : 'config.h'
131 )
132
133subdir('xyz/openbmc_project/Dump/Internal/Create')
134
135python = find_program('python3')
136errors_map_gen_file_loc = meson.source_root()
137errors_map_gen_file_loc += '/errors_map_gen.py'
138
139errors_map_hpp = custom_target(
140 'errors_map.hpp',
141 command : [
142 python,
143 errors_map_gen_file_loc,
144 '-i',
145 get_option('ERROR_MAP_YAML')
146 ],
147 depend_files : [ 'errors_map.mako.hpp',
148 'errors_map_gen.py',
149 get_option('ERROR_MAP_YAML')
150 ],
151 output : 'errors_map.hpp'
152 )
153
154phosphor_dump_manager_sources = [
155 'dump_entry.cpp',
156 'dump_manager.cpp',
Dhruvaraj Subhashchandranfef66a92020-09-06 13:10:59 -0500157 'dump_manager_bmc.cpp',
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500158 'dump_manager_main.cpp',
159 'dump_serialize.cpp',
160 'elog_watch.cpp',
161 errors_map_hpp,
162 server_hpp,
163 server_cpp,
164 'watch.cpp',
165 'bmc_dump_entry.cpp',
166 'dump_utils.cpp',
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500167 'dump_offload.cpp'
168 ]
169
170phosphor_dump_manager_dependency = [
George Liu73e0bab2021-06-29 15:57:43 +0800171 phosphor_dbus_interfaces_dep,
172 sdbusplus_dep,
173 phosphor_logging_dep,
George Liu858fbb22021-07-01 12:25:44 +0800174 cppfs,
175 fmt_dep
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500176 ]
177
178phosphor_dump_manager_install = true
179
Ramesh Iyyar3af5c322020-12-04 00:38:42 -0600180phosphor_dump_manager_incdir = []
181
Ramesh Iyyar131994b2020-12-03 08:35:36 -0600182# To get host transport based interface to take respective host
183# dump actions. It will contain required sources and dependency
184# list for phosphor_dump_manager.
185subdir('host-transport-extensions')
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500186
Dhruvaraj Subhashchandran8b9b4692020-09-24 11:59:42 -0500187#pick any architecture specific dumps
188subdir('dump-extensions')
189
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500190phosphor_dump_monitor_sources = [
191 'core_manager.cpp',
192 'core_manager_main.cpp',
193 'watch.cpp'
194 ]
195
196phosphor_dump_monitor_dependency = [
George Liu73e0bab2021-06-29 15:57:43 +0800197 phosphor_dbus_interfaces_dep,
198 phosphor_logging_dep,
George Liu858fbb22021-07-01 12:25:44 +0800199 cppfs,
200 fmt_dep
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500201 ]
202
203phosphor_dump_monitor_install = true
204
Ramesh Iyyar3af5c322020-12-04 00:38:42 -0600205phosphor_dump_monitor_incdir = []
206
George Liuff92ffe2021-02-09 15:01:53 +0800207phosphor_ramoops_monitor_sources = [
208 'ramoops_manager.cpp',
209 'ramoops_manager_main.cpp',
210 'watch.cpp'
211 ]
212
213phosphor_ramoops_monitor_dependency = [
George Liu858fbb22021-07-01 12:25:44 +0800214 phosphor_dbus_interfaces_dep,
215 phosphor_logging_dep,
216 cppfs,
217 fmt_dep
George Liuff92ffe2021-02-09 15:01:53 +0800218 ]
219
220phosphor_ramoops_monitor_install = true
221
222phosphor_ramoops_monitor_incdir = []
223
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500224executables = [[ 'phosphor-dump-manager',
225 phosphor_dump_manager_sources,
226 phosphor_dump_manager_dependency,
Ramesh Iyyar3af5c322020-12-04 00:38:42 -0600227 phosphor_dump_manager_install,
228 phosphor_dump_manager_incdir
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500229 ],
230 [ 'phosphor-dump-monitor',
231 phosphor_dump_monitor_sources,
232 phosphor_dump_monitor_dependency,
Ramesh Iyyar3af5c322020-12-04 00:38:42 -0600233 phosphor_dump_monitor_install,
234 phosphor_dump_monitor_incdir
George Liuff92ffe2021-02-09 15:01:53 +0800235 ],
236 [ 'phosphor-ramoops-monitor',
237 phosphor_ramoops_monitor_sources,
238 phosphor_ramoops_monitor_dependency,
239 phosphor_ramoops_monitor_install,
240 phosphor_ramoops_monitor_incdir
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500241 ]
242 ]
243
244foreach executable : executables
245 binary = executable(
246 executable[0],
247 executable[1],
248 dependencies: executable[2],
Ramesh Iyyar3af5c322020-12-04 00:38:42 -0600249 install : executable[3],
250 include_directories : executable[4]
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500251 )
252endforeach
Chirag Sharma50427252020-08-11 12:11:38 -0500253
254if get_option('tests').enabled()
255 subdir('test')
256endif