blob: 46599452dc82ef5f6885c6b64a8576564e384368 [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 Othayothe8bdeea2021-06-03 03:01:16 -050048 ]
William A. Kennington III8fd187e2021-07-26 13:36:56 -070049 extra_args += [
Jayanth Othayoth92b20662021-11-05 00:09:15 -050050 '-DPEL_ENABLE_PHAL',
William A. Kennington III8fd187e2021-07-26 13:36:56 -070051 ]
52 log_manager_ext_args += [
Jayanth Othayoth92b20662021-11-05 00:09:15 -050053 '-DPEL_ENABLE_PHAL',
William A. Kennington III8fd187e2021-07-26 13:36:56 -070054 ]
Jayanth Othayothe8bdeea2021-06-03 03:01:16 -050055endif
56
Patrick Williamsd9f0d642021-04-21 15:43:21 -050057libpel_sources = files(
58 'ascii_string.cpp',
59 'bcd_time.cpp',
60 'callout.cpp',
61 'callouts.cpp',
62 'data_interface.cpp',
63 'device_callouts.cpp',
64 'extended_user_header.cpp',
65 'failing_mtms.cpp',
66 'fru_identity.cpp',
67 'generic.cpp',
68 'json_utils.cpp',
69 'log_id.cpp',
70 'mru.cpp',
71 'mtms.cpp',
72 'pce_identity.cpp',
73 'pel.cpp',
74 'pel_rules.cpp',
75 'pel_values.cpp',
76 'private_header.cpp',
77 'registry.cpp',
78 'section_factory.cpp',
79 'service_indicators.cpp',
80 'severity.cpp',
81 'user_header.cpp',
Jayanth Othayothbf54cbb2021-06-03 04:36:48 -050082 'temporary_file.cpp',
Jayanth Othayothe8bdeea2021-06-03 03:01:16 -050083 extra_sources,
Patrick Williamsd9f0d642021-04-21 15:43:21 -050084)
85
86libpel_deps = [
William A. Kennington IIIe0538842021-06-11 02:01:58 -070087 conf_h_dep,
Patrick Williamsd9f0d642021-04-21 15:43:21 -050088 libpldm_dep,
89 nlohmann_json,
90 sdbusplus_dep,
91 sdeventplus_dep,
92 pdi_dep,
Jayanth Othayothebc91be2021-07-27 00:54:31 -050093 phosphor_logging_dep,
Jayanth Othayoth4d779b22021-06-03 05:45:13 -050094 extra_dependencies,
Patrick Williamsd9f0d642021-04-21 15:43:21 -050095]
96
97libpel_lib = static_library(
98 'pel',
99 libpel_sources,
100 'paths.cpp', # paths is separate because it is overridden during test.
101 include_directories: include_directories('../..', '../../gen'),
William A. Kennington III8fd187e2021-07-26 13:36:56 -0700102 cpp_args: extra_args,
Jayanth Othayothebc91be2021-07-27 00:54:31 -0500103 dependencies: [
104 libpel_deps,
105 ]
Patrick Williamsd9f0d642021-04-21 15:43:21 -0500106)
107
108libpel_dep = declare_dependency(
109 include_directories: include_directories('.'),
110 link_with: libpel_lib,
111 dependencies: [
112 libpldm_dep,
113 nlohmann_json,
114 sdbusplus_dep,
115 sdeventplus_dep,
116 pdi_dep,
Jayanth Othayothebc91be2021-07-27 00:54:31 -0500117 phosphor_logging_dep,
Jayanth Othayoth4d779b22021-06-03 05:45:13 -0500118 ]
Patrick Williamsd9f0d642021-04-21 15:43:21 -0500119)
120
121log_manager_ext_deps += [
122 libpel_dep,
123 libpldm_dep,
124 nlohmann_json,
125]
126
127log_manager_ext_sources += files(
128 'entry_points.cpp',
129 'extended_user_data.cpp',
130 'host_notifier.cpp',
131 'manager.cpp',
Vijay Lobo2fb10212021-08-22 23:24:16 -0500132 'pel_entry.cpp',
Patrick Williamsd9f0d642021-04-21 15:43:21 -0500133 'pldm_interface.cpp',
134 'repository.cpp',
135 'src.cpp',
136 'user_data.cpp',
137)
138
139install_data(
140 'registry/message_registry.json',
141 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)