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 = [] 34extra_args = [] 35 36build_phal = get_option('phal').enabled() 37 38if build_phal 39 extra_sources += [ 40 'sbe_ffdc_handler.cpp', 41 'fapi_data_process.cpp', 42 ] 43 extra_dependencies += [ 44 dependency('libdt-api'), 45 cpp.find_library('pdbg'), 46 cpp.find_library('ekb'), 47 ] 48 extra_args += [ 49 '-DSBE_FFDC_SUPPORTED', 50 ] 51 log_manager_ext_args += [ 52 '-DSBE_FFDC_SUPPORTED', 53 ] 54endif 55 56libpel_sources = files( 57 'ascii_string.cpp', 58 'bcd_time.cpp', 59 'callout.cpp', 60 'callouts.cpp', 61 'data_interface.cpp', 62 'device_callouts.cpp', 63 'extended_user_header.cpp', 64 'failing_mtms.cpp', 65 'fru_identity.cpp', 66 'generic.cpp', 67 'json_utils.cpp', 68 'log_id.cpp', 69 'mru.cpp', 70 'mtms.cpp', 71 'pce_identity.cpp', 72 'pel.cpp', 73 'pel_rules.cpp', 74 'pel_values.cpp', 75 'private_header.cpp', 76 'registry.cpp', 77 'section_factory.cpp', 78 'service_indicators.cpp', 79 'severity.cpp', 80 'user_header.cpp', 81 'temporary_file.cpp', 82 extra_sources, 83) 84 85libpel_deps = [ 86 conf_h_dep, 87 libpldm_dep, 88 nlohmann_json, 89 sdbusplus_dep, 90 sdeventplus_dep, 91 pdi_dep, 92 phosphor_logging_dep, 93 extra_dependencies, 94] 95 96libpel_lib = static_library( 97 'pel', 98 libpel_sources, 99 'paths.cpp', # paths is separate because it is overridden during test. 100 include_directories: include_directories('../..', '../../gen'), 101 cpp_args: extra_args, 102 dependencies: [ 103 libpel_deps, 104 ] 105) 106 107libpel_dep = declare_dependency( 108 include_directories: include_directories('.'), 109 link_with: libpel_lib, 110 dependencies: [ 111 libpldm_dep, 112 nlohmann_json, 113 sdbusplus_dep, 114 sdeventplus_dep, 115 pdi_dep, 116 phosphor_logging_dep, 117 ] 118) 119 120log_manager_ext_deps += [ 121 libpel_dep, 122 libpldm_dep, 123 nlohmann_json, 124] 125 126log_manager_ext_sources += files( 127 'entry_points.cpp', 128 'extended_user_data.cpp', 129 'host_notifier.cpp', 130 'manager.cpp', 131 'pel_entry.cpp', 132 'pldm_interface.cpp', 133 'repository.cpp', 134 'src.cpp', 135 'user_data.cpp', 136) 137 138install_data( 139 'registry/message_registry.json', 140 install_dir: get_option('datadir') / 'phosphor-logging/pels', 141) 142 143peltool_sources = files( 144 'extended_user_data.cpp', 145 'src.cpp', 146 'user_data.cpp', 147 'user_data_json.cpp', 148) 149 150peltool_deps = [ 151 CLI11_dep, 152 conf_h_dep, 153 python_dep, 154] 155 156executable( 157 'peltool', 158 'tools/peltool.cpp', 159 peltool_sources, 160 cpp_args: [ '-DPELTOOL' ], 161 link_args: [ '-lpython' + python_ver ], 162 include_directories: include_directories('../..'), 163 dependencies: [ 164 peltool_deps, 165 libpel_dep, 166 ], 167 install: true, 168) 169