blob: 1c8ba49a0fd5873214fe7872587297da019c4be1 [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 Othayothebc91be2021-07-27 00:54:31 -050092 phosphor_logging_dep,
Jayanth Othayoth4d779b22021-06-03 05:45:13 -050093 extra_dependencies,
Patrick Williamsd9f0d642021-04-21 15:43:21 -050094]
95
96libpel_lib = static_library(
97 'pel',
98 libpel_sources,
99 'paths.cpp', # paths is separate because it is overridden during test.
100 include_directories: include_directories('../..', '../../gen'),
William A. Kennington III8fd187e2021-07-26 13:36:56 -0700101 cpp_args: extra_args,
Jayanth Othayothebc91be2021-07-27 00:54:31 -0500102 dependencies: [
103 libpel_deps,
104 ]
Patrick Williamsd9f0d642021-04-21 15:43:21 -0500105)
106
107libpel_dep = declare_dependency(
108 include_directories: include_directories('.'),
109 link_with: libpel_lib,
110 dependencies: [
111 libpldm_dep,
112 nlohmann_json,
113 sdbusplus_dep,
114 sdeventplus_dep,
115 pdi_dep,
Jayanth Othayothebc91be2021-07-27 00:54:31 -0500116 phosphor_logging_dep,
Jayanth Othayoth4d779b22021-06-03 05:45:13 -0500117 ]
Patrick Williamsd9f0d642021-04-21 15:43:21 -0500118)
119
120log_manager_ext_deps += [
121 libpel_dep,
122 libpldm_dep,
123 nlohmann_json,
124]
125
126log_manager_ext_sources += files(
127 'entry_points.cpp',
128 'extended_user_data.cpp',
129 'host_notifier.cpp',
130 'manager.cpp',
131 'pldm_interface.cpp',
132 'repository.cpp',
133 'src.cpp',
134 'user_data.cpp',
135)
136
137install_data(
138 'registry/message_registry.json',
139 install_dir: get_option('datadir') / 'phosphor-logging/pels',
140)
141
142peltool_sources = files(
143 'extended_user_data.cpp',
144 'src.cpp',
145 'user_data.cpp',
146 'user_data_json.cpp',
147)
148
149peltool_deps = [
150 CLI11_dep,
William A. Kennington IIIe0538842021-06-11 02:01:58 -0700151 conf_h_dep,
Patrick Williamsd9f0d642021-04-21 15:43:21 -0500152 python_dep,
153]
154
155executable(
156 'peltool',
157 'tools/peltool.cpp',
158 peltool_sources,
159 cpp_args: [ '-DPELTOOL' ],
160 link_args: [ '-lpython' + python_ver ],
161 include_directories: include_directories('../..'),
162 dependencies: [
163 peltool_deps,
164 libpel_dep,
165 ],
166 install: true,
167)