blob: bfa38898d0ffe2a1e64273398b4ad677fd704ffe [file] [log] [blame]
Patrick Williamsd9f0d642021-04-21 15:43:21 -05001libpldm_dep = dependency(
2 'libpldm',
3 fallback: ['pldm', 'libpldm_dep'],
4 default_options: ['libpldm-only=enabled', 'oem-ibm=enabled'],
5)
6
7if cpp.has_header('nlohmann/json.hpp')
8 nlohmann_json = declare_dependency()
9else
10 subproject('nlohmann-json')
11 nlohmann_json = declare_dependency(
12 include_directories: include_directories(
13 '../../subprojects/nlohmann-json/single_include',
14 '../../subprojects/nlohmann-json/single_include/nlohmann',
15 )
16 )
17endif
18
19python_inst = import('python').find_installation('python3')
20python_ver = python_inst.language_version()
21python_dep = python_inst.dependency()
22
23if cpp.has_header('CLI/CLI.hpp')
24 CLI11_dep = declare_dependency()
25else
26 CLI11_dep = dependency(
27 'CLI11',
28 fallback: [ 'CLI11', 'CLI11_dep' ],
29 )
30endif
31
Jayanth Othayothe8bdeea2021-06-03 03:01:16 -050032extra_sources = []
Jayanth Othayoth4d779b22021-06-03 05:45:13 -050033extra_dependencies = []
William A. Kennington III8fd187e2021-07-26 13:36:56 -070034extra_args = []
Jayanth Othayothbf54cbb2021-06-03 04:36:48 -050035
Jayanth Othayothe8bdeea2021-06-03 03:01:16 -050036build_phal = get_option('phal').enabled()
37
38if build_phal
39 extra_sources += [
40 'sbe_ffdc_handler.cpp',
Jayanth Othayoth4d779b22021-06-03 05:45:13 -050041 'fapi_data_process.cpp',
Jayanth Othayothda9b5832021-11-05 04:19:43 -050042 'phal_service_actions.cpp',
Jayanth Othayoth4d779b22021-06-03 05:45:13 -050043 ]
44 extra_dependencies += [
45 dependency('libdt-api'),
46 cpp.find_library('pdbg'),
Jayanth Othayothc74c2202021-06-04 06:42:43 -050047 cpp.find_library('ekb'),
Jayanth Othayoth3ef7b602021-11-09 06:40:38 -060048 cpp.find_library('phal'),
Jayanth Othayothe8bdeea2021-06-03 03:01:16 -050049 ]
William A. Kennington III8fd187e2021-07-26 13:36:56 -070050 extra_args += [
Jayanth Othayoth92b20662021-11-05 00:09:15 -050051 '-DPEL_ENABLE_PHAL',
William A. Kennington III8fd187e2021-07-26 13:36:56 -070052 ]
53 log_manager_ext_args += [
Jayanth Othayoth92b20662021-11-05 00:09:15 -050054 '-DPEL_ENABLE_PHAL',
William A. Kennington III8fd187e2021-07-26 13:36:56 -070055 ]
Jayanth Othayothe8bdeea2021-06-03 03:01:16 -050056endif
57
Patrick Williamsd9f0d642021-04-21 15:43:21 -050058libpel_sources = files(
59 'ascii_string.cpp',
60 'bcd_time.cpp',
61 'callout.cpp',
62 'callouts.cpp',
63 'data_interface.cpp',
64 'device_callouts.cpp',
65 'extended_user_header.cpp',
66 'failing_mtms.cpp',
67 'fru_identity.cpp',
68 'generic.cpp',
69 'json_utils.cpp',
70 'log_id.cpp',
71 'mru.cpp',
72 'mtms.cpp',
73 'pce_identity.cpp',
74 'pel.cpp',
75 'pel_rules.cpp',
76 'pel_values.cpp',
77 'private_header.cpp',
78 'registry.cpp',
79 'section_factory.cpp',
80 'service_indicators.cpp',
81 'severity.cpp',
82 'user_header.cpp',
Jayanth Othayothbf54cbb2021-06-03 04:36:48 -050083 'temporary_file.cpp',
Jayanth Othayothe8bdeea2021-06-03 03:01:16 -050084 extra_sources,
Patrick Williamsd9f0d642021-04-21 15:43:21 -050085)
86
87libpel_deps = [
William A. Kennington IIIe0538842021-06-11 02:01:58 -070088 conf_h_dep,
Patrick Williamsd9f0d642021-04-21 15:43:21 -050089 libpldm_dep,
90 nlohmann_json,
91 sdbusplus_dep,
92 sdeventplus_dep,
93 pdi_dep,
Jayanth Othayothebc91be2021-07-27 00:54:31 -050094 phosphor_logging_dep,
Jayanth Othayoth4d779b22021-06-03 05:45:13 -050095 extra_dependencies,
Patrick Williamsd9f0d642021-04-21 15:43:21 -050096]
97
98libpel_lib = static_library(
99 'pel',
100 libpel_sources,
101 'paths.cpp', # paths is separate because it is overridden during test.
102 include_directories: include_directories('../..', '../../gen'),
William A. Kennington III8fd187e2021-07-26 13:36:56 -0700103 cpp_args: extra_args,
Jayanth Othayothebc91be2021-07-27 00:54:31 -0500104 dependencies: [
105 libpel_deps,
106 ]
Patrick Williamsd9f0d642021-04-21 15:43:21 -0500107)
108
109libpel_dep = declare_dependency(
110 include_directories: include_directories('.'),
111 link_with: libpel_lib,
112 dependencies: [
113 libpldm_dep,
114 nlohmann_json,
115 sdbusplus_dep,
116 sdeventplus_dep,
117 pdi_dep,
Jayanth Othayothebc91be2021-07-27 00:54:31 -0500118 phosphor_logging_dep,
Jayanth Othayoth4d779b22021-06-03 05:45:13 -0500119 ]
Patrick Williamsd9f0d642021-04-21 15:43:21 -0500120)
121
122log_manager_ext_deps += [
123 libpel_dep,
124 libpldm_dep,
125 nlohmann_json,
126]
127
128log_manager_ext_sources += files(
129 'entry_points.cpp',
130 'extended_user_data.cpp',
131 'host_notifier.cpp',
132 'manager.cpp',
Vijay Lobo2fb10212021-08-22 23:24:16 -0500133 'pel_entry.cpp',
Patrick Williamsd9f0d642021-04-21 15:43:21 -0500134 'pldm_interface.cpp',
135 'repository.cpp',
136 'src.cpp',
137 'user_data.cpp',
138)
139
140install_data(
141 'registry/message_registry.json',
142 install_dir: get_option('datadir') / 'phosphor-logging/pels',
143)
144
145peltool_sources = files(
146 'extended_user_data.cpp',
147 'src.cpp',
148 'user_data.cpp',
149 'user_data_json.cpp',
150)
151
152peltool_deps = [
153 CLI11_dep,
William A. Kennington IIIe0538842021-06-11 02:01:58 -0700154 conf_h_dep,
Patrick Williamsd9f0d642021-04-21 15:43:21 -0500155 python_dep,
156]
157
158executable(
159 'peltool',
160 'tools/peltool.cpp',
161 peltool_sources,
162 cpp_args: [ '-DPELTOOL' ],
163 link_args: [ '-lpython' + python_ver ],
164 include_directories: include_directories('../..'),
165 dependencies: [
166 peltool_deps,
167 libpel_dep,
168 ],
169 install: true,
170)