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 = [] |
Jayanth Othayoth | 4d779b2 | 2021-06-03 05:45:13 -0500 | [diff] [blame] | 33 | extra_dependencies = [] |
William A. Kennington III | 8fd187e | 2021-07-26 13:36:56 -0700 | [diff] [blame] | 34 | extra_args = [] |
Jayanth Othayoth | bf54cbb | 2021-06-03 04:36:48 -0500 | [diff] [blame] | 35 | |
Jayanth Othayoth | e8bdeea | 2021-06-03 03:01:16 -0500 | [diff] [blame] | 36 | build_phal = get_option('phal').enabled() |
| 37 | |
| 38 | if build_phal |
| 39 | extra_sources += [ |
| 40 | 'sbe_ffdc_handler.cpp', |
Jayanth Othayoth | 4d779b2 | 2021-06-03 05:45:13 -0500 | [diff] [blame] | 41 | 'fapi_data_process.cpp', |
| 42 | ] |
| 43 | extra_dependencies += [ |
| 44 | dependency('libdt-api'), |
| 45 | cpp.find_library('pdbg'), |
Jayanth Othayoth | c74c220 | 2021-06-04 06:42:43 -0500 | [diff] [blame] | 46 | cpp.find_library('ekb'), |
Jayanth Othayoth | e8bdeea | 2021-06-03 03:01:16 -0500 | [diff] [blame] | 47 | ] |
William A. Kennington III | 8fd187e | 2021-07-26 13:36:56 -0700 | [diff] [blame] | 48 | extra_args += [ |
| 49 | '-DSBE_FFDC_SUPPORTED', |
| 50 | ] |
| 51 | log_manager_ext_args += [ |
| 52 | '-DSBE_FFDC_SUPPORTED', |
| 53 | ] |
Jayanth Othayoth | e8bdeea | 2021-06-03 03:01:16 -0500 | [diff] [blame] | 54 | endif |
| 55 | |
Patrick Williams | d9f0d64 | 2021-04-21 15:43:21 -0500 | [diff] [blame] | 56 | libpel_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', |
Jayanth Othayoth | bf54cbb | 2021-06-03 04:36:48 -0500 | [diff] [blame] | 81 | 'temporary_file.cpp', |
Jayanth Othayoth | e8bdeea | 2021-06-03 03:01:16 -0500 | [diff] [blame] | 82 | extra_sources, |
Patrick Williams | d9f0d64 | 2021-04-21 15:43:21 -0500 | [diff] [blame] | 83 | ) |
| 84 | |
| 85 | libpel_deps = [ |
William A. Kennington III | e053884 | 2021-06-11 02:01:58 -0700 | [diff] [blame] | 86 | conf_h_dep, |
Patrick Williams | d9f0d64 | 2021-04-21 15:43:21 -0500 | [diff] [blame] | 87 | libpldm_dep, |
| 88 | nlohmann_json, |
| 89 | sdbusplus_dep, |
| 90 | sdeventplus_dep, |
| 91 | pdi_dep, |
Jayanth Othayoth | ebc91be | 2021-07-27 00:54:31 -0500 | [diff] [blame] | 92 | phosphor_logging_dep, |
Jayanth Othayoth | 4d779b2 | 2021-06-03 05:45:13 -0500 | [diff] [blame] | 93 | extra_dependencies, |
Patrick Williams | d9f0d64 | 2021-04-21 15:43:21 -0500 | [diff] [blame] | 94 | ] |
| 95 | |
| 96 | libpel_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'), |
William A. Kennington III | 8fd187e | 2021-07-26 13:36:56 -0700 | [diff] [blame] | 101 | cpp_args: extra_args, |
Jayanth Othayoth | ebc91be | 2021-07-27 00:54:31 -0500 | [diff] [blame] | 102 | dependencies: [ |
| 103 | libpel_deps, |
| 104 | ] |
Patrick Williams | d9f0d64 | 2021-04-21 15:43:21 -0500 | [diff] [blame] | 105 | ) |
| 106 | |
| 107 | libpel_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, |
Jayanth Othayoth | ebc91be | 2021-07-27 00:54:31 -0500 | [diff] [blame] | 116 | phosphor_logging_dep, |
Jayanth Othayoth | 4d779b2 | 2021-06-03 05:45:13 -0500 | [diff] [blame] | 117 | ] |
Patrick Williams | d9f0d64 | 2021-04-21 15:43:21 -0500 | [diff] [blame] | 118 | ) |
| 119 | |
| 120 | log_manager_ext_deps += [ |
| 121 | libpel_dep, |
| 122 | libpldm_dep, |
| 123 | nlohmann_json, |
| 124 | ] |
| 125 | |
| 126 | log_manager_ext_sources += files( |
| 127 | 'entry_points.cpp', |
| 128 | 'extended_user_data.cpp', |
| 129 | 'host_notifier.cpp', |
| 130 | 'manager.cpp', |
| 131 | 'pldm_interface.cpp', |
| 132 | 'repository.cpp', |
| 133 | 'src.cpp', |
| 134 | 'user_data.cpp', |
| 135 | ) |
| 136 | |
| 137 | install_data( |
| 138 | 'registry/message_registry.json', |
| 139 | install_dir: get_option('datadir') / 'phosphor-logging/pels', |
| 140 | ) |
| 141 | |
| 142 | peltool_sources = files( |
| 143 | 'extended_user_data.cpp', |
| 144 | 'src.cpp', |
| 145 | 'user_data.cpp', |
| 146 | 'user_data_json.cpp', |
| 147 | ) |
| 148 | |
| 149 | peltool_deps = [ |
| 150 | CLI11_dep, |
William A. Kennington III | e053884 | 2021-06-11 02:01:58 -0700 | [diff] [blame] | 151 | conf_h_dep, |
Patrick Williams | d9f0d64 | 2021-04-21 15:43:21 -0500 | [diff] [blame] | 152 | python_dep, |
| 153 | ] |
| 154 | |
| 155 | executable( |
| 156 | 'peltool', |
| 157 | 'tools/peltool.cpp', |
| 158 | peltool_sources, |
| 159 | cpp_args: [ '-DPELTOOL' ], |
| 160 | link_args: [ '-lpython' + python_ver ], |
| 161 | include_directories: include_directories('../..'), |
| 162 | dependencies: [ |
| 163 | peltool_deps, |
| 164 | libpel_dep, |
| 165 | ], |
| 166 | install: true, |
| 167 | ) |