blob: 8e1d038e854fa890dbfccfcb350bfbc46f9a6c8a [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 = [
William A. Kennington IIIe0538842021-06-11 02:01:58 -070080 conf_h_dep,
Patrick Williamsd9f0d642021-04-21 15:43:21 -050081 libpldm_dep,
82 nlohmann_json,
83 sdbusplus_dep,
84 sdeventplus_dep,
85 pdi_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'),
94 dependencies: libpel_deps,
95)
96
97libpel_dep = declare_dependency(
98 include_directories: include_directories('.'),
99 link_with: libpel_lib,
100 dependencies: [
101 libpldm_dep,
102 nlohmann_json,
103 sdbusplus_dep,
104 sdeventplus_dep,
105 pdi_dep,
Jayanth Othayoth4d779b22021-06-03 05:45:13 -0500106 ]
Patrick Williamsd9f0d642021-04-21 15:43:21 -0500107)
108
109log_manager_ext_deps += [
110 libpel_dep,
111 libpldm_dep,
112 nlohmann_json,
113]
114
115log_manager_ext_sources += files(
116 'entry_points.cpp',
117 'extended_user_data.cpp',
118 'host_notifier.cpp',
119 'manager.cpp',
120 'pldm_interface.cpp',
121 'repository.cpp',
122 'src.cpp',
123 'user_data.cpp',
124)
125
126install_data(
127 'registry/message_registry.json',
128 install_dir: get_option('datadir') / 'phosphor-logging/pels',
129)
130
131peltool_sources = files(
132 'extended_user_data.cpp',
133 'src.cpp',
134 'user_data.cpp',
135 'user_data_json.cpp',
136)
137
138peltool_deps = [
139 CLI11_dep,
William A. Kennington IIIe0538842021-06-11 02:01:58 -0700140 conf_h_dep,
Patrick Williamsd9f0d642021-04-21 15:43:21 -0500141 python_dep,
142]
143
144executable(
145 'peltool',
146 'tools/peltool.cpp',
147 peltool_sources,
148 cpp_args: [ '-DPELTOOL' ],
149 link_args: [ '-lpython' + python_ver ],
150 include_directories: include_directories('../..'),
151 dependencies: [
152 peltool_deps,
153 libpel_dep,
154 ],
155 install: true,
156)