1libpldm_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 32extra_sources = [] 33extra_dependencies = [] 34 35build_phal = get_option('phal').enabled() 36 37if build_phal 38 extra_sources += [ 39 'sbe_ffdc_handler.cpp', 40 'fapi_data_process.cpp', 41 ] 42 extra_dependencies += [ 43 dependency('libdt-api'), 44 cpp.find_library('pdbg'), 45 cpp.find_library('ekb'), 46 ] 47 add_project_arguments('-DSBE_FFDC_SUPPORTED', language : ['c','cpp']) 48endif 49 50libpel_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', 75 'temporary_file.cpp', 76 extra_sources, 77) 78 79libpel_deps = [ 80 conf_h_dep, 81 libpldm_dep, 82 nlohmann_json, 83 sdbusplus_dep, 84 sdeventplus_dep, 85 pdi_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 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, 106 ] 107) 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, 140 conf_h_dep, 141 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) 157