blob: 0825c960f589c4de59b671ff1edffe15f794b94c [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 )
116
117configure_file(configuration : conf_data,
118 output : 'config.h'
119 )
120
121subdir('xyz/openbmc_project/Dump/Internal/Create')
122
123python = find_program('python3')
Patrick Williamsce836882021-10-01 16:09:35 -0500124errors_map_gen_file_loc = meson.project_source_root()
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500125errors_map_gen_file_loc += '/errors_map_gen.py'
126
127errors_map_hpp = custom_target(
128 'errors_map.hpp',
129 command : [
130 python,
131 errors_map_gen_file_loc,
132 '-i',
133 get_option('ERROR_MAP_YAML')
134 ],
135 depend_files : [ 'errors_map.mako.hpp',
136 'errors_map_gen.py',
137 get_option('ERROR_MAP_YAML')
138 ],
139 output : 'errors_map.hpp'
140 )
141
142phosphor_dump_manager_sources = [
143 'dump_entry.cpp',
144 'dump_manager.cpp',
Dhruvaraj Subhashchandranfef66a92020-09-06 13:10:59 -0500145 'dump_manager_bmc.cpp',
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500146 'dump_manager_main.cpp',
147 'dump_serialize.cpp',
148 'elog_watch.cpp',
149 errors_map_hpp,
150 server_hpp,
151 server_cpp,
152 'watch.cpp',
153 'bmc_dump_entry.cpp',
154 'dump_utils.cpp',
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500155 'dump_offload.cpp'
156 ]
157
158phosphor_dump_manager_dependency = [
George Liu73e0bab2021-06-29 15:57:43 +0800159 phosphor_dbus_interfaces_dep,
160 sdbusplus_dep,
161 phosphor_logging_dep,
Patrick Williamsabbe1592021-10-01 16:04:19 -0500162 fmt_dep,
163 cereal_dep,
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500164 ]
165
166phosphor_dump_manager_install = true
167
Ramesh Iyyar3af5c322020-12-04 00:38:42 -0600168phosphor_dump_manager_incdir = []
169
Ramesh Iyyar131994b2020-12-03 08:35:36 -0600170# To get host transport based interface to take respective host
171# dump actions. It will contain required sources and dependency
172# list for phosphor_dump_manager.
173subdir('host-transport-extensions')
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500174
Dhruvaraj Subhashchandran8b9b4692020-09-24 11:59:42 -0500175#pick any architecture specific dumps
176subdir('dump-extensions')
177
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500178phosphor_dump_monitor_sources = [
179 'core_manager.cpp',
180 'core_manager_main.cpp',
181 'watch.cpp'
182 ]
183
184phosphor_dump_monitor_dependency = [
George Liu73e0bab2021-06-29 15:57:43 +0800185 phosphor_dbus_interfaces_dep,
186 phosphor_logging_dep,
George Liu858fbb22021-07-01 12:25:44 +0800187 fmt_dep
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500188 ]
189
190phosphor_dump_monitor_install = true
191
Ramesh Iyyar3af5c322020-12-04 00:38:42 -0600192phosphor_dump_monitor_incdir = []
193
George Liuff92ffe2021-02-09 15:01:53 +0800194phosphor_ramoops_monitor_sources = [
195 'ramoops_manager.cpp',
196 'ramoops_manager_main.cpp',
197 'watch.cpp'
198 ]
199
200phosphor_ramoops_monitor_dependency = [
George Liu858fbb22021-07-01 12:25:44 +0800201 phosphor_dbus_interfaces_dep,
202 phosphor_logging_dep,
George Liu858fbb22021-07-01 12:25:44 +0800203 fmt_dep
George Liuff92ffe2021-02-09 15:01:53 +0800204 ]
205
206phosphor_ramoops_monitor_install = true
207
208phosphor_ramoops_monitor_incdir = []
209
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500210executables = [[ 'phosphor-dump-manager',
211 phosphor_dump_manager_sources,
212 phosphor_dump_manager_dependency,
Ramesh Iyyar3af5c322020-12-04 00:38:42 -0600213 phosphor_dump_manager_install,
214 phosphor_dump_manager_incdir
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500215 ],
216 [ 'phosphor-dump-monitor',
217 phosphor_dump_monitor_sources,
218 phosphor_dump_monitor_dependency,
Ramesh Iyyar3af5c322020-12-04 00:38:42 -0600219 phosphor_dump_monitor_install,
220 phosphor_dump_monitor_incdir
George Liuff92ffe2021-02-09 15:01:53 +0800221 ],
222 [ 'phosphor-ramoops-monitor',
223 phosphor_ramoops_monitor_sources,
224 phosphor_ramoops_monitor_dependency,
225 phosphor_ramoops_monitor_install,
226 phosphor_ramoops_monitor_incdir
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500227 ]
228 ]
229
230foreach executable : executables
231 binary = executable(
232 executable[0],
233 executable[1],
234 dependencies: executable[2],
Ramesh Iyyar3af5c322020-12-04 00:38:42 -0600235 install : executable[3],
236 include_directories : executable[4]
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500237 )
238endforeach
Chirag Sharma50427252020-08-11 12:11:38 -0500239
240if get_option('tests').enabled()
241 subdir('test')
242endif