blob: a29d257ac220e9ed16fb8d7d4562a1510d536cfa [file] [log] [blame]
Patrick Williamsd9f0d642021-04-21 15:43:21 -05001libpldm_dep = dependency(
2 'libpldm',
Patrick Williamsd9f0d642021-04-21 15:43:21 -05003 default_options: ['libpldm-only=enabled', 'oem-ibm=enabled'],
4)
5
6if cpp.has_header('nlohmann/json.hpp')
7 nlohmann_json = declare_dependency()
8else
9 subproject('nlohmann-json')
10 nlohmann_json = declare_dependency(
11 include_directories: include_directories(
12 '../../subprojects/nlohmann-json/single_include',
13 '../../subprojects/nlohmann-json/single_include/nlohmann',
14 )
15 )
16endif
17
18python_inst = import('python').find_installation('python3')
19python_ver = python_inst.language_version()
20python_dep = python_inst.dependency()
21
22if cpp.has_header('CLI/CLI.hpp')
23 CLI11_dep = declare_dependency()
24else
Patrick Williams62bc9682022-03-21 09:23:11 -050025 CLI11_dep = dependency('CLI11')
Patrick Williamsd9f0d642021-04-21 15:43:21 -050026endif
27
Jayanth Othayothe8bdeea2021-06-03 03:01:16 -050028extra_sources = []
Jayanth Othayoth4d779b22021-06-03 05:45:13 -050029extra_dependencies = []
William A. Kennington III8fd187e2021-07-26 13:36:56 -070030extra_args = []
Jayanth Othayothbf54cbb2021-06-03 04:36:48 -050031
Jayanth Othayothe8bdeea2021-06-03 03:01:16 -050032build_phal = get_option('phal').enabled()
33
34if build_phal
35 extra_sources += [
36 'sbe_ffdc_handler.cpp',
Jayanth Othayoth4d779b22021-06-03 05:45:13 -050037 'fapi_data_process.cpp',
Jayanth Othayothda9b5832021-11-05 04:19:43 -050038 'phal_service_actions.cpp',
Jayanth Othayoth4d779b22021-06-03 05:45:13 -050039 ]
40 extra_dependencies += [
41 dependency('libdt-api'),
42 cpp.find_library('pdbg'),
Jayanth Othayothc74c2202021-06-04 06:42:43 -050043 cpp.find_library('ekb'),
Jayanth Othayoth3ef7b602021-11-09 06:40:38 -060044 cpp.find_library('phal'),
Jayanth Othayothe8bdeea2021-06-03 03:01:16 -050045 ]
William A. Kennington III8fd187e2021-07-26 13:36:56 -070046 extra_args += [
Jayanth Othayoth92b20662021-11-05 00:09:15 -050047 '-DPEL_ENABLE_PHAL',
William A. Kennington III8fd187e2021-07-26 13:36:56 -070048 ]
49 log_manager_ext_args += [
Jayanth Othayoth92b20662021-11-05 00:09:15 -050050 '-DPEL_ENABLE_PHAL',
William A. Kennington III8fd187e2021-07-26 13:36:56 -070051 ]
Jayanth Othayothe8bdeea2021-06-03 03:01:16 -050052endif
53
Patrick Williamsd9f0d642021-04-21 15:43:21 -050054libpel_sources = files(
55 'ascii_string.cpp',
56 'bcd_time.cpp',
57 'callout.cpp',
58 'callouts.cpp',
59 'data_interface.cpp',
60 'device_callouts.cpp',
61 'extended_user_header.cpp',
62 'failing_mtms.cpp',
63 'fru_identity.cpp',
64 'generic.cpp',
65 'json_utils.cpp',
66 'log_id.cpp',
67 'mru.cpp',
68 'mtms.cpp',
69 'pce_identity.cpp',
70 'pel.cpp',
71 'pel_rules.cpp',
72 'pel_values.cpp',
73 'private_header.cpp',
74 'registry.cpp',
75 'section_factory.cpp',
76 'service_indicators.cpp',
77 'severity.cpp',
78 'user_header.cpp',
Jayanth Othayothbf54cbb2021-06-03 04:36:48 -050079 'temporary_file.cpp',
Jayanth Othayothe8bdeea2021-06-03 03:01:16 -050080 extra_sources,
Patrick Williamsd9f0d642021-04-21 15:43:21 -050081)
82
83libpel_deps = [
William A. Kennington IIIe0538842021-06-11 02:01:58 -070084 conf_h_dep,
Patrick Williamsd9f0d642021-04-21 15:43:21 -050085 libpldm_dep,
86 nlohmann_json,
87 sdbusplus_dep,
88 sdeventplus_dep,
89 pdi_dep,
Jayanth Othayothebc91be2021-07-27 00:54:31 -050090 phosphor_logging_dep,
Jayanth Othayoth4d779b22021-06-03 05:45:13 -050091 extra_dependencies,
Patrick Williamsd9f0d642021-04-21 15:43:21 -050092]
93
94libpel_lib = static_library(
95 'pel',
96 libpel_sources,
97 'paths.cpp', # paths is separate because it is overridden during test.
98 include_directories: include_directories('../..', '../../gen'),
William A. Kennington III8fd187e2021-07-26 13:36:56 -070099 cpp_args: extra_args,
Jayanth Othayothebc91be2021-07-27 00:54:31 -0500100 dependencies: [
101 libpel_deps,
102 ]
Patrick Williamsd9f0d642021-04-21 15:43:21 -0500103)
104
105libpel_dep = declare_dependency(
106 include_directories: include_directories('.'),
107 link_with: libpel_lib,
108 dependencies: [
109 libpldm_dep,
110 nlohmann_json,
111 sdbusplus_dep,
112 sdeventplus_dep,
113 pdi_dep,
Jayanth Othayothebc91be2021-07-27 00:54:31 -0500114 phosphor_logging_dep,
Jayanth Othayoth4d779b22021-06-03 05:45:13 -0500115 ]
Patrick Williamsd9f0d642021-04-21 15:43:21 -0500116)
117
118log_manager_ext_deps += [
119 libpel_dep,
120 libpldm_dep,
121 nlohmann_json,
122]
123
124log_manager_ext_sources += files(
125 'entry_points.cpp',
126 'extended_user_data.cpp',
127 'host_notifier.cpp',
128 'manager.cpp',
Vijay Lobo2fb10212021-08-22 23:24:16 -0500129 'pel_entry.cpp',
Patrick Williamsd9f0d642021-04-21 15:43:21 -0500130 'pldm_interface.cpp',
131 'repository.cpp',
132 'src.cpp',
133 'user_data.cpp',
134)
135
136install_data(
137 'registry/message_registry.json',
Matt Spinler8e823e12022-05-02 10:24:10 -0500138 'registry/O_component_ids.json',
Matt Spinler2ef9dc92022-05-02 10:58:11 -0500139 'registry/B_component_ids.json',
Patrick Williamsd9f0d642021-04-21 15:43:21 -0500140 install_dir: get_option('datadir') / 'phosphor-logging/pels',
141)
142
143peltool_sources = files(
144 'extended_user_data.cpp',
145 'src.cpp',
146 'user_data.cpp',
147 'user_data_json.cpp',
148)
149
150peltool_deps = [
151 CLI11_dep,
William A. Kennington IIIe0538842021-06-11 02:01:58 -0700152 conf_h_dep,
Patrick Williamsd9f0d642021-04-21 15:43:21 -0500153 python_dep,
154]
155
156executable(
157 'peltool',
158 'tools/peltool.cpp',
159 peltool_sources,
160 cpp_args: [ '-DPELTOOL' ],
161 link_args: [ '-lpython' + python_ver ],
162 include_directories: include_directories('../..'),
163 dependencies: [
164 peltool_deps,
165 libpel_dep,
166 ],
167 install: true,
168)