blob: 2eb51d3cb2c1009b5d901b27186bb7c59c93fdb4 [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 )
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')
124errors_map_gen_file_loc = meson.source_root()
125errors_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,
George Liu858fbb22021-07-01 12:25:44 +0800162 cppfs,
163 fmt_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 cppfs,
188 fmt_dep
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500189 ]
190
191phosphor_dump_monitor_install = true
192
Ramesh Iyyar3af5c322020-12-04 00:38:42 -0600193phosphor_dump_monitor_incdir = []
194
George Liuff92ffe2021-02-09 15:01:53 +0800195phosphor_ramoops_monitor_sources = [
196 'ramoops_manager.cpp',
197 'ramoops_manager_main.cpp',
198 'watch.cpp'
199 ]
200
201phosphor_ramoops_monitor_dependency = [
George Liu858fbb22021-07-01 12:25:44 +0800202 phosphor_dbus_interfaces_dep,
203 phosphor_logging_dep,
204 cppfs,
205 fmt_dep
George Liuff92ffe2021-02-09 15:01:53 +0800206 ]
207
208phosphor_ramoops_monitor_install = true
209
210phosphor_ramoops_monitor_incdir = []
211
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500212executables = [[ 'phosphor-dump-manager',
213 phosphor_dump_manager_sources,
214 phosphor_dump_manager_dependency,
Ramesh Iyyar3af5c322020-12-04 00:38:42 -0600215 phosphor_dump_manager_install,
216 phosphor_dump_manager_incdir
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500217 ],
218 [ 'phosphor-dump-monitor',
219 phosphor_dump_monitor_sources,
220 phosphor_dump_monitor_dependency,
Ramesh Iyyar3af5c322020-12-04 00:38:42 -0600221 phosphor_dump_monitor_install,
222 phosphor_dump_monitor_incdir
George Liuff92ffe2021-02-09 15:01:53 +0800223 ],
224 [ 'phosphor-ramoops-monitor',
225 phosphor_ramoops_monitor_sources,
226 phosphor_ramoops_monitor_dependency,
227 phosphor_ramoops_monitor_install,
228 phosphor_ramoops_monitor_incdir
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500229 ]
230 ]
231
232foreach executable : executables
233 binary = executable(
234 executable[0],
235 executable[1],
236 dependencies: executable[2],
Ramesh Iyyar3af5c322020-12-04 00:38:42 -0600237 install : executable[3],
238 include_directories : executable[4]
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500239 )
240endforeach
Chirag Sharma50427252020-08-11 12:11:38 -0500241
242if get_option('tests').enabled()
243 subdir('test')
244endif