blob: 39ea8323233c2230368b8129527716bc99ddea7e [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',
42 ]
43 extra_dependencies += [
44 dependency('libdt-api'),
45 cpp.find_library('pdbg'),
Jayanth Othayothc74c2202021-06-04 06:42:43 -050046 cpp.find_library('ekb'),
Jayanth Othayothe8bdeea2021-06-03 03:01:16 -050047 ]
William A. Kennington III8fd187e2021-07-26 13:36:56 -070048 extra_args += [
49 '-DSBE_FFDC_SUPPORTED',
50 ]
51 log_manager_ext_args += [
52 '-DSBE_FFDC_SUPPORTED',
53 ]
Jayanth Othayothe8bdeea2021-06-03 03:01:16 -050054endif
55
Patrick Williamsd9f0d642021-04-21 15:43:21 -050056libpel_sources = files(
57 'ascii_string.cpp',
58 'bcd_time.cpp',
59 'callout.cpp',
60 'callouts.cpp',
61 'data_interface.cpp',
62 'device_callouts.cpp',
63 'extended_user_header.cpp',
64 'failing_mtms.cpp',
65 'fru_identity.cpp',
66 'generic.cpp',
67 'json_utils.cpp',
68 'log_id.cpp',
69 'mru.cpp',
70 'mtms.cpp',
71 'pce_identity.cpp',
72 'pel.cpp',
73 'pel_rules.cpp',
74 'pel_values.cpp',
75 'private_header.cpp',
76 'registry.cpp',
77 'section_factory.cpp',
78 'service_indicators.cpp',
79 'severity.cpp',
80 'user_header.cpp',
Jayanth Othayothbf54cbb2021-06-03 04:36:48 -050081 'temporary_file.cpp',
Jayanth Othayothe8bdeea2021-06-03 03:01:16 -050082 extra_sources,
Patrick Williamsd9f0d642021-04-21 15:43:21 -050083)
84
85libpel_deps = [
William A. Kennington IIIe0538842021-06-11 02:01:58 -070086 conf_h_dep,
Patrick Williamsd9f0d642021-04-21 15:43:21 -050087 libpldm_dep,
88 nlohmann_json,
89 sdbusplus_dep,
90 sdeventplus_dep,
91 pdi_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,
Patrick Williamsd9f0d642021-04-21 15:43:21 -0500101 dependencies: libpel_deps,
102)
103
104libpel_dep = declare_dependency(
105 include_directories: include_directories('.'),
106 link_with: libpel_lib,
107 dependencies: [
108 libpldm_dep,
109 nlohmann_json,
110 sdbusplus_dep,
111 sdeventplus_dep,
112 pdi_dep,
Jayanth Othayoth4d779b22021-06-03 05:45:13 -0500113 ]
Patrick Williamsd9f0d642021-04-21 15:43:21 -0500114)
115
116log_manager_ext_deps += [
117 libpel_dep,
118 libpldm_dep,
119 nlohmann_json,
120]
121
122log_manager_ext_sources += files(
123 'entry_points.cpp',
124 'extended_user_data.cpp',
125 'host_notifier.cpp',
126 'manager.cpp',
127 'pldm_interface.cpp',
128 'repository.cpp',
129 'src.cpp',
130 'user_data.cpp',
131)
132
133install_data(
134 'registry/message_registry.json',
135 install_dir: get_option('datadir') / 'phosphor-logging/pels',
136)
137
138peltool_sources = files(
139 'extended_user_data.cpp',
140 'src.cpp',
141 'user_data.cpp',
142 'user_data_json.cpp',
143)
144
145peltool_deps = [
146 CLI11_dep,
William A. Kennington IIIe0538842021-06-11 02:01:58 -0700147 conf_h_dep,
Patrick Williamsd9f0d642021-04-21 15:43:21 -0500148 python_dep,
149]
150
151executable(
152 'peltool',
153 'tools/peltool.cpp',
154 peltool_sources,
155 cpp_args: [ '-DPELTOOL' ],
156 link_args: [ '-lpython' + python_ver ],
157 include_directories: include_directories('../..'),
158 dependencies: [
159 peltool_deps,
160 libpel_dep,
161 ],
162 install: true,
163)