blob: 0e53730b32febcefe6d4195e60a5dde5f9196e47 [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
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')
Patrick Williamsce836882021-10-01 16:09:35 -0500144errors_map_gen_file_loc = meson.project_source_root()
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500145errors_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,
Patrick Williamsabbe1592021-10-01 16:04:19 -0500182 fmt_dep,
183 cereal_dep,
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500184 ]
185
186phosphor_dump_manager_install = true
187
Ramesh Iyyar3af5c322020-12-04 00:38:42 -0600188phosphor_dump_manager_incdir = []
189
Ramesh Iyyar131994b2020-12-03 08:35:36 -0600190# To get host transport based interface to take respective host
191# dump actions. It will contain required sources and dependency
192# list for phosphor_dump_manager.
193subdir('host-transport-extensions')
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500194
Dhruvaraj Subhashchandran8b9b4692020-09-24 11:59:42 -0500195#pick any architecture specific dumps
196subdir('dump-extensions')
197
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500198phosphor_dump_monitor_sources = [
199 'core_manager.cpp',
200 'core_manager_main.cpp',
201 'watch.cpp'
202 ]
203
204phosphor_dump_monitor_dependency = [
George Liu73e0bab2021-06-29 15:57:43 +0800205 phosphor_dbus_interfaces_dep,
206 phosphor_logging_dep,
George Liu858fbb22021-07-01 12:25:44 +0800207 fmt_dep
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500208 ]
209
210phosphor_dump_monitor_install = true
211
Ramesh Iyyar3af5c322020-12-04 00:38:42 -0600212phosphor_dump_monitor_incdir = []
213
George Liuff92ffe2021-02-09 15:01:53 +0800214phosphor_ramoops_monitor_sources = [
215 'ramoops_manager.cpp',
216 'ramoops_manager_main.cpp',
217 'watch.cpp'
218 ]
219
220phosphor_ramoops_monitor_dependency = [
George Liu858fbb22021-07-01 12:25:44 +0800221 phosphor_dbus_interfaces_dep,
222 phosphor_logging_dep,
George Liu858fbb22021-07-01 12:25:44 +0800223 fmt_dep
George Liuff92ffe2021-02-09 15:01:53 +0800224 ]
225
226phosphor_ramoops_monitor_install = true
227
228phosphor_ramoops_monitor_incdir = []
229
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500230executables = [[ 'phosphor-dump-manager',
231 phosphor_dump_manager_sources,
232 phosphor_dump_manager_dependency,
Ramesh Iyyar3af5c322020-12-04 00:38:42 -0600233 phosphor_dump_manager_install,
234 phosphor_dump_manager_incdir
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500235 ],
236 [ 'phosphor-dump-monitor',
237 phosphor_dump_monitor_sources,
238 phosphor_dump_monitor_dependency,
Ramesh Iyyar3af5c322020-12-04 00:38:42 -0600239 phosphor_dump_monitor_install,
240 phosphor_dump_monitor_incdir
George Liuff92ffe2021-02-09 15:01:53 +0800241 ],
242 [ 'phosphor-ramoops-monitor',
243 phosphor_ramoops_monitor_sources,
244 phosphor_ramoops_monitor_dependency,
245 phosphor_ramoops_monitor_install,
246 phosphor_ramoops_monitor_incdir
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500247 ]
248 ]
249
250foreach executable : executables
251 binary = executable(
252 executable[0],
253 executable[1],
254 dependencies: executable[2],
Ramesh Iyyar3af5c322020-12-04 00:38:42 -0600255 install : executable[3],
256 include_directories : executable[4]
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500257 )
258endforeach
Chirag Sharma50427252020-08-11 12:11:38 -0500259
260if get_option('tests').enabled()
261 subdir('test')
262endif