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 = [] |
Jayanth Othayoth | bf54cbb | 2021-06-03 04:36:48 -0500 | [diff] [blame] | 34 | |
Jayanth Othayoth | e8bdeea | 2021-06-03 03:01:16 -0500 | [diff] [blame] | 35 | build_phal = get_option('phal').enabled() |
| 36 | |
| 37 | if build_phal |
| 38 | extra_sources += [ |
| 39 | 'sbe_ffdc_handler.cpp', |
Jayanth Othayoth | 4d779b2 | 2021-06-03 05:45:13 -0500 | [diff] [blame] | 40 | 'fapi_data_process.cpp', |
| 41 | ] |
| 42 | extra_dependencies += [ |
| 43 | dependency('libdt-api'), |
| 44 | cpp.find_library('pdbg'), |
Jayanth Othayoth | c74c220 | 2021-06-04 06:42:43 -0500 | [diff] [blame] | 45 | cpp.find_library('ekb'), |
Jayanth Othayoth | e8bdeea | 2021-06-03 03:01:16 -0500 | [diff] [blame] | 46 | ] |
| 47 | add_project_arguments('-DSBE_FFDC_SUPPORTED', language : ['c','cpp']) |
| 48 | endif |
| 49 | |
Patrick Williams | d9f0d64 | 2021-04-21 15:43:21 -0500 | [diff] [blame] | 50 | libpel_sources = files( |
| 51 | 'ascii_string.cpp', |
| 52 | 'bcd_time.cpp', |
| 53 | 'callout.cpp', |
| 54 | 'callouts.cpp', |
| 55 | 'data_interface.cpp', |
| 56 | 'device_callouts.cpp', |
| 57 | 'extended_user_header.cpp', |
| 58 | 'failing_mtms.cpp', |
| 59 | 'fru_identity.cpp', |
| 60 | 'generic.cpp', |
| 61 | 'json_utils.cpp', |
| 62 | 'log_id.cpp', |
| 63 | 'mru.cpp', |
| 64 | 'mtms.cpp', |
| 65 | 'pce_identity.cpp', |
| 66 | 'pel.cpp', |
| 67 | 'pel_rules.cpp', |
| 68 | 'pel_values.cpp', |
| 69 | 'private_header.cpp', |
| 70 | 'registry.cpp', |
| 71 | 'section_factory.cpp', |
| 72 | 'service_indicators.cpp', |
| 73 | 'severity.cpp', |
| 74 | 'user_header.cpp', |
Jayanth Othayoth | bf54cbb | 2021-06-03 04:36:48 -0500 | [diff] [blame] | 75 | 'temporary_file.cpp', |
Jayanth Othayoth | e8bdeea | 2021-06-03 03:01:16 -0500 | [diff] [blame] | 76 | extra_sources, |
Patrick Williams | d9f0d64 | 2021-04-21 15:43:21 -0500 | [diff] [blame] | 77 | ) |
| 78 | |
| 79 | libpel_deps = [ |
| 80 | libpldm_dep, |
| 81 | nlohmann_json, |
| 82 | sdbusplus_dep, |
| 83 | sdeventplus_dep, |
| 84 | pdi_dep, |
Jayanth Othayoth | 4d779b2 | 2021-06-03 05:45:13 -0500 | [diff] [blame] | 85 | extra_dependencies, |
Patrick Williams | d9f0d64 | 2021-04-21 15:43:21 -0500 | [diff] [blame] | 86 | ] |
| 87 | |
| 88 | libpel_lib = static_library( |
| 89 | 'pel', |
| 90 | libpel_sources, |
| 91 | 'paths.cpp', # paths is separate because it is overridden during test. |
| 92 | include_directories: include_directories('../..', '../../gen'), |
| 93 | dependencies: libpel_deps, |
| 94 | ) |
| 95 | |
| 96 | libpel_dep = declare_dependency( |
| 97 | include_directories: include_directories('.'), |
| 98 | link_with: libpel_lib, |
| 99 | dependencies: [ |
| 100 | libpldm_dep, |
| 101 | nlohmann_json, |
| 102 | sdbusplus_dep, |
| 103 | sdeventplus_dep, |
| 104 | pdi_dep, |
Jayanth Othayoth | 4d779b2 | 2021-06-03 05:45:13 -0500 | [diff] [blame] | 105 | ] |
Patrick Williams | d9f0d64 | 2021-04-21 15:43:21 -0500 | [diff] [blame] | 106 | ) |
| 107 | |
| 108 | log_manager_ext_deps += [ |
| 109 | libpel_dep, |
| 110 | libpldm_dep, |
| 111 | nlohmann_json, |
| 112 | ] |
| 113 | |
| 114 | log_manager_ext_sources += files( |
| 115 | 'entry_points.cpp', |
| 116 | 'extended_user_data.cpp', |
| 117 | 'host_notifier.cpp', |
| 118 | 'manager.cpp', |
| 119 | 'pldm_interface.cpp', |
| 120 | 'repository.cpp', |
| 121 | 'src.cpp', |
| 122 | 'user_data.cpp', |
| 123 | ) |
| 124 | |
| 125 | install_data( |
| 126 | 'registry/message_registry.json', |
| 127 | install_dir: get_option('datadir') / 'phosphor-logging/pels', |
| 128 | ) |
| 129 | |
| 130 | peltool_sources = files( |
| 131 | 'extended_user_data.cpp', |
| 132 | 'src.cpp', |
| 133 | 'user_data.cpp', |
| 134 | 'user_data_json.cpp', |
| 135 | ) |
| 136 | |
| 137 | peltool_deps = [ |
| 138 | CLI11_dep, |
| 139 | python_dep, |
| 140 | ] |
| 141 | |
| 142 | executable( |
| 143 | 'peltool', |
| 144 | 'tools/peltool.cpp', |
| 145 | peltool_sources, |
| 146 | cpp_args: [ '-DPELTOOL' ], |
| 147 | link_args: [ '-lpython' + python_ver ], |
| 148 | include_directories: include_directories('../..'), |
| 149 | dependencies: [ |
| 150 | peltool_deps, |
| 151 | libpel_dep, |
| 152 | ], |
| 153 | install: true, |
| 154 | ) |