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