Patrick Williams | d9f0d64 | 2021-04-21 15:43:21 -0500 | [diff] [blame] | 1 | libpldm_dep = dependency( |
| 2 | 'libpldm', |
| 3 | fallback: ['pldm', 'libpldm_dep'], |
| 4 | default_options: ['libpldm-only=enabled', 'oem-ibm=enabled'], |
| 5 | ) |
| 6 | |
| 7 | if cpp.has_header('nlohmann/json.hpp') |
| 8 | nlohmann_json = declare_dependency() |
| 9 | else |
| 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 | ) |
| 17 | endif |
| 18 | |
| 19 | python_inst = import('python').find_installation('python3') |
| 20 | python_ver = python_inst.language_version() |
| 21 | python_dep = python_inst.dependency() |
| 22 | |
| 23 | if cpp.has_header('CLI/CLI.hpp') |
| 24 | CLI11_dep = declare_dependency() |
| 25 | else |
| 26 | CLI11_dep = dependency( |
| 27 | 'CLI11', |
| 28 | fallback: [ 'CLI11', 'CLI11_dep' ], |
| 29 | ) |
| 30 | endif |
| 31 | |
Jayanth Othayoth | e8bdeea | 2021-06-03 03:01:16 -0500 | [diff] [blame^] | 32 | extra_sources = [] |
| 33 | build_phal = get_option('phal').enabled() |
| 34 | |
| 35 | if build_phal |
| 36 | extra_sources += [ |
| 37 | 'sbe_ffdc_handler.cpp', |
| 38 | ] |
| 39 | add_project_arguments('-DSBE_FFDC_SUPPORTED', language : ['c','cpp']) |
| 40 | endif |
| 41 | |
Patrick Williams | d9f0d64 | 2021-04-21 15:43:21 -0500 | [diff] [blame] | 42 | libpel_sources = files( |
| 43 | 'ascii_string.cpp', |
| 44 | 'bcd_time.cpp', |
| 45 | 'callout.cpp', |
| 46 | 'callouts.cpp', |
| 47 | 'data_interface.cpp', |
| 48 | 'device_callouts.cpp', |
| 49 | 'extended_user_header.cpp', |
| 50 | 'failing_mtms.cpp', |
| 51 | 'fru_identity.cpp', |
| 52 | 'generic.cpp', |
| 53 | 'json_utils.cpp', |
| 54 | 'log_id.cpp', |
| 55 | 'mru.cpp', |
| 56 | 'mtms.cpp', |
| 57 | 'pce_identity.cpp', |
| 58 | 'pel.cpp', |
| 59 | 'pel_rules.cpp', |
| 60 | 'pel_values.cpp', |
| 61 | 'private_header.cpp', |
| 62 | 'registry.cpp', |
| 63 | 'section_factory.cpp', |
| 64 | 'service_indicators.cpp', |
| 65 | 'severity.cpp', |
| 66 | 'user_header.cpp', |
Jayanth Othayoth | e8bdeea | 2021-06-03 03:01:16 -0500 | [diff] [blame^] | 67 | extra_sources, |
Patrick Williams | d9f0d64 | 2021-04-21 15:43:21 -0500 | [diff] [blame] | 68 | ) |
| 69 | |
| 70 | libpel_deps = [ |
| 71 | libpldm_dep, |
| 72 | nlohmann_json, |
| 73 | sdbusplus_dep, |
| 74 | sdeventplus_dep, |
| 75 | pdi_dep, |
| 76 | ] |
| 77 | |
| 78 | libpel_lib = static_library( |
| 79 | 'pel', |
| 80 | libpel_sources, |
| 81 | 'paths.cpp', # paths is separate because it is overridden during test. |
| 82 | include_directories: include_directories('../..', '../../gen'), |
| 83 | dependencies: libpel_deps, |
| 84 | ) |
| 85 | |
| 86 | libpel_dep = declare_dependency( |
| 87 | include_directories: include_directories('.'), |
| 88 | link_with: libpel_lib, |
| 89 | dependencies: [ |
| 90 | libpldm_dep, |
| 91 | nlohmann_json, |
| 92 | sdbusplus_dep, |
| 93 | sdeventplus_dep, |
| 94 | pdi_dep, |
| 95 | ], |
| 96 | |
| 97 | ) |
| 98 | |
| 99 | log_manager_ext_deps += [ |
| 100 | libpel_dep, |
| 101 | libpldm_dep, |
| 102 | nlohmann_json, |
| 103 | ] |
| 104 | |
| 105 | log_manager_ext_sources += files( |
| 106 | 'entry_points.cpp', |
| 107 | 'extended_user_data.cpp', |
| 108 | 'host_notifier.cpp', |
| 109 | 'manager.cpp', |
| 110 | 'pldm_interface.cpp', |
| 111 | 'repository.cpp', |
| 112 | 'src.cpp', |
| 113 | 'user_data.cpp', |
| 114 | ) |
| 115 | |
| 116 | install_data( |
| 117 | 'registry/message_registry.json', |
| 118 | install_dir: get_option('datadir') / 'phosphor-logging/pels', |
| 119 | ) |
| 120 | |
| 121 | peltool_sources = files( |
| 122 | 'extended_user_data.cpp', |
| 123 | 'src.cpp', |
| 124 | 'user_data.cpp', |
| 125 | 'user_data_json.cpp', |
| 126 | ) |
| 127 | |
| 128 | peltool_deps = [ |
| 129 | CLI11_dep, |
| 130 | python_dep, |
| 131 | ] |
| 132 | |
| 133 | executable( |
| 134 | 'peltool', |
| 135 | 'tools/peltool.cpp', |
| 136 | peltool_sources, |
| 137 | cpp_args: [ '-DPELTOOL' ], |
| 138 | link_args: [ '-lpython' + python_ver ], |
| 139 | include_directories: include_directories('../..'), |
| 140 | dependencies: [ |
| 141 | peltool_deps, |
| 142 | libpel_dep, |
| 143 | ], |
| 144 | install: true, |
| 145 | ) |