blob: bc584271d7084ca5980175cb4140b1edb04f01e2 [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 Othayothe8bdeea2021-06-03 03:01:16 -050045 ]
46 add_project_arguments('-DSBE_FFDC_SUPPORTED', language : ['c','cpp'])
47endif
48
Patrick Williamsd9f0d642021-04-21 15:43:21 -050049libpel_sources = files(
50 'ascii_string.cpp',
51 'bcd_time.cpp',
52 'callout.cpp',
53 'callouts.cpp',
54 'data_interface.cpp',
55 'device_callouts.cpp',
56 'extended_user_header.cpp',
57 'failing_mtms.cpp',
58 'fru_identity.cpp',
59 'generic.cpp',
60 '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 = [
79 libpldm_dep,
80 nlohmann_json,
81 sdbusplus_dep,
82 sdeventplus_dep,
83 pdi_dep,
Jayanth Othayoth4d779b22021-06-03 05:45:13 -050084 extra_dependencies,
Patrick Williamsd9f0d642021-04-21 15:43:21 -050085]
86
87libpel_lib = static_library(
88 'pel',
89 libpel_sources,
90 'paths.cpp', # paths is separate because it is overridden during test.
91 include_directories: include_directories('../..', '../../gen'),
92 dependencies: libpel_deps,
93)
94
95libpel_dep = declare_dependency(
96 include_directories: include_directories('.'),
97 link_with: libpel_lib,
98 dependencies: [
99 libpldm_dep,
100 nlohmann_json,
101 sdbusplus_dep,
102 sdeventplus_dep,
103 pdi_dep,
Jayanth Othayoth4d779b22021-06-03 05:45:13 -0500104 ]
Patrick Williamsd9f0d642021-04-21 15:43:21 -0500105)
106
107log_manager_ext_deps += [
108 libpel_dep,
109 libpldm_dep,
110 nlohmann_json,
111]
112
113log_manager_ext_sources += files(
114 'entry_points.cpp',
115 'extended_user_data.cpp',
116 'host_notifier.cpp',
117 'manager.cpp',
118 'pldm_interface.cpp',
119 'repository.cpp',
120 'src.cpp',
121 'user_data.cpp',
122)
123
124install_data(
125 'registry/message_registry.json',
126 install_dir: get_option('datadir') / 'phosphor-logging/pels',
127)
128
129peltool_sources = files(
130 'extended_user_data.cpp',
131 'src.cpp',
132 'user_data.cpp',
133 'user_data_json.cpp',
134)
135
136peltool_deps = [
137 CLI11_dep,
138 python_dep,
139]
140
141executable(
142 'peltool',
143 'tools/peltool.cpp',
144 peltool_sources,
145 cpp_args: [ '-DPELTOOL' ],
146 link_args: [ '-lpython' + python_ver ],
147 include_directories: include_directories('../..'),
148 dependencies: [
149 peltool_deps,
150 libpel_dep,
151 ],
152 install: true,
153)