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