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