xref: /openbmc/phosphor-debug-collector/meson.build (revision fdc0c3a12d58a0694718fe4616d9d91eab97b460)
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('CORE_FILE_DIR', get_option('CORE_FILE_DIR'),
33                      description : 'Directory where core dumps are placed'
34                    )
35conf_data.set_quoted('OBJ_INTERNAL', get_option('OBJ_INTERNAL'),
36                      description : 'Internal Dump manager Dbus object path'
37                    )
38conf_data.set_quoted('OBJ_ENTRY', get_option('OBJ_ENTRY'),
39                      description : 'The dump entry DBus object path'
40                    )
41conf_data.set_quoted('BMC_DUMP_PATH', get_option('BMC_DUMP_PATH'),
42                     description : 'Directory where bmc dumps are placed')
43conf_data.set('BMC_DUMP_MAX_SIZE', get_option('BMC_DUMP_MAX_SIZE'),
44               description : 'Maximum size of one bmc dump in kilo bytes'
45             )
46conf_data.set('BMC_DUMP_MIN_SPACE_REQD', get_option('BMC_DUMP_MIN_SPACE_REQD'),
47               description : 'Minimum space required for one bmc dump in kilo bytes'
48             )
49conf_data.set('BMC_DUMP_TOTAL_SIZE', get_option('BMC_DUMP_TOTAL_SIZE'),
50               description : 'Total size of the dump in kilo bytes'
51             )
52conf_data.set_quoted('OBJ_LOGGING', '/xyz/openbmc_project/logging',
53                      description : 'The log manager DBus object path'
54                    )
55conf_data.set_quoted('ELOG_ID_PERSIST_PATH', get_option('ELOG_ID_PERSIST_PATH'),
56                      description : 'Path of file for storing elog id\'s, which have associated dumps'
57                    )
58conf_data.set('CLASS_VERSION', get_option('CLASS_VERSION'),
59               description : 'Class version to register with Cereal'
60             )
61conf_data.set('ERROR_MAP_YAML', get_option('ERROR_MAP_YAML'),
62               description : 'YAML filepath containing error object paths'
63             )
64conf_data.set('UBI_CORE_FILE_WORKAROUND', get_option('ubifs-workaround').enabled(),
65               description : 'Turn on ubi workaround for core file'
66             )
67
68configure_file(configuration : conf_data,
69               output : 'config.h'
70              )
71
72subdir('xyz/openbmc_project/Dump/Internal/Create')
73
74python = find_program('python3')
75errors_map_gen_file_loc = meson.source_root()
76errors_map_gen_file_loc += '/errors_map_gen.py'
77
78errors_map_hpp = custom_target(
79                    'errors_map.hpp',
80                    command : [
81                        python,
82                        errors_map_gen_file_loc,
83                        '-i',
84                        get_option('ERROR_MAP_YAML')
85                    ],
86                    depend_files : [ 'errors_map.mako.hpp',
87                                     'errors_map_gen.py',
88                                     get_option('ERROR_MAP_YAML')
89                                   ],
90                    output : 'errors_map.hpp'
91                 )
92
93phosphor_dump_manager_sources = [
94        'dump_entry.cpp',
95        'dump_manager.cpp',
96        'dump_manager_main.cpp',
97        'dump_serialize.cpp',
98        'elog_watch.cpp',
99        errors_map_hpp,
100        server_hpp,
101        server_cpp,
102        'watch.cpp',
103        'bmc_dump_entry.cpp',
104        'dump_utils.cpp',
105        'system_dump_entry.cpp',
106        'dump_offload.cpp'
107    ]
108
109phosphor_dump_manager_dependency = [
110        phosphor_dbus_interfaces,
111        sdbusplus,
112        phosphor_logging,
113        cppfs
114    ]
115
116phosphor_dump_manager_install = true
117
118# To get host dump offload transport source files and dependency list
119# for phosphor_dump_manager
120subdir('offload-extensions')
121
122phosphor_dump_monitor_sources = [
123        'core_manager.cpp',
124        'core_manager_main.cpp',
125        'watch.cpp'
126    ]
127
128phosphor_dump_monitor_dependency = [
129        phosphor_dbus_interfaces,
130        phosphor_logging,
131        cppfs
132    ]
133
134phosphor_dump_monitor_install = true
135
136executables = [[ 'phosphor-dump-manager',
137                  phosphor_dump_manager_sources,
138                  phosphor_dump_manager_dependency,
139                  phosphor_dump_manager_install
140               ],
141               [ 'phosphor-dump-monitor',
142                  phosphor_dump_monitor_sources,
143                  phosphor_dump_monitor_dependency,
144                  phosphor_dump_monitor_install
145               ]
146              ]
147
148foreach executable : executables
149    binary = executable(
150                        executable[0],
151                        executable[1],
152                        dependencies: executable[2],
153                        install : executable[3]
154                       )
155endforeach
156
157if get_option('tests').enabled()
158  subdir('test')
159endif
160