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