blob: 6a073229e44bc3aab3afdc52a8888a3bcb48e404 [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',
Matt Spinlerd96fa602022-12-15 11:11:26 -060065 'journal.cpp',
Patrick Williamsd9f0d642021-04-21 15:43:21 -050066 'json_utils.cpp',
67 'log_id.cpp',
68 'mru.cpp',
69 'mtms.cpp',
70 'pce_identity.cpp',
71 'pel.cpp',
72 'pel_rules.cpp',
73 'pel_values.cpp',
74 'private_header.cpp',
75 'registry.cpp',
76 'section_factory.cpp',
77 'service_indicators.cpp',
78 'severity.cpp',
79 'user_header.cpp',
Jayanth Othayothbf54cbb2021-06-03 04:36:48 -050080 'temporary_file.cpp',
Jayanth Othayothe8bdeea2021-06-03 03:01:16 -050081 extra_sources,
Patrick Williamsd9f0d642021-04-21 15:43:21 -050082)
83
84libpel_deps = [
William A. Kennington IIIe0538842021-06-11 02:01:58 -070085 conf_h_dep,
Patrick Williamsd9f0d642021-04-21 15:43:21 -050086 libpldm_dep,
87 nlohmann_json,
88 sdbusplus_dep,
89 sdeventplus_dep,
90 pdi_dep,
Jayanth Othayothebc91be2021-07-27 00:54:31 -050091 phosphor_logging_dep,
Jayanth Othayoth4d779b22021-06-03 05:45:13 -050092 extra_dependencies,
Patrick Williamsd9f0d642021-04-21 15:43:21 -050093]
94
95libpel_lib = static_library(
96 'pel',
97 libpel_sources,
98 'paths.cpp', # paths is separate because it is overridden during test.
99 include_directories: include_directories('../..', '../../gen'),
William A. Kennington III8fd187e2021-07-26 13:36:56 -0700100 cpp_args: extra_args,
Jayanth Othayothebc91be2021-07-27 00:54:31 -0500101 dependencies: [
102 libpel_deps,
103 ]
Patrick Williamsd9f0d642021-04-21 15:43:21 -0500104)
105
106libpel_dep = declare_dependency(
107 include_directories: include_directories('.'),
108 link_with: libpel_lib,
109 dependencies: [
110 libpldm_dep,
111 nlohmann_json,
112 sdbusplus_dep,
113 sdeventplus_dep,
114 pdi_dep,
Jayanth Othayothebc91be2021-07-27 00:54:31 -0500115 phosphor_logging_dep,
Jayanth Othayoth4d779b22021-06-03 05:45:13 -0500116 ]
Patrick Williamsd9f0d642021-04-21 15:43:21 -0500117)
118
119log_manager_ext_deps += [
120 libpel_dep,
121 libpldm_dep,
122 nlohmann_json,
123]
124
125log_manager_ext_sources += files(
126 'entry_points.cpp',
127 'extended_user_data.cpp',
128 'host_notifier.cpp',
129 'manager.cpp',
Vijay Lobo2fb10212021-08-22 23:24:16 -0500130 'pel_entry.cpp',
Patrick Williamsd9f0d642021-04-21 15:43:21 -0500131 'pldm_interface.cpp',
132 'repository.cpp',
133 'src.cpp',
134 'user_data.cpp',
135)
136
137install_data(
138 'registry/message_registry.json',
Matt Spinler8e823e12022-05-02 10:24:10 -0500139 'registry/O_component_ids.json',
Matt Spinler2ef9dc92022-05-02 10:58:11 -0500140 'registry/B_component_ids.json',
Patrick Williamsd9f0d642021-04-21 15:43:21 -0500141 install_dir: get_option('datadir') / 'phosphor-logging/pels',
142)
143
144peltool_sources = files(
145 'extended_user_data.cpp',
146 'src.cpp',
147 'user_data.cpp',
148 'user_data_json.cpp',
149)
150
151peltool_deps = [
152 CLI11_dep,
William A. Kennington IIIe0538842021-06-11 02:01:58 -0700153 conf_h_dep,
Patrick Williamsd9f0d642021-04-21 15:43:21 -0500154 python_dep,
155]
156
157executable(
158 'peltool',
159 'tools/peltool.cpp',
160 peltool_sources,
161 cpp_args: [ '-DPELTOOL' ],
162 link_args: [ '-lpython' + python_ver ],
163 include_directories: include_directories('../..'),
164 dependencies: [
165 peltool_deps,
166 libpel_dep,
167 ],
168 install: true,
169)