1# 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',
8                          'werror=true'
9                         ],
10        version: '1.0',
11        license: 'Apache-2.0'
12       )
13
14# Checking dependency external library
15
16cppfs = meson.get_compiler('cpp').find_library('stdc++fs')
17libsystemd = dependency('libsystemd', version : '>=221')
18phosphor_dbus_interfaces = dependency('phosphor-dbus-interfaces')
19sdbusplus = dependency('sdbusplus')
20phosphor_logging = dependency('phosphor-logging')
21
22# Configuration header file(config.h) generation
23
24conf_data = configuration_data()
25
26conf_data.set_quoted('DUMP_BUSNAME', get_option('DUMP_BUSNAME'),
27                      description : 'The Dbus busname to own'
28                    )
29conf_data.set_quoted('DUMP_OBJPATH', get_option('DUMP_OBJPATH'),
30                      description : 'The Dump manager Dbus root'
31                    )
32conf_data.set_quoted('BMC_DUMP_OBJPATH', get_option('BMC_DUMP_OBJPATH'),
33                      description : 'The BMC Dump manager Dbus path'
34                    )
35conf_data.set_quoted('SYSTEM_DUMP_OBJPATH', get_option('SYSTEM_DUMP_OBJPATH'),
36                      description : 'The system Dump manager Dbus path'
37                    )
38conf_data.set_quoted('RESOURCE_DUMP_OBJPATH', get_option('RESOURCE_DUMP_OBJPATH'),
39                      description : 'The resource Dump manager Dbus path'
40                    )
41conf_data.set_quoted('CORE_FILE_DIR', get_option('CORE_FILE_DIR'),
42                      description : 'Directory where core dumps are placed'
43                    )
44conf_data.set_quoted('OBJ_INTERNAL', get_option('OBJ_INTERNAL'),
45                      description : 'Internal Dump manager Dbus object path'
46                    )
47conf_data.set_quoted('SYSTEM_DUMP_OBJ_ENTRY', get_option('SYSTEM_DUMP_OBJ_ENTRY'),
48                      description : 'The system dump entry DBus object path'
49                    )
50conf_data.set_quoted('RESOURCE_DUMP_OBJ_ENTRY', get_option('RESOURCE_DUMP_OBJ_ENTRY'),
51                      description : 'The resource dump entry DBus object path'
52                    )
53conf_data.set_quoted('BMC_DUMP_OBJ_ENTRY', get_option('BMC_DUMP_OBJ_ENTRY'),
54                      description : 'The BMC dump entry DBus object path'
55                    )
56conf_data.set_quoted('BMC_DUMP_PATH', get_option('BMC_DUMP_PATH'),
57                     description : 'Directory where bmc dumps are placed')
58conf_data.set('BMC_DUMP_MAX_SIZE', get_option('BMC_DUMP_MAX_SIZE'),
59               description : 'Maximum size of one bmc dump in kilo bytes'
60             )
61conf_data.set('BMC_DUMP_MIN_SPACE_REQD', get_option('BMC_DUMP_MIN_SPACE_REQD'),
62               description : 'Minimum space required for one bmc dump in kilo bytes'
63             )
64conf_data.set('BMC_DUMP_TOTAL_SIZE', get_option('BMC_DUMP_TOTAL_SIZE'),
65               description : 'Total size of the dump in kilo bytes'
66             )
67conf_data.set_quoted('OBJ_LOGGING', '/xyz/openbmc_project/logging',
68                      description : 'The log manager DBus object path'
69                    )
70conf_data.set_quoted('ELOG_ID_PERSIST_PATH', get_option('ELOG_ID_PERSIST_PATH'),
71                      description : 'Path of file for storing elog id\'s, which have associated dumps'
72                    )
73conf_data.set('CLASS_VERSION', get_option('CLASS_VERSION'),
74               description : 'Class version to register with Cereal'
75             )
76conf_data.set('ERROR_MAP_YAML', get_option('ERROR_MAP_YAML'),
77               description : 'YAML filepath containing error object paths'
78             )
79conf_data.set('UBI_CORE_FILE_WORKAROUND', get_option('ubifs-workaround').enabled(),
80               description : 'Turn on ubi workaround for core file'
81             )
82
83configure_file(configuration : conf_data,
84               output : 'config.h'
85              )
86
87subdir('xyz/openbmc_project/Dump/Internal/Create')
88
89python = find_program('python3')
90errors_map_gen_file_loc = meson.source_root()
91errors_map_gen_file_loc += '/errors_map_gen.py'
92
93errors_map_hpp = custom_target(
94                    'errors_map.hpp',
95                    command : [
96                        python,
97                        errors_map_gen_file_loc,
98                        '-i',
99                        get_option('ERROR_MAP_YAML')
100                    ],
101                    depend_files : [ 'errors_map.mako.hpp',
102                                     'errors_map_gen.py',
103                                     get_option('ERROR_MAP_YAML')
104                                   ],
105                    output : 'errors_map.hpp'
106                 )
107
108phosphor_dump_manager_sources = [
109        'dump_entry.cpp',
110        'dump_manager.cpp',
111        'dump_manager_bmc.cpp',
112        'dump_manager_main.cpp',
113        'dump_serialize.cpp',
114        'elog_watch.cpp',
115        errors_map_hpp,
116        server_hpp,
117        server_cpp,
118        'watch.cpp',
119        'bmc_dump_entry.cpp',
120        'dump_utils.cpp',
121        'dump_offload.cpp'
122    ]
123
124phosphor_dump_manager_dependency = [
125        phosphor_dbus_interfaces,
126        sdbusplus,
127        phosphor_logging,
128        cppfs
129    ]
130
131phosphor_dump_manager_install = true
132
133phosphor_dump_manager_incdir = []
134
135# To get host transport based interface to take respective host
136# dump actions. It will contain required sources and dependency
137# list for phosphor_dump_manager.
138subdir('host-transport-extensions')
139
140#pick any architecture specific dumps
141subdir('dump-extensions')
142
143phosphor_dump_monitor_sources = [
144        'core_manager.cpp',
145        'core_manager_main.cpp',
146        'watch.cpp'
147    ]
148
149phosphor_dump_monitor_dependency = [
150        phosphor_dbus_interfaces,
151        phosphor_logging,
152        cppfs
153    ]
154
155phosphor_dump_monitor_install = true
156
157phosphor_dump_monitor_incdir = []
158
159executables = [[ 'phosphor-dump-manager',
160                  phosphor_dump_manager_sources,
161                  phosphor_dump_manager_dependency,
162                  phosphor_dump_manager_install,
163                  phosphor_dump_manager_incdir
164               ],
165               [ 'phosphor-dump-monitor',
166                  phosphor_dump_monitor_sources,
167                  phosphor_dump_monitor_dependency,
168                  phosphor_dump_monitor_install,
169                  phosphor_dump_monitor_incdir
170               ]
171              ]
172
173foreach executable : executables
174    binary = executable(
175                        executable[0],
176                        executable[1],
177                        dependencies: executable[2],
178                        install : executable[3],
179                        include_directories : executable[4]
180                       )
181endforeach
182
183if get_option('tests').enabled()
184  subdir('test')
185endif
186