blob: 7c8ff03af339610a6729676f70efa2e4e8178fe3 [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
PriyangaRamasamy01c66462021-02-23 05:46:25 -060047# Disable FORTIFY_SOURCE when compiling with no optimization
48if(get_option('optimization') == '0')
49 add_project_arguments('-U_FORTIFY_SOURCE',language:['cpp','c'])
50 message('Disabling FORTIFY_SOURCE as optimization is set to 0')
51endif
52
Ramesh Iyyarbb410df2020-08-03 03:13:04 -050053# Configuration header file(config.h) generation
54
55conf_data = configuration_data()
56
57conf_data.set_quoted('DUMP_BUSNAME', get_option('DUMP_BUSNAME'),
58 description : 'The Dbus busname to own'
59 )
60conf_data.set_quoted('DUMP_OBJPATH', get_option('DUMP_OBJPATH'),
61 description : 'The Dump manager Dbus root'
62 )
Dhruvaraj Subhashchandranfef66a92020-09-06 13:10:59 -050063conf_data.set_quoted('BMC_DUMP_OBJPATH', get_option('BMC_DUMP_OBJPATH'),
64 description : 'The BMC Dump manager Dbus path'
65 )
66conf_data.set_quoted('SYSTEM_DUMP_OBJPATH', get_option('SYSTEM_DUMP_OBJPATH'),
67 description : 'The system Dump manager Dbus path'
68 )
Dhruvaraj Subhashchandran62337a92020-11-22 21:24:30 -060069conf_data.set_quoted('RESOURCE_DUMP_OBJPATH', get_option('RESOURCE_DUMP_OBJPATH'),
70 description : 'The resource Dump manager Dbus path'
71 )
Ramesh Iyyarbb410df2020-08-03 03:13:04 -050072conf_data.set_quoted('CORE_FILE_DIR', get_option('CORE_FILE_DIR'),
73 description : 'Directory where core dumps are placed'
74 )
75conf_data.set_quoted('OBJ_INTERNAL', get_option('OBJ_INTERNAL'),
76 description : 'Internal Dump manager Dbus object path'
77 )
Dhruvaraj Subhashchandranfef66a92020-09-06 13:10:59 -050078conf_data.set_quoted('SYSTEM_DUMP_OBJ_ENTRY', get_option('SYSTEM_DUMP_OBJ_ENTRY'),
79 description : 'The system dump entry DBus object path'
80 )
Dhruvaraj Subhashchandran62337a92020-11-22 21:24:30 -060081conf_data.set_quoted('RESOURCE_DUMP_OBJ_ENTRY', get_option('RESOURCE_DUMP_OBJ_ENTRY'),
82 description : 'The resource dump entry DBus object path'
83 )
Dhruvaraj Subhashchandranfef66a92020-09-06 13:10:59 -050084conf_data.set_quoted('BMC_DUMP_OBJ_ENTRY', get_option('BMC_DUMP_OBJ_ENTRY'),
85 description : 'The BMC dump entry DBus object path'
Ramesh Iyyarbb410df2020-08-03 03:13:04 -050086 )
87conf_data.set_quoted('BMC_DUMP_PATH', get_option('BMC_DUMP_PATH'),
88 description : 'Directory where bmc dumps are placed')
George Liuff92ffe2021-02-09 15:01:53 +080089conf_data.set_quoted('SYSTEMD_PSTORE_PATH', get_option('SYSTEMD_PSTORE_PATH'),
90 description : 'Path to the systemd pstore directory')
Ramesh Iyyarbb410df2020-08-03 03:13:04 -050091conf_data.set('BMC_DUMP_MAX_SIZE', get_option('BMC_DUMP_MAX_SIZE'),
92 description : 'Maximum size of one bmc dump in kilo bytes'
93 )
94conf_data.set('BMC_DUMP_MIN_SPACE_REQD', get_option('BMC_DUMP_MIN_SPACE_REQD'),
95 description : 'Minimum space required for one bmc dump in kilo bytes'
96 )
97conf_data.set('BMC_DUMP_TOTAL_SIZE', get_option('BMC_DUMP_TOTAL_SIZE'),
98 description : 'Total size of the dump in kilo bytes'
99 )
100conf_data.set_quoted('OBJ_LOGGING', '/xyz/openbmc_project/logging',
101 description : 'The log manager DBus object path'
102 )
103conf_data.set_quoted('ELOG_ID_PERSIST_PATH', get_option('ELOG_ID_PERSIST_PATH'),
104 description : 'Path of file for storing elog id\'s, which have associated dumps'
105 )
106conf_data.set('CLASS_VERSION', get_option('CLASS_VERSION'),
107 description : 'Class version to register with Cereal'
108 )
109conf_data.set('ERROR_MAP_YAML', get_option('ERROR_MAP_YAML'),
110 description : 'YAML filepath containing error object paths'
111 )
Chirag Sharmae22aca72021-01-18 09:55:29 -0600112conf_data.set('JFFS_CORE_FILE_WORKAROUND', get_option('jffs-workaround').enabled(),
113 description : 'Turn on jffs workaround for core file'
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500114 )
115
116configure_file(configuration : conf_data,
117 output : 'config.h'
118 )
119
120subdir('xyz/openbmc_project/Dump/Internal/Create')
121
122python = find_program('python3')
123errors_map_gen_file_loc = meson.source_root()
124errors_map_gen_file_loc += '/errors_map_gen.py'
125
126errors_map_hpp = custom_target(
127 'errors_map.hpp',
128 command : [
129 python,
130 errors_map_gen_file_loc,
131 '-i',
132 get_option('ERROR_MAP_YAML')
133 ],
134 depend_files : [ 'errors_map.mako.hpp',
135 'errors_map_gen.py',
136 get_option('ERROR_MAP_YAML')
137 ],
138 output : 'errors_map.hpp'
139 )
140
141phosphor_dump_manager_sources = [
142 'dump_entry.cpp',
143 'dump_manager.cpp',
Dhruvaraj Subhashchandranfef66a92020-09-06 13:10:59 -0500144 'dump_manager_bmc.cpp',
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500145 'dump_manager_main.cpp',
146 'dump_serialize.cpp',
147 'elog_watch.cpp',
148 errors_map_hpp,
149 server_hpp,
150 server_cpp,
151 'watch.cpp',
152 'bmc_dump_entry.cpp',
153 'dump_utils.cpp',
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500154 'dump_offload.cpp'
155 ]
156
157phosphor_dump_manager_dependency = [
George Liu73e0bab2021-06-29 15:57:43 +0800158 phosphor_dbus_interfaces_dep,
159 sdbusplus_dep,
160 phosphor_logging_dep,
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500161 cppfs
162 ]
163
164phosphor_dump_manager_install = true
165
Ramesh Iyyar3af5c322020-12-04 00:38:42 -0600166phosphor_dump_manager_incdir = []
167
Ramesh Iyyar131994b2020-12-03 08:35:36 -0600168# To get host transport based interface to take respective host
169# dump actions. It will contain required sources and dependency
170# list for phosphor_dump_manager.
171subdir('host-transport-extensions')
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500172
Dhruvaraj Subhashchandran8b9b4692020-09-24 11:59:42 -0500173#pick any architecture specific dumps
174subdir('dump-extensions')
175
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500176phosphor_dump_monitor_sources = [
177 'core_manager.cpp',
178 'core_manager_main.cpp',
179 'watch.cpp'
180 ]
181
182phosphor_dump_monitor_dependency = [
George Liu73e0bab2021-06-29 15:57:43 +0800183 phosphor_dbus_interfaces_dep,
184 phosphor_logging_dep,
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500185 cppfs
186 ]
187
188phosphor_dump_monitor_install = true
189
Ramesh Iyyar3af5c322020-12-04 00:38:42 -0600190phosphor_dump_monitor_incdir = []
191
George Liuff92ffe2021-02-09 15:01:53 +0800192phosphor_ramoops_monitor_sources = [
193 'ramoops_manager.cpp',
194 'ramoops_manager_main.cpp',
195 'watch.cpp'
196 ]
197
198phosphor_ramoops_monitor_dependency = [
199 phosphor_dbus_interfaces,
200 phosphor_logging,
201 cppfs
202 ]
203
204phosphor_ramoops_monitor_install = true
205
206phosphor_ramoops_monitor_incdir = []
207
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500208executables = [[ 'phosphor-dump-manager',
209 phosphor_dump_manager_sources,
210 phosphor_dump_manager_dependency,
Ramesh Iyyar3af5c322020-12-04 00:38:42 -0600211 phosphor_dump_manager_install,
212 phosphor_dump_manager_incdir
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500213 ],
214 [ 'phosphor-dump-monitor',
215 phosphor_dump_monitor_sources,
216 phosphor_dump_monitor_dependency,
Ramesh Iyyar3af5c322020-12-04 00:38:42 -0600217 phosphor_dump_monitor_install,
218 phosphor_dump_monitor_incdir
George Liuff92ffe2021-02-09 15:01:53 +0800219 ],
220 [ 'phosphor-ramoops-monitor',
221 phosphor_ramoops_monitor_sources,
222 phosphor_ramoops_monitor_dependency,
223 phosphor_ramoops_monitor_install,
224 phosphor_ramoops_monitor_incdir
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500225 ]
226 ]
227
228foreach executable : executables
229 binary = executable(
230 executable[0],
231 executable[1],
232 dependencies: executable[2],
Ramesh Iyyar3af5c322020-12-04 00:38:42 -0600233 install : executable[3],
234 include_directories : executable[4]
Ramesh Iyyarbb410df2020-08-03 03:13:04 -0500235 )
236endforeach
Chirag Sharma50427252020-08-11 12:11:38 -0500237
238if get_option('tests').enabled()
239 subdir('test')
240endif