blob: 1ef833e8795c312a4b8ecd930c35ec2d874b88c3 [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 = []
Jayanth Othayothbf54cbb2021-06-03 04:36:48 -050034
Jayanth Othayothe8bdeea2021-06-03 03:01:16 -050035build_phal = get_option('phal').enabled()
36
37if build_phal
38 extra_sources += [
39 'sbe_ffdc_handler.cpp',
Jayanth Othayoth4d779b22021-06-03 05:45:13 -050040 'fapi_data_process.cpp',
41 ]
42 extra_dependencies += [
43 dependency('libdt-api'),
44 cpp.find_library('pdbg'),
Jayanth Othayothc74c2202021-06-04 06:42:43 -050045 cpp.find_library('ekb'),
Jayanth Othayothe8bdeea2021-06-03 03:01:16 -050046 ]
47 add_project_arguments('-DSBE_FFDC_SUPPORTED', language : ['c','cpp'])
48endif
49
Patrick Williamsd9f0d642021-04-21 15:43:21 -050050libpel_sources = files(
51 'ascii_string.cpp',
52 'bcd_time.cpp',
53 'callout.cpp',
54 'callouts.cpp',
55 'data_interface.cpp',
56 'device_callouts.cpp',
57 'extended_user_header.cpp',
58 'failing_mtms.cpp',
59 'fru_identity.cpp',
60 'generic.cpp',
61 'json_utils.cpp',
62 'log_id.cpp',
63 'mru.cpp',
64 'mtms.cpp',
65 'pce_identity.cpp',
66 'pel.cpp',
67 'pel_rules.cpp',
68 'pel_values.cpp',
69 'private_header.cpp',
70 'registry.cpp',
71 'section_factory.cpp',
72 'service_indicators.cpp',
73 'severity.cpp',
74 'user_header.cpp',
Jayanth Othayothbf54cbb2021-06-03 04:36:48 -050075 'temporary_file.cpp',
Jayanth Othayothe8bdeea2021-06-03 03:01:16 -050076 extra_sources,
Patrick Williamsd9f0d642021-04-21 15:43:21 -050077)
78
79libpel_deps = [
80 libpldm_dep,
81 nlohmann_json,
82 sdbusplus_dep,
83 sdeventplus_dep,
84 pdi_dep,
Jayanth Othayoth4d779b22021-06-03 05:45:13 -050085 extra_dependencies,
Patrick Williamsd9f0d642021-04-21 15:43:21 -050086]
87
88libpel_lib = static_library(
89 'pel',
90 libpel_sources,
91 'paths.cpp', # paths is separate because it is overridden during test.
92 include_directories: include_directories('../..', '../../gen'),
93 dependencies: libpel_deps,
94)
95
96libpel_dep = declare_dependency(
97 include_directories: include_directories('.'),
98 link_with: libpel_lib,
99 dependencies: [
100 libpldm_dep,
101 nlohmann_json,
102 sdbusplus_dep,
103 sdeventplus_dep,
104 pdi_dep,
Jayanth Othayoth4d779b22021-06-03 05:45:13 -0500105 ]
Patrick Williamsd9f0d642021-04-21 15:43:21 -0500106)
107
108log_manager_ext_deps += [
109 libpel_dep,
110 libpldm_dep,
111 nlohmann_json,
112]
113
114log_manager_ext_sources += files(
115 'entry_points.cpp',
116 'extended_user_data.cpp',
117 'host_notifier.cpp',
118 'manager.cpp',
119 'pldm_interface.cpp',
120 'repository.cpp',
121 'src.cpp',
122 'user_data.cpp',
123)
124
125install_data(
126 'registry/message_registry.json',
127 install_dir: get_option('datadir') / 'phosphor-logging/pels',
128)
129
130peltool_sources = files(
131 'extended_user_data.cpp',
132 'src.cpp',
133 'user_data.cpp',
134 'user_data_json.cpp',
135)
136
137peltool_deps = [
138 CLI11_dep,
139 python_dep,
140]
141
142executable(
143 'peltool',
144 'tools/peltool.cpp',
145 peltool_sources,
146 cpp_args: [ '-DPELTOOL' ],
147 link_args: [ '-lpython' + python_ver ],
148 include_directories: include_directories('../..'),
149 dependencies: [
150 peltool_deps,
151 libpel_dep,
152 ],
153 install: true,
154)