1libpldm_dep = dependency(
2    'libpldm',
3    default_options: ['oem-ibm=enabled'],
4)
5
6python_inst = import('python').find_installation('python3')
7python_ver = python_inst.language_version()
8python_dep = python_inst.dependency()
9
10extra_sources = []
11extra_dependencies = []
12extra_args = []
13
14build_phal = get_option('phal').allowed()
15
16if build_phal
17    extra_sources += [
18        'sbe_ffdc_handler.cpp',
19        'fapi_data_process.cpp',
20        'phal_service_actions.cpp',
21    ]
22    extra_dependencies += [
23        dependency('libdt-api'),
24        cpp.find_library('pdbg'),
25        cpp.find_library('ekb'),
26        cpp.find_library('phal'),
27        cpp.find_library('libguard'),
28    ]
29    extra_args += [
30        '-DPEL_ENABLE_PHAL',
31    ]
32    log_manager_ext_args += [
33        '-DPEL_ENABLE_PHAL',
34    ]
35endif
36
37libpel_sources = files(
38    'ascii_string.cpp',
39    'bcd_time.cpp',
40    'callout.cpp',
41    'callouts.cpp',
42    'data_interface.cpp',
43    'device_callouts.cpp',
44    'extended_user_header.cpp',
45    'failing_mtms.cpp',
46    'fru_identity.cpp',
47    'generic.cpp',
48    'journal.cpp',
49    'json_utils.cpp',
50    'log_id.cpp',
51    'mru.cpp',
52    'mtms.cpp',
53    'pce_identity.cpp',
54    'pel.cpp',
55    'pel_rules.cpp',
56    'pel_values.cpp',
57    'private_header.cpp',
58    'registry.cpp',
59    'section_factory.cpp',
60    'service_indicators.cpp',
61    'severity.cpp',
62    'user_header.cpp',
63    'temporary_file.cpp',
64    '../../paths.cpp',
65    '../../util.cpp',
66    extra_sources,
67)
68
69libpel_deps = [
70    conf_h_dep,
71    libpldm_dep,
72    nlohmann_json_dep,
73    sdbusplus_dep,
74    sdeventplus_dep,
75    pdi_dep,
76    phosphor_logging_dep,
77    extra_dependencies,
78]
79
80libpel_lib = static_library(
81    'pel',
82    libpel_sources,
83    'pel_paths.cpp', # paths is separate because it is overridden during test.
84    include_directories: include_directories('../..', '../../gen'),
85    cpp_args: extra_args,
86    dependencies: [
87        libpel_deps,
88    ]
89)
90
91libpel_dep = declare_dependency(
92    include_directories: include_directories('.'),
93    link_with: libpel_lib,
94    dependencies: [
95        libpldm_dep,
96        nlohmann_json_dep,
97        sdbusplus_dep,
98        sdeventplus_dep,
99        pdi_dep,
100        phosphor_logging_dep,
101    ]
102)
103
104log_manager_ext_deps += [
105    libpel_dep,
106    libpldm_dep,
107    nlohmann_json_dep,
108]
109
110log_manager_ext_sources += files(
111    'entry_points.cpp',
112    'extended_user_data.cpp',
113    'host_notifier.cpp',
114    'manager.cpp',
115    'pel_entry.cpp',
116    'pldm_interface.cpp',
117    'repository.cpp',
118    'src.cpp',
119    'user_data.cpp',
120)
121
122install_data(
123    'registry/message_registry.json',
124    'registry/O_component_ids.json',
125    'registry/B_component_ids.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    conf_h_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)
155