blob: 1cf983914dc971e82bc30a76db8dec20ac5a652e [file] [log] [blame]
Patrick Williamsd9f0d642021-04-21 15:43:21 -05001libpldm_dep = dependency(
2 'libpldm',
Matt Spinler1a6b3112023-05-05 10:17:08 -05003 default_options: ['oem-ibm=enabled'],
Patrick Williamsd9f0d642021-04-21 15:43:21 -05004)
5
6if cpp.has_header('nlohmann/json.hpp')
Patrick Williamse4a014b2023-07-13 16:32:34 -05007 nlohmann_json_dep = declare_dependency()
Patrick Williamsd9f0d642021-04-21 15:43:21 -05008else
Patrick Williamse4a014b2023-07-13 16:32:34 -05009 nlohmann_json_dep = dependency('nlohmann-json')
Patrick Williamsd9f0d642021-04-21 15:43:21 -050010endif
11
12python_inst = import('python').find_installation('python3')
13python_ver = python_inst.language_version()
14python_dep = python_inst.dependency()
15
16if cpp.has_header('CLI/CLI.hpp')
17 CLI11_dep = declare_dependency()
18else
Patrick Williams62bc9682022-03-21 09:23:11 -050019 CLI11_dep = dependency('CLI11')
Patrick Williamsd9f0d642021-04-21 15:43:21 -050020endif
21
Jayanth Othayothe8bdeea2021-06-03 03:01:16 -050022extra_sources = []
Jayanth Othayoth4d779b22021-06-03 05:45:13 -050023extra_dependencies = []
William A. Kennington III8fd187e2021-07-26 13:36:56 -070024extra_args = []
Jayanth Othayothbf54cbb2021-06-03 04:36:48 -050025
Jayanth Othayothe8bdeea2021-06-03 03:01:16 -050026build_phal = get_option('phal').enabled()
27
28if build_phal
29 extra_sources += [
30 'sbe_ffdc_handler.cpp',
Jayanth Othayoth4d779b22021-06-03 05:45:13 -050031 'fapi_data_process.cpp',
Jayanth Othayothda9b5832021-11-05 04:19:43 -050032 'phal_service_actions.cpp',
Jayanth Othayoth4d779b22021-06-03 05:45:13 -050033 ]
34 extra_dependencies += [
35 dependency('libdt-api'),
36 cpp.find_library('pdbg'),
Jayanth Othayothc74c2202021-06-04 06:42:43 -050037 cpp.find_library('ekb'),
Jayanth Othayoth3ef7b602021-11-09 06:40:38 -060038 cpp.find_library('phal'),
Jayanth Othayothe8bdeea2021-06-03 03:01:16 -050039 ]
William A. Kennington III8fd187e2021-07-26 13:36:56 -070040 extra_args += [
Jayanth Othayoth92b20662021-11-05 00:09:15 -050041 '-DPEL_ENABLE_PHAL',
William A. Kennington III8fd187e2021-07-26 13:36:56 -070042 ]
43 log_manager_ext_args += [
Jayanth Othayoth92b20662021-11-05 00:09:15 -050044 '-DPEL_ENABLE_PHAL',
William A. Kennington III8fd187e2021-07-26 13:36:56 -070045 ]
Jayanth Othayothe8bdeea2021-06-03 03:01:16 -050046endif
47
Patrick Williamsd9f0d642021-04-21 15:43:21 -050048libpel_sources = files(
49 'ascii_string.cpp',
50 'bcd_time.cpp',
51 'callout.cpp',
52 'callouts.cpp',
53 'data_interface.cpp',
54 'device_callouts.cpp',
55 'extended_user_header.cpp',
56 'failing_mtms.cpp',
57 'fru_identity.cpp',
58 'generic.cpp',
Matt Spinlerd96fa602022-12-15 11:11:26 -060059 'journal.cpp',
Patrick Williamsd9f0d642021-04-21 15:43:21 -050060 'json_utils.cpp',
61 'log_id.cpp',
62 'mru.cpp',
63 'mtms.cpp',
64 'pce_identity.cpp',
65 'pel.cpp',
66 'pel_rules.cpp',
67 'pel_values.cpp',
68 'private_header.cpp',
69 'registry.cpp',
70 'section_factory.cpp',
71 'service_indicators.cpp',
72 'severity.cpp',
73 'user_header.cpp',
Jayanth Othayothbf54cbb2021-06-03 04:36:48 -050074 'temporary_file.cpp',
Jayanth Othayothe8bdeea2021-06-03 03:01:16 -050075 extra_sources,
Patrick Williamsd9f0d642021-04-21 15:43:21 -050076)
77
78libpel_deps = [
William A. Kennington IIIe0538842021-06-11 02:01:58 -070079 conf_h_dep,
Patrick Williamsd9f0d642021-04-21 15:43:21 -050080 libpldm_dep,
Patrick Williamse4a014b2023-07-13 16:32:34 -050081 nlohmann_json_dep,
Patrick Williamsd9f0d642021-04-21 15:43:21 -050082 sdbusplus_dep,
83 sdeventplus_dep,
84 pdi_dep,
Jayanth Othayothebc91be2021-07-27 00:54:31 -050085 phosphor_logging_dep,
Jayanth Othayoth4d779b22021-06-03 05:45:13 -050086 extra_dependencies,
Patrick Williamsd9f0d642021-04-21 15:43:21 -050087]
88
89libpel_lib = static_library(
90 'pel',
91 libpel_sources,
92 'paths.cpp', # paths is separate because it is overridden during test.
93 include_directories: include_directories('../..', '../../gen'),
William A. Kennington III8fd187e2021-07-26 13:36:56 -070094 cpp_args: extra_args,
Jayanth Othayothebc91be2021-07-27 00:54:31 -050095 dependencies: [
96 libpel_deps,
97 ]
Patrick Williamsd9f0d642021-04-21 15:43:21 -050098)
99
100libpel_dep = declare_dependency(
101 include_directories: include_directories('.'),
102 link_with: libpel_lib,
103 dependencies: [
104 libpldm_dep,
Patrick Williamse4a014b2023-07-13 16:32:34 -0500105 nlohmann_json_dep,
Patrick Williamsd9f0d642021-04-21 15:43:21 -0500106 sdbusplus_dep,
107 sdeventplus_dep,
108 pdi_dep,
Jayanth Othayothebc91be2021-07-27 00:54:31 -0500109 phosphor_logging_dep,
Jayanth Othayoth4d779b22021-06-03 05:45:13 -0500110 ]
Patrick Williamsd9f0d642021-04-21 15:43:21 -0500111)
112
113log_manager_ext_deps += [
114 libpel_dep,
115 libpldm_dep,
Patrick Williamse4a014b2023-07-13 16:32:34 -0500116 nlohmann_json_dep,
Patrick Williamsd9f0d642021-04-21 15:43:21 -0500117]
118
119log_manager_ext_sources += files(
120 'entry_points.cpp',
121 'extended_user_data.cpp',
122 'host_notifier.cpp',
123 'manager.cpp',
Vijay Lobo2fb10212021-08-22 23:24:16 -0500124 'pel_entry.cpp',
Patrick Williamsd9f0d642021-04-21 15:43:21 -0500125 'pldm_interface.cpp',
126 'repository.cpp',
127 'src.cpp',
128 'user_data.cpp',
129)
130
131install_data(
132 'registry/message_registry.json',
Matt Spinler8e823e12022-05-02 10:24:10 -0500133 'registry/O_component_ids.json',
Matt Spinler2ef9dc92022-05-02 10:58:11 -0500134 'registry/B_component_ids.json',
Patrick Williamsd9f0d642021-04-21 15:43:21 -0500135 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)