1libpldm_dep = dependency( 2 'libpldm', 3 default_options: ['oem-ibm=enabled'], 4) 5 6if cpp.has_header('nlohmann/json.hpp') 7 nlohmann_json_dep = declare_dependency() 8else 9 nlohmann_json_dep = dependency('nlohmann-json') 10endif 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 19 CLI11_dep = dependency('CLI11') 20endif 21 22extra_sources = [] 23extra_dependencies = [] 24extra_args = [] 25 26build_phal = get_option('phal').enabled() 27 28if build_phal 29 extra_sources += [ 30 'sbe_ffdc_handler.cpp', 31 'fapi_data_process.cpp', 32 'phal_service_actions.cpp', 33 ] 34 extra_dependencies += [ 35 dependency('libdt-api'), 36 cpp.find_library('pdbg'), 37 cpp.find_library('ekb'), 38 cpp.find_library('phal'), 39 ] 40 extra_args += [ 41 '-DPEL_ENABLE_PHAL', 42 ] 43 log_manager_ext_args += [ 44 '-DPEL_ENABLE_PHAL', 45 ] 46endif 47 48libpel_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', 59 'journal.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', 74 'temporary_file.cpp', 75 extra_sources, 76) 77 78libpel_deps = [ 79 conf_h_dep, 80 libpldm_dep, 81 nlohmann_json_dep, 82 sdbusplus_dep, 83 sdeventplus_dep, 84 pdi_dep, 85 phosphor_logging_dep, 86 extra_dependencies, 87] 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 cpp_args: extra_args, 95 dependencies: [ 96 libpel_deps, 97 ] 98) 99 100libpel_dep = declare_dependency( 101 include_directories: include_directories('.'), 102 link_with: libpel_lib, 103 dependencies: [ 104 libpldm_dep, 105 nlohmann_json_dep, 106 sdbusplus_dep, 107 sdeventplus_dep, 108 pdi_dep, 109 phosphor_logging_dep, 110 ] 111) 112 113log_manager_ext_deps += [ 114 libpel_dep, 115 libpldm_dep, 116 nlohmann_json_dep, 117] 118 119log_manager_ext_sources += files( 120 'entry_points.cpp', 121 'extended_user_data.cpp', 122 'host_notifier.cpp', 123 'manager.cpp', 124 'pel_entry.cpp', 125 'pldm_interface.cpp', 126 'repository.cpp', 127 'src.cpp', 128 'user_data.cpp', 129) 130 131install_data( 132 'registry/message_registry.json', 133 'registry/O_component_ids.json', 134 'registry/B_component_ids.json', 135 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, 147 conf_h_dep, 148 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) 164