| Brad Bishop | b445991 | 2019-11-05 19:39:11 -0500 | [diff] [blame] | 1 | project( | 
|  | 2 | 'entity-manager', | 
|  | 3 | 'cpp', | 
|  | 4 | default_options: [ | 
|  | 5 | 'warning_level=3', | 
|  | 6 | 'werror=true', | 
| Patrick Williams | 22ed428 | 2021-10-06 15:33:01 -0500 | [diff] [blame] | 7 | 'cpp_std=c++20' | 
| Brad Bishop | b445991 | 2019-11-05 19:39:11 -0500 | [diff] [blame] | 8 | ], | 
|  | 9 | license: 'Apache-2.0', | 
|  | 10 | version: '0.1', | 
| Patrick Williams | 22ed428 | 2021-10-06 15:33:01 -0500 | [diff] [blame] | 11 | meson_version: '>=0.57.0', | 
| Brad Bishop | b445991 | 2019-11-05 19:39:11 -0500 | [diff] [blame] | 12 | ) | 
| Brad Bishop | ec98491 | 2020-10-01 10:24:55 -0400 | [diff] [blame] | 13 | add_project_arguments('-Wno-psabi', language: 'cpp') | 
| Brad Bishop | b445991 | 2019-11-05 19:39:11 -0500 | [diff] [blame] | 14 |  | 
|  | 15 | boost_args = [ | 
|  | 16 | '-DBOOST_SYSTEM_NO_DEPRECATED', | 
|  | 17 | '-DBOOST_ERROR_CODE_HEADER_ONLY', | 
|  | 18 | '-DBOOST_NO_RTTI', | 
|  | 19 | '-DBOOST_NO_TYPEID', | 
|  | 20 | '-DBOOST_ALL_NO_LIB', | 
| Ed Tanous | 07d467b | 2021-02-23 14:48:37 -0800 | [diff] [blame] | 21 | '-DBOOST_ALLOW_DEPRECATED_HEADERS' | 
| Brad Bishop | b445991 | 2019-11-05 19:39:11 -0500 | [diff] [blame] | 22 | ] | 
|  | 23 | build_tests = get_option('tests') | 
| Brad Bishop | e3a12b6 | 2020-01-15 11:56:29 -0500 | [diff] [blame] | 24 | cpp = meson.get_compiler('cpp') | 
| Brad Bishop | 787e828 | 2020-01-15 12:16:53 -0500 | [diff] [blame] | 25 | boost = dependency('boost', required: false) | 
|  | 26 | if not boost.found() | 
|  | 27 | subproject('boost', required: false) | 
|  | 28 | boost = declare_dependency( | 
|  | 29 | include_directories: 'subprojects/boost_1_71_0', | 
|  | 30 | ) | 
| Ed Tanous | 07d467b | 2021-02-23 14:48:37 -0800 | [diff] [blame] | 31 | boost = boost.as_system('system') | 
| Brad Bishop | 787e828 | 2020-01-15 12:16:53 -0500 | [diff] [blame] | 32 | endif | 
| Brad Bishop | 92daaaa | 2020-01-20 15:45:01 -0500 | [diff] [blame] | 33 | if get_option('fru-device') | 
|  | 34 | i2c = cpp.find_library('i2c') | 
|  | 35 | endif | 
| Ed Tanous | 55ae5a8 | 2021-08-02 14:00:02 -0700 | [diff] [blame] | 36 | if cpp.has_header('nlohmann/json.hpp') | 
|  | 37 | nlohmann_json = declare_dependency() | 
|  | 38 | else | 
|  | 39 | subproject('nlohmann', required: false) | 
|  | 40 | nlohmann_json = declare_dependency( | 
|  | 41 | include_directories: [ | 
|  | 42 | 'subprojects/nlohmann/single_include', | 
|  | 43 | 'subprojects/nlohmann/single_include/nlohmann', | 
|  | 44 | ] | 
|  | 45 | ) | 
|  | 46 | nlohmann_json = nlohmann_json.as_system('system') | 
|  | 47 | endif | 
| Brad Bishop | 6765d90 | 2020-01-15 12:31:41 -0500 | [diff] [blame] | 48 | sdbusplus = dependency('sdbusplus', required: false) | 
|  | 49 | if not sdbusplus.found() | 
| Patrick Williams | 7f5a336 | 2020-06-01 09:30:47 -0500 | [diff] [blame] | 50 | sdbusplus_proj = subproject('sdbusplus', required: true) | 
|  | 51 | sdbusplus = sdbusplus_proj.get_variable('sdbusplus_dep') | 
| Ed Tanous | 07d467b | 2021-02-23 14:48:37 -0800 | [diff] [blame] | 52 | sdbusplus = sdbusplus.as_system('system') | 
| Brad Bishop | 6765d90 | 2020-01-15 12:31:41 -0500 | [diff] [blame] | 53 | endif | 
| Brad Bishop | b445991 | 2019-11-05 19:39:11 -0500 | [diff] [blame] | 54 | systemd = dependency('systemd') | 
|  | 55 | systemd_system_unit_dir = systemd.get_pkgconfig_variable( | 
|  | 56 | 'systemdsystemunitdir', | 
|  | 57 | define_variable: ['prefix', get_option('prefix')]) | 
|  | 58 | packagedir = join_paths( | 
|  | 59 | get_option('prefix'), | 
|  | 60 | get_option('datadir'), | 
|  | 61 | meson.project_name(), | 
|  | 62 | ) | 
| Andrew Jeffery | a9c5892 | 2021-06-01 09:28:59 +0930 | [diff] [blame] | 63 | sysconfdir = join_paths( | 
|  | 64 | get_option('prefix'), | 
|  | 65 | get_option('sysconfdir'), | 
|  | 66 | meson.project_name(), | 
|  | 67 | ) | 
| Brad Bishop | b445991 | 2019-11-05 19:39:11 -0500 | [diff] [blame] | 68 | threads = dependency('threads') | 
| Ed Tanous | 55ae5a8 | 2021-08-02 14:00:02 -0700 | [diff] [blame] | 69 | if cpp.has_header('valijson/validator.hpp') | 
|  | 70 | valijson = declare_dependency() | 
|  | 71 | else | 
|  | 72 | subproject('valijson', required: false) | 
|  | 73 | valijson = declare_dependency( | 
|  | 74 | include_directories: 'subprojects/valijson/include' | 
|  | 75 | ) | 
|  | 76 | valijson = valijson.as_system('system') | 
| Brad Bishop | ff1ddb7 | 2020-01-15 12:24:56 -0500 | [diff] [blame] | 77 | endif | 
| Brad Bishop | b445991 | 2019-11-05 19:39:11 -0500 | [diff] [blame] | 78 |  | 
|  | 79 | install_data('blacklist.json') | 
|  | 80 |  | 
|  | 81 | configs = [ | 
|  | 82 | '1Ux16 Riser.json', | 
|  | 83 | '2Ux8 Riser.json', | 
|  | 84 | '8X25 HSBP.json', | 
|  | 85 | 'A2UL16RISER.json', | 
|  | 86 | 'A2UX8X4RISER.json', | 
| Vijay Khemka | ab4535d | 2021-03-05 20:46:12 +0000 | [diff] [blame] | 87 | 'ACBELL_RICA_PSU.json', | 
| Zev Weiss | 43e1d7a | 2021-09-08 16:30:39 -0500 | [diff] [blame] | 88 | 'ASRock_E3C246D4I.json', | 
| Zev Weiss | 1f304b4 | 2022-04-01 15:40:28 -0700 | [diff] [blame] | 89 | 'ASRock_ROMED8HM3.json', | 
| Potin Lai | 52f5609 | 2021-12-15 10:35:42 +0800 | [diff] [blame] | 90 | 'Bletchley_Baseboard.json', | 
|  | 91 | 'Bletchley_Chassis.json', | 
| Matt Spinler | c451e8b | 2021-01-20 14:29:15 -0600 | [diff] [blame] | 92 | 'Blyth.json', | 
| Brad Bishop | b445991 | 2019-11-05 19:39:11 -0500 | [diff] [blame] | 93 | 'AHW1UM2RISER.json', | 
| Andrei Kartashev | b32e00d | 2020-09-11 22:40:38 +0300 | [diff] [blame] | 94 | 'ASPOWER_U1A-D10550_PSU.json', | 
|  | 95 | 'ASPOWER_U1A-D10800_PSU.json', | 
|  | 96 | 'ASPOWER_U1A-D11200_PSU.json', | 
|  | 97 | 'ASPOWER_U1A-D11600_PSU.json', | 
|  | 98 | 'ASPOWER_U1D-D10800_PSU.json', | 
| Brad Bishop | b445991 | 2019-11-05 19:39:11 -0500 | [diff] [blame] | 99 | 'AXX1P100HSSI_AIC.json', | 
|  | 100 | 'AXX2PRTHDHD.json', | 
|  | 101 | 'BNP Baseboard.json', | 
| Brandon Wyman | eb8a447 | 2021-01-08 16:05:02 -0600 | [diff] [blame] | 102 | 'Bellavista.json', | 
| Zev Weiss | ee4b636 | 2022-02-14 16:01:27 -0800 | [diff] [blame] | 103 | 'Delta_AWF2DC3200W_PSU.json', | 
| Brad Bishop | b445991 | 2019-11-05 19:39:11 -0500 | [diff] [blame] | 104 | 'Delta DPS-750XB PSU.json', | 
| Andrei Kartashev | b32e00d | 2020-09-11 22:40:38 +0300 | [diff] [blame] | 105 | 'Delta_DPS-1600AB_PSU.json', | 
|  | 106 | 'Delta_DPS-2000AB_PSU.json', | 
| Andrew Geissler | c7c5de7 | 2020-12-16 09:47:21 -0600 | [diff] [blame] | 107 | 'Everest.json', | 
| Brad Bishop | b445991 | 2019-11-05 19:39:11 -0500 | [diff] [blame] | 108 | 'F1U12X25 HSBP.json', | 
|  | 109 | 'F1U4X25 HSBP.json', | 
|  | 110 | 'F2U12X35 HSBP.json', | 
|  | 111 | 'F2U8X25 HSBP.json', | 
|  | 112 | 'FBTP.json', | 
|  | 113 | 'FBYV2.json', | 
|  | 114 | 'Flextronics S-1100ADU00-201 PSU.json', | 
| Adriana Kobylak | 886c1ba | 2021-02-01 14:05:11 -0600 | [diff] [blame] | 115 | 'IBM 1000W CFFPS.json', | 
|  | 116 | 'IBM 1400W CFFPS.json', | 
|  | 117 | 'IBM 1600W CFFPS.json', | 
|  | 118 | 'IBM 2000W CFFPS.json', | 
|  | 119 | 'IBM 2300W CFFPS.json', | 
| Brad Bishop | b445991 | 2019-11-05 19:39:11 -0500 | [diff] [blame] | 120 | 'Intel Front Panel.json', | 
| Mustafa Shehabi | 09929ac | 2021-07-28 17:32:05 -0500 | [diff] [blame] | 121 | 'Kudo_BMC.json', | 
|  | 122 | 'Kudo_Motherboard.json', | 
| Thang Q. Nguyen | f466cce | 2021-11-26 06:08:03 +0000 | [diff] [blame] | 123 | 'Mt_Jade.json', | 
| Brad Bishop | 55237c4 | 2020-10-01 10:08:42 -0400 | [diff] [blame] | 124 | 'Nisqually.json', | 
| Brad Bishop | b445991 | 2019-11-05 19:39:11 -0500 | [diff] [blame] | 125 | 'NVME P4000.json', | 
|  | 126 | 'PCIE SSD Retimer.json', | 
|  | 127 | 'PSSF132202A.json', | 
|  | 128 | 'PSSF162205A.json', | 
|  | 129 | 'PSSF212201A.json', | 
|  | 130 | 'PSSF222201A.json', | 
| Brad Bishop | 5f4a026 | 2020-10-09 08:30:19 -0400 | [diff] [blame] | 131 | 'Rainier 2U Chassis.json', | 
|  | 132 | 'Rainier 4U Chassis.json', | 
| Andrew Geissler | 3e55ec4 | 2021-03-11 14:04:27 -0600 | [diff] [blame] | 133 | 'Rainier 1S4U Chassis.json', | 
| Brad Bishop | b445991 | 2019-11-05 19:39:11 -0500 | [diff] [blame] | 134 | 'R1000 Chassis.json', | 
|  | 135 | 'R2000 Chassis.json', | 
|  | 136 | 'SAS Module.json', | 
|  | 137 | 'SOLUM_PSSF162202_PSU.json', | 
| Bruce Mitchell | 849c07d | 2021-07-01 13:12:37 -0500 | [diff] [blame] | 138 | 'Storm King.json', | 
| Brad Bishop | b445991 | 2019-11-05 19:39:11 -0500 | [diff] [blame] | 139 | 'STP Baseboard.json', | 
|  | 140 | 'STP P4000 Chassis.json', | 
| Vijay Khemka | 93a9326 | 2021-02-04 19:10:29 +0000 | [diff] [blame] | 141 | 'Tyan_S7106_Baseboard.json', | 
| Ali El-Haj-Mahmoud | 32fc0a5 | 2022-02-16 17:02:52 -0500 | [diff] [blame] | 142 | 'Tyan_S8036_Baseboard.json', | 
| Brad Bishop | b445991 | 2019-11-05 19:39:11 -0500 | [diff] [blame] | 143 | 'WFT Baseboard.json', | 
|  | 144 | ] | 
| Ed Tanous | 9dc2cc5 | 2021-12-20 16:05:49 -0800 | [diff] [blame] | 145 | filepaths = [] | 
| Brad Bishop | b445991 | 2019-11-05 19:39:11 -0500 | [diff] [blame] | 146 | foreach c : configs | 
| Ed Tanous | 9dc2cc5 | 2021-12-20 16:05:49 -0800 | [diff] [blame] | 147 | file = join_paths('configurations', c) | 
| Brad Bishop | b445991 | 2019-11-05 19:39:11 -0500 | [diff] [blame] | 148 | install_data( | 
| Ed Tanous | 9dc2cc5 | 2021-12-20 16:05:49 -0800 | [diff] [blame] | 149 | file, | 
| Brad Bishop | b445991 | 2019-11-05 19:39:11 -0500 | [diff] [blame] | 150 | install_dir: join_paths( | 
|  | 151 | packagedir, | 
|  | 152 | 'configurations', | 
|  | 153 | ) | 
|  | 154 | ) | 
| Ed Tanous | 9dc2cc5 | 2021-12-20 16:05:49 -0800 | [diff] [blame] | 155 | filepaths += [file] | 
| Brad Bishop | b445991 | 2019-11-05 19:39:11 -0500 | [diff] [blame] | 156 | endforeach | 
|  | 157 |  | 
| Ed Tanous | 9dc2cc5 | 2021-12-20 16:05:49 -0800 | [diff] [blame] | 158 | validate_script = files('scripts/validate-configs.py') | 
|  | 159 | autojson = custom_target( | 
|  | 160 | 'check_syntax', | 
|  | 161 | command: [ | 
|  | 162 | validate_script, | 
|  | 163 | '-v', | 
|  | 164 | '-k', | 
|  | 165 | ], | 
|  | 166 | depend_files: files(filepaths), | 
|  | 167 | build_by_default: true, | 
|  | 168 | capture: true, | 
|  | 169 | output: 'validate_configs.log', | 
|  | 170 | ) | 
|  | 171 |  | 
| Brad Bishop | b445991 | 2019-11-05 19:39:11 -0500 | [diff] [blame] | 172 | schemas = [ | 
|  | 173 | 'global.json', | 
| Brad Bishop | 6666588 | 2020-05-07 17:05:18 -0400 | [diff] [blame] | 174 | 'legacy.json', | 
| Brad Bishop | b980991 | 2020-05-07 17:15:31 -0400 | [diff] [blame] | 175 | 'openbmc-dbus.json', | 
| Brad Bishop | 4afe708 | 2020-10-01 09:59:26 -0400 | [diff] [blame] | 176 | 'IBM.json', | 
| Brad Bishop | 6fe729d | 2020-10-01 09:54:20 -0400 | [diff] [blame] | 177 | 'Intel.json', | 
| Brad Bishop | b445991 | 2019-11-05 19:39:11 -0500 | [diff] [blame] | 178 | 'Pid.json', | 
|  | 179 | 'Pid.Zone.json', | 
|  | 180 | 'Stepwise.json', | 
| Rashmica Gupta | e23af56 | 2021-07-29 15:12:16 +1000 | [diff] [blame] | 181 | 'VirtualSensor.json', | 
| Brad Bishop | b445991 | 2019-11-05 19:39:11 -0500 | [diff] [blame] | 182 | ] | 
|  | 183 |  | 
|  | 184 | foreach s : schemas | 
|  | 185 | install_data( | 
|  | 186 | join_paths('schemas', s), | 
|  | 187 | install_dir: join_paths( | 
|  | 188 | packagedir, | 
|  | 189 | 'configurations', | 
|  | 190 | 'schemas', | 
|  | 191 | ) | 
|  | 192 | ) | 
|  | 193 | endforeach | 
|  | 194 |  | 
|  | 195 | subdir('service_files') | 
|  | 196 | subdir('src') | 
| Brad Bishop | b9f50cd | 2020-10-14 09:54:58 -0400 | [diff] [blame] | 197 |  | 
| Jason M. Bills | ff58eba | 2020-04-14 16:05:30 -0700 | [diff] [blame] | 198 | if not build_tests.disabled() | 
| Patrick Venture | a62466c | 2021-02-08 14:55:18 -0800 | [diff] [blame] | 199 | test_boost_args = boost_args + ['-DBOOST_ASIO_DISABLE_THREADS'] | 
| Brad Bishop | b9f50cd | 2020-10-14 09:54:58 -0400 | [diff] [blame] | 200 | gtest = dependency('gtest', main: true, disabler: true, required: false) | 
|  | 201 | if not gtest.found() and build_tests.enabled() | 
| Ed Tanous | 55ae5a8 | 2021-08-02 14:00:02 -0700 | [diff] [blame] | 202 | cmake = import('cmake') | 
| Brad Bishop | b9f50cd | 2020-10-14 09:54:58 -0400 | [diff] [blame] | 203 | gtest_subproject = cmake.subproject('gtest') | 
|  | 204 | cm_gtest = gtest_subproject.dependency('gtest') | 
|  | 205 | cm_gtest_main = gtest_subproject.dependency('gtest_main') | 
|  | 206 | gtest = declare_dependency(dependencies: [cm_gtest, cm_gtest_main, threads]) | 
|  | 207 | endif | 
|  | 208 |  | 
|  | 209 | test( | 
|  | 210 | 'test_entity_manager', | 
|  | 211 | executable( | 
|  | 212 | 'test_entity_manager', | 
|  | 213 | 'test/test_entity-manager.cpp', | 
| Andrew Jeffery | a05437e | 2022-04-07 16:17:21 +0930 | [diff] [blame] | 214 | 'src/Expression.cpp', | 
| Brad Bishop | b9f50cd | 2020-10-14 09:54:58 -0400 | [diff] [blame] | 215 | 'src/Utils.cpp', | 
| Patrick Venture | a62466c | 2021-02-08 14:55:18 -0800 | [diff] [blame] | 216 | cpp_args: test_boost_args, | 
| Brad Bishop | b9f50cd | 2020-10-14 09:54:58 -0400 | [diff] [blame] | 217 | dependencies: [ | 
|  | 218 | boost, | 
|  | 219 | gtest, | 
| Ed Tanous | 55ae5a8 | 2021-08-02 14:00:02 -0700 | [diff] [blame] | 220 | nlohmann_json, | 
| Brad Bishop | b9f50cd | 2020-10-14 09:54:58 -0400 | [diff] [blame] | 221 | sdbusplus, | 
|  | 222 | valijson, | 
|  | 223 | ], | 
|  | 224 | implicit_include_directories: false, | 
|  | 225 | include_directories: 'include', | 
|  | 226 | ) | 
|  | 227 | ) | 
| Patrick Venture | a62466c | 2021-02-08 14:55:18 -0800 | [diff] [blame] | 228 |  | 
|  | 229 | test( | 
|  | 230 | 'test_fru_utils', | 
|  | 231 | executable( | 
|  | 232 | 'test_fru_utils', | 
|  | 233 | 'test/test_fru-utils.cpp', | 
|  | 234 | 'src/FruUtils.cpp', | 
|  | 235 | cpp_args: test_boost_args, | 
|  | 236 | dependencies: [ | 
|  | 237 | boost, | 
|  | 238 | gtest, | 
|  | 239 | ], | 
|  | 240 | implicit_include_directories: false, | 
|  | 241 | include_directories: 'include', | 
|  | 242 | ) | 
|  | 243 | ) | 
| Jason M. Bills | ff58eba | 2020-04-14 16:05:30 -0700 | [diff] [blame] | 244 | endif |