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', |
Jayanth Othayoth | da9b583 | 2021-11-05 04:19:43 -0500 | [diff] [blame] | 42 | 'phal_service_actions.cpp', |
Jayanth Othayoth | 4d779b2 | 2021-06-03 05:45:13 -0500 | [diff] [blame] | 43 | ] |
| 44 | extra_dependencies += [ |
| 45 | dependency('libdt-api'), |
| 46 | cpp.find_library('pdbg'), |
Jayanth Othayoth | c74c220 | 2021-06-04 06:42:43 -0500 | [diff] [blame] | 47 | cpp.find_library('ekb'), |
Jayanth Othayoth | 3ef7b60 | 2021-11-09 06:40:38 -0600 | [diff] [blame] | 48 | cpp.find_library('phal'), |
Jayanth Othayoth | e8bdeea | 2021-06-03 03:01:16 -0500 | [diff] [blame] | 49 | ] |
William A. Kennington III | 8fd187e | 2021-07-26 13:36:56 -0700 | [diff] [blame] | 50 | extra_args += [ |
Jayanth Othayoth | 92b2066 | 2021-11-05 00:09:15 -0500 | [diff] [blame] | 51 | '-DPEL_ENABLE_PHAL', |
William A. Kennington III | 8fd187e | 2021-07-26 13:36:56 -0700 | [diff] [blame] | 52 | ] |
| 53 | log_manager_ext_args += [ |
Jayanth Othayoth | 92b2066 | 2021-11-05 00:09:15 -0500 | [diff] [blame] | 54 | '-DPEL_ENABLE_PHAL', |
William A. Kennington III | 8fd187e | 2021-07-26 13:36:56 -0700 | [diff] [blame] | 55 | ] |
Jayanth Othayoth | e8bdeea | 2021-06-03 03:01:16 -0500 | [diff] [blame] | 56 | endif |
| 57 | |
Patrick Williams | d9f0d64 | 2021-04-21 15:43:21 -0500 | [diff] [blame] | 58 | libpel_sources = files( |
| 59 | 'ascii_string.cpp', |
| 60 | 'bcd_time.cpp', |
| 61 | 'callout.cpp', |
| 62 | 'callouts.cpp', |
| 63 | 'data_interface.cpp', |
| 64 | 'device_callouts.cpp', |
| 65 | 'extended_user_header.cpp', |
| 66 | 'failing_mtms.cpp', |
| 67 | 'fru_identity.cpp', |
| 68 | 'generic.cpp', |
| 69 | 'json_utils.cpp', |
| 70 | 'log_id.cpp', |
| 71 | 'mru.cpp', |
| 72 | 'mtms.cpp', |
| 73 | 'pce_identity.cpp', |
| 74 | 'pel.cpp', |
| 75 | 'pel_rules.cpp', |
| 76 | 'pel_values.cpp', |
| 77 | 'private_header.cpp', |
| 78 | 'registry.cpp', |
| 79 | 'section_factory.cpp', |
| 80 | 'service_indicators.cpp', |
| 81 | 'severity.cpp', |
| 82 | 'user_header.cpp', |
Jayanth Othayoth | bf54cbb | 2021-06-03 04:36:48 -0500 | [diff] [blame] | 83 | 'temporary_file.cpp', |
Jayanth Othayoth | e8bdeea | 2021-06-03 03:01:16 -0500 | [diff] [blame] | 84 | extra_sources, |
Patrick Williams | d9f0d64 | 2021-04-21 15:43:21 -0500 | [diff] [blame] | 85 | ) |
| 86 | |
| 87 | libpel_deps = [ |
William A. Kennington III | e053884 | 2021-06-11 02:01:58 -0700 | [diff] [blame] | 88 | conf_h_dep, |
Patrick Williams | d9f0d64 | 2021-04-21 15:43:21 -0500 | [diff] [blame] | 89 | libpldm_dep, |
| 90 | nlohmann_json, |
| 91 | sdbusplus_dep, |
| 92 | sdeventplus_dep, |
| 93 | pdi_dep, |
Jayanth Othayoth | ebc91be | 2021-07-27 00:54:31 -0500 | [diff] [blame] | 94 | phosphor_logging_dep, |
Jayanth Othayoth | 4d779b2 | 2021-06-03 05:45:13 -0500 | [diff] [blame] | 95 | extra_dependencies, |
Patrick Williams | d9f0d64 | 2021-04-21 15:43:21 -0500 | [diff] [blame] | 96 | ] |
| 97 | |
| 98 | libpel_lib = static_library( |
| 99 | 'pel', |
| 100 | libpel_sources, |
| 101 | 'paths.cpp', # paths is separate because it is overridden during test. |
| 102 | include_directories: include_directories('../..', '../../gen'), |
William A. Kennington III | 8fd187e | 2021-07-26 13:36:56 -0700 | [diff] [blame] | 103 | cpp_args: extra_args, |
Jayanth Othayoth | ebc91be | 2021-07-27 00:54:31 -0500 | [diff] [blame] | 104 | dependencies: [ |
| 105 | libpel_deps, |
| 106 | ] |
Patrick Williams | d9f0d64 | 2021-04-21 15:43:21 -0500 | [diff] [blame] | 107 | ) |
| 108 | |
| 109 | libpel_dep = declare_dependency( |
| 110 | include_directories: include_directories('.'), |
| 111 | link_with: libpel_lib, |
| 112 | dependencies: [ |
| 113 | libpldm_dep, |
| 114 | nlohmann_json, |
| 115 | sdbusplus_dep, |
| 116 | sdeventplus_dep, |
| 117 | pdi_dep, |
Jayanth Othayoth | ebc91be | 2021-07-27 00:54:31 -0500 | [diff] [blame] | 118 | phosphor_logging_dep, |
Jayanth Othayoth | 4d779b2 | 2021-06-03 05:45:13 -0500 | [diff] [blame] | 119 | ] |
Patrick Williams | d9f0d64 | 2021-04-21 15:43:21 -0500 | [diff] [blame] | 120 | ) |
| 121 | |
| 122 | log_manager_ext_deps += [ |
| 123 | libpel_dep, |
| 124 | libpldm_dep, |
| 125 | nlohmann_json, |
| 126 | ] |
| 127 | |
| 128 | log_manager_ext_sources += files( |
| 129 | 'entry_points.cpp', |
| 130 | 'extended_user_data.cpp', |
| 131 | 'host_notifier.cpp', |
| 132 | 'manager.cpp', |
Vijay Lobo | 2fb1021 | 2021-08-22 23:24:16 -0500 | [diff] [blame] | 133 | 'pel_entry.cpp', |
Patrick Williams | d9f0d64 | 2021-04-21 15:43:21 -0500 | [diff] [blame] | 134 | 'pldm_interface.cpp', |
| 135 | 'repository.cpp', |
| 136 | 'src.cpp', |
| 137 | 'user_data.cpp', |
| 138 | ) |
| 139 | |
| 140 | install_data( |
| 141 | 'registry/message_registry.json', |
| 142 | install_dir: get_option('datadir') / 'phosphor-logging/pels', |
| 143 | ) |
| 144 | |
| 145 | peltool_sources = files( |
| 146 | 'extended_user_data.cpp', |
| 147 | 'src.cpp', |
| 148 | 'user_data.cpp', |
| 149 | 'user_data_json.cpp', |
| 150 | ) |
| 151 | |
| 152 | peltool_deps = [ |
| 153 | CLI11_dep, |
William A. Kennington III | e053884 | 2021-06-11 02:01:58 -0700 | [diff] [blame] | 154 | conf_h_dep, |
Patrick Williams | d9f0d64 | 2021-04-21 15:43:21 -0500 | [diff] [blame] | 155 | python_dep, |
| 156 | ] |
| 157 | |
| 158 | executable( |
| 159 | 'peltool', |
| 160 | 'tools/peltool.cpp', |
| 161 | peltool_sources, |
| 162 | cpp_args: [ '-DPELTOOL' ], |
| 163 | link_args: [ '-lpython' + python_ver ], |
| 164 | include_directories: include_directories('../..'), |
| 165 | dependencies: [ |
| 166 | peltool_deps, |
| 167 | libpel_dep, |
| 168 | ], |
| 169 | install: true, |
| 170 | ) |