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