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 | ee1db76 | 2023-04-12 08:05:58 -0500 | [diff] [blame] | 11 | meson_version: '>=0.58.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 |
Andrew Jeffery | 14a7bc9 | 2021-08-02 10:01:22 +0930 | [diff] [blame] | 36 | |
| 37 | nlohmann_json_dep = dependency('nlohmann_json', |
| 38 | fallback: [ 'nlohmann_json', 'nlohmann_json_dep']) |
| 39 | |
Brad Bishop | 6765d90 | 2020-01-15 12:31:41 -0500 | [diff] [blame] | 40 | sdbusplus = dependency('sdbusplus', required: false) |
| 41 | if not sdbusplus.found() |
Patrick Williams | 7f5a336 | 2020-06-01 09:30:47 -0500 | [diff] [blame] | 42 | sdbusplus_proj = subproject('sdbusplus', required: true) |
| 43 | sdbusplus = sdbusplus_proj.get_variable('sdbusplus_dep') |
Ed Tanous | 07d467b | 2021-02-23 14:48:37 -0800 | [diff] [blame] | 44 | sdbusplus = sdbusplus.as_system('system') |
Brad Bishop | 6765d90 | 2020-01-15 12:31:41 -0500 | [diff] [blame] | 45 | endif |
Brad Bishop | b445991 | 2019-11-05 19:39:11 -0500 | [diff] [blame] | 46 | systemd = dependency('systemd') |
Patrick Williams | ee1db76 | 2023-04-12 08:05:58 -0500 | [diff] [blame] | 47 | systemd_system_unit_dir = systemd.get_variable( |
Brad Bishop | b445991 | 2019-11-05 19:39:11 -0500 | [diff] [blame] | 48 | 'systemdsystemunitdir', |
Patrick Williams | ee1db76 | 2023-04-12 08:05:58 -0500 | [diff] [blame] | 49 | pkgconfig_define: ['prefix', get_option('prefix')]) |
Brad Bishop | b445991 | 2019-11-05 19:39:11 -0500 | [diff] [blame] | 50 | packagedir = join_paths( |
| 51 | get_option('prefix'), |
| 52 | get_option('datadir'), |
| 53 | meson.project_name(), |
| 54 | ) |
Andrew Jeffery | a9c5892 | 2021-06-01 09:28:59 +0930 | [diff] [blame] | 55 | sysconfdir = join_paths( |
| 56 | get_option('prefix'), |
| 57 | get_option('sysconfdir'), |
| 58 | meson.project_name(), |
| 59 | ) |
Brad Bishop | b445991 | 2019-11-05 19:39:11 -0500 | [diff] [blame] | 60 | threads = dependency('threads') |
Ed Tanous | 55ae5a8 | 2021-08-02 14:00:02 -0700 | [diff] [blame] | 61 | if cpp.has_header('valijson/validator.hpp') |
| 62 | valijson = declare_dependency() |
| 63 | else |
| 64 | subproject('valijson', required: false) |
| 65 | valijson = declare_dependency( |
| 66 | include_directories: 'subprojects/valijson/include' |
| 67 | ) |
| 68 | valijson = valijson.as_system('system') |
Brad Bishop | ff1ddb7 | 2020-01-15 12:24:56 -0500 | [diff] [blame] | 69 | endif |
Brad Bishop | b445991 | 2019-11-05 19:39:11 -0500 | [diff] [blame] | 70 | |
| 71 | install_data('blacklist.json') |
| 72 | |
| 73 | configs = [ |
Brad Bishop | f4b2e5a | 2022-05-26 16:17:12 -0400 | [diff] [blame] | 74 | '1ux16_riser.json', |
| 75 | '2ux8_riser.json', |
Ali El-Haj-Mahmoud | ffe7df4 | 2023-05-08 14:27:22 -0400 | [diff] [blame] | 76 | '3ypower_vast2112_psu.json', |
Brad Bishop | f4b2e5a | 2022-05-26 16:17:12 -0400 | [diff] [blame] | 77 | '8x25_hsbp.json', |
| 78 | 'a2ul16riser.json', |
| 79 | 'a2ux8x4riser.json', |
| 80 | 'acbell_rica_psu.json', |
Alexander Hansen | 719432e | 2023-08-01 17:28:59 +0200 | [diff] [blame] | 81 | 'acbel_r1ca2122a_psu.json', |
Brad Bishop | f4b2e5a | 2022-05-26 16:17:12 -0400 | [diff] [blame] | 82 | 'asrock_e3c246d4i.json', |
| 83 | 'asrock_romed8hm3.json', |
Zev Weiss | 544d6ec | 2023-11-07 03:24:33 +0000 | [diff] [blame^] | 84 | 'asrock_spc621d8hm3.json', |
Brad Bishop | f4b2e5a | 2022-05-26 16:17:12 -0400 | [diff] [blame] | 85 | 'bletchley_baseboard.json', |
| 86 | 'bletchley_chassis.json', |
Potin Lai | 546d375 | 2022-11-10 08:57:47 +0800 | [diff] [blame] | 87 | 'bletchley_frontpanel.json', |
Brad Bishop | f4b2e5a | 2022-05-26 16:17:12 -0400 | [diff] [blame] | 88 | 'blyth.json', |
| 89 | 'ahw1um2riser.json', |
| 90 | 'aspower_u1a-d10550_psu.json', |
| 91 | 'aspower_u1a-d10800_psu.json', |
| 92 | 'aspower_u1a-d11200_psu.json', |
| 93 | 'aspower_u1a-d11600_psu.json', |
| 94 | 'aspower_u1d-d10800_psu.json', |
| 95 | 'axx1p100hssi_aic.json', |
| 96 | 'axx2prthdhd.json', |
| 97 | 'bnp_baseboard.json', |
| 98 | 'bellavista.json', |
Adriana Kobylak | 0b5b122 | 2023-01-31 14:15:27 -0600 | [diff] [blame] | 99 | 'bonnell.json', |
Brad Bishop | f4b2e5a | 2022-05-26 16:17:12 -0400 | [diff] [blame] | 100 | 'delta_awf2dc3200w_psu.json', |
| 101 | 'delta_dps-750xb_psu.json', |
| 102 | 'delta_dps-1600ab_psu.json', |
| 103 | 'delta_dps-2000ab_psu.json', |
Marvin Drees | ac7bae3 | 2023-05-10 09:30:35 +0200 | [diff] [blame] | 104 | 'supermicro-pws-920p-sq_psu.json', |
Brad Bishop | f4b2e5a | 2022-05-26 16:17:12 -0400 | [diff] [blame] | 105 | 'everest.json', |
| 106 | 'f1u12x25_hsbp.json', |
| 107 | 'f1u4x25_hsbp.json', |
| 108 | 'f2u12x35_hsbp.json', |
| 109 | 'f2u8x25_hsbp.json', |
| 110 | 'fbtp.json', |
| 111 | 'fbyv2.json', |
Jayashree Dhanapal | 90249e2 | 2022-06-13 15:00:57 +0530 | [diff] [blame] | 112 | 'fbyv35.json', |
Jayashree Dhanapal | 8232a6a | 2022-06-21 15:50:50 +0530 | [diff] [blame] | 113 | 'fbyv35_nic_mellanox.json', |
Brad Bishop | f4b2e5a | 2022-05-26 16:17:12 -0400 | [diff] [blame] | 114 | 'flextronics_s-1100adu00-201_psu.json', |
Naresh Solanki | e3b6582 | 2022-11-02 10:29:38 +0100 | [diff] [blame] | 115 | 'genesis3_psu.json', |
| 116 | 'genesis3_baseboard.json', |
| 117 | 'genesis3_chassis.json', |
Alexander Hansen | f60262d | 2023-07-26 13:28:15 +0200 | [diff] [blame] | 118 | 'gospower_g1136-1300wna_psu.json', |
BonnieLo-wiwynn | cbaec70 | 2022-11-17 15:42:46 +0800 | [diff] [blame] | 119 | 'greatlakes.json', |
| 120 | 'greatlakes_nic_mellanox.json', |
Andrew Geissler | 3a1cbe2 | 2023-02-17 13:57:15 -0600 | [diff] [blame] | 121 | 'ibm_tacoma_rack_controller.json', |
Brad Bishop | f4b2e5a | 2022-05-26 16:17:12 -0400 | [diff] [blame] | 122 | 'intel_front_panel.json', |
| 123 | 'kudo_bmc.json', |
| 124 | 'kudo_motherboard.json', |
Andrew Jeffery | 8f163c0 | 2023-09-19 16:11:01 +0930 | [diff] [blame] | 125 | 'micron_7450.json', |
Jonico Eustaquio | aa9bb3d | 2023-04-18 15:24:24 -0500 | [diff] [blame] | 126 | 'mori_bmc.json', |
Jonico Eustaquio | 8809d71 | 2023-05-03 11:49:00 -0500 | [diff] [blame] | 127 | 'mori_motherboard.json', |
Thang Q. Nguyen | 7986595 | 2023-06-28 09:32:32 +0700 | [diff] [blame] | 128 | 'mtjade.json', |
Chau Ly | e2400c8 | 2022-12-16 04:15:43 +0000 | [diff] [blame] | 129 | 'mtmitchell_bmc.json', |
| 130 | 'mtmitchell_mb.json', |
Andrew Geissler | 4139c3a | 2023-10-12 04:34:33 -0600 | [diff] [blame] | 131 | 'mudflap.json', |
Brad Bishop | f4b2e5a | 2022-05-26 16:17:12 -0400 | [diff] [blame] | 132 | 'nisqually.json', |
| 133 | 'nvme_p4000.json', |
| 134 | 'pcie_ssd_retimer.json', |
Adriana Kobylak | 0b5b122 | 2023-01-31 14:15:27 -0600 | [diff] [blame] | 135 | 'pennybacker.json', |
Brad Bishop | f4b2e5a | 2022-05-26 16:17:12 -0400 | [diff] [blame] | 136 | 'pssf132202a.json', |
| 137 | 'pssf162205a.json', |
| 138 | 'pssf212201a.json', |
| 139 | 'pssf222201a.json', |
| 140 | 'rainier_2u_chassis.json', |
| 141 | 'rainier_4u_chassis.json', |
| 142 | 'rainier_1s4u_chassis.json', |
| 143 | 'r1000_chassis.json', |
| 144 | 'r2000_chassis.json', |
| 145 | 'sas_module.json', |
Naresh Solanki | 6fa508c | 2023-07-31 11:36:15 +0200 | [diff] [blame] | 146 | 'sbp1_baseboard.json', |
| 147 | 'sbp1_chassis.json', |
Patrick Rudolph | e2d550f | 2023-09-11 15:32:38 +0200 | [diff] [blame] | 148 | 'sbp1_nvme.json', |
Naresh Solanki | 6fa508c | 2023-07-31 11:36:15 +0200 | [diff] [blame] | 149 | 'sbp1_psu.json', |
Patrick Rudolph | 2e61474 | 2023-11-10 15:11:51 +0100 | [diff] [blame] | 150 | 'sbp1_rssd.json', |
Andrew Geissler | 35215e9 | 2023-10-02 06:48:05 -0500 | [diff] [blame] | 151 | 'system1_baseboard.json', |
Brad Bishop | f4b2e5a | 2022-05-26 16:17:12 -0400 | [diff] [blame] | 152 | 'solum_pssf162202_psu.json', |
| 153 | 'storm_king.json', |
| 154 | 'stp_baseboard.json', |
| 155 | 'stp_p4000_chassis.json', |
Jayashree Dhanapal | 10612f3 | 2022-11-02 16:12:41 +0530 | [diff] [blame] | 156 | 'twinlake.json', |
Brad Bishop | f4b2e5a | 2022-05-26 16:17:12 -0400 | [diff] [blame] | 157 | 'tyan_s7106_baseboard.json', |
| 158 | 'tyan_s8036_baseboard.json', |
Andrei Kartashev | 9d45552 | 2022-01-11 13:27:29 +0300 | [diff] [blame] | 159 | 'vegman_n110_baseboard.json', |
| 160 | 'vegman_rx20_baseboard.json', |
| 161 | 'vegman_sx20_baseboard.json', |
Brad Bishop | f4b2e5a | 2022-05-26 16:17:12 -0400 | [diff] [blame] | 162 | 'wft_baseboard.json', |
Delphine CC Chiu | df1eac9 | 2023-08-30 18:23:13 +0800 | [diff] [blame] | 163 | 'yosemite4_fanboard.json', |
Delphine CC Chiu | e41b5cb | 2023-11-30 16:13:52 +0800 | [diff] [blame] | 164 | 'yosemite4_sentineldome.json', |
| 165 | 'yosemite4_floatingfalls.json', |
| 166 | 'yosemite4_wailuafalls.json', |
Brad Bishop | b445991 | 2019-11-05 19:39:11 -0500 | [diff] [blame] | 167 | ] |
Ed Tanous | 9dc2cc5 | 2021-12-20 16:05:49 -0800 | [diff] [blame] | 168 | filepaths = [] |
Brad Bishop | b445991 | 2019-11-05 19:39:11 -0500 | [diff] [blame] | 169 | foreach c : configs |
Ed Tanous | 9dc2cc5 | 2021-12-20 16:05:49 -0800 | [diff] [blame] | 170 | file = join_paths('configurations', c) |
Brad Bishop | b445991 | 2019-11-05 19:39:11 -0500 | [diff] [blame] | 171 | install_data( |
Ed Tanous | 9dc2cc5 | 2021-12-20 16:05:49 -0800 | [diff] [blame] | 172 | file, |
Brad Bishop | b445991 | 2019-11-05 19:39:11 -0500 | [diff] [blame] | 173 | install_dir: join_paths( |
| 174 | packagedir, |
| 175 | 'configurations', |
| 176 | ) |
| 177 | ) |
Ed Tanous | 9dc2cc5 | 2021-12-20 16:05:49 -0800 | [diff] [blame] | 178 | filepaths += [file] |
Brad Bishop | b445991 | 2019-11-05 19:39:11 -0500 | [diff] [blame] | 179 | endforeach |
| 180 | |
Brad Bishop | bfc7296 | 2022-05-26 16:33:00 -0400 | [diff] [blame] | 181 | validate_script = files('scripts/validate_configs.py') |
Ed Tanous | 9dc2cc5 | 2021-12-20 16:05:49 -0800 | [diff] [blame] | 182 | autojson = custom_target( |
| 183 | 'check_syntax', |
| 184 | command: [ |
| 185 | validate_script, |
| 186 | '-v', |
| 187 | '-k', |
| 188 | ], |
| 189 | depend_files: files(filepaths), |
| 190 | build_by_default: true, |
| 191 | capture: true, |
| 192 | output: 'validate_configs.log', |
| 193 | ) |
| 194 | |
Brad Bishop | b445991 | 2019-11-05 19:39:11 -0500 | [diff] [blame] | 195 | schemas = [ |
| 196 | 'global.json', |
Brad Bishop | 6666588 | 2020-05-07 17:05:18 -0400 | [diff] [blame] | 197 | 'legacy.json', |
Brad Bishop | b980991 | 2020-05-07 17:15:31 -0400 | [diff] [blame] | 198 | 'openbmc-dbus.json', |
Brad Bishop | 7d05ee5 | 2022-05-26 16:27:48 -0400 | [diff] [blame] | 199 | 'ibm.json', |
| 200 | 'intel.json', |
| 201 | 'pid.json', |
| 202 | 'pid_zone.json', |
| 203 | 'stepwise.json', |
| 204 | 'virtual_sensor.json', |
Andrew Geissler | 48edf9a | 2023-02-21 10:44:14 -0600 | [diff] [blame] | 205 | 'satellite_controller.json', |
Brad Bishop | b445991 | 2019-11-05 19:39:11 -0500 | [diff] [blame] | 206 | ] |
| 207 | |
| 208 | foreach s : schemas |
| 209 | install_data( |
| 210 | join_paths('schemas', s), |
| 211 | install_dir: join_paths( |
| 212 | packagedir, |
| 213 | 'configurations', |
| 214 | 'schemas', |
| 215 | ) |
| 216 | ) |
| 217 | endforeach |
| 218 | |
| 219 | subdir('service_files') |
| 220 | subdir('src') |
Brad Bishop | b9f50cd | 2020-10-14 09:54:58 -0400 | [diff] [blame] | 221 | |
Jason M. Bills | ff58eba | 2020-04-14 16:05:30 -0700 | [diff] [blame] | 222 | if not build_tests.disabled() |
Patrick Venture | a62466c | 2021-02-08 14:55:18 -0800 | [diff] [blame] | 223 | test_boost_args = boost_args + ['-DBOOST_ASIO_DISABLE_THREADS'] |
Brad Bishop | b9f50cd | 2020-10-14 09:54:58 -0400 | [diff] [blame] | 224 | gtest = dependency('gtest', main: true, disabler: true, required: false) |
Benjamin Fair | f2f5b7a | 2022-09-09 19:45:02 +0000 | [diff] [blame] | 225 | gmock = dependency('gmock', disabler: true, required: false) |
| 226 | if not (gtest.found() and gmock.found()) and build_tests.enabled() |
Ed Tanous | 55ae5a8 | 2021-08-02 14:00:02 -0700 | [diff] [blame] | 227 | cmake = import('cmake') |
Brad Bishop | b9f50cd | 2020-10-14 09:54:58 -0400 | [diff] [blame] | 228 | gtest_subproject = cmake.subproject('gtest') |
| 229 | cm_gtest = gtest_subproject.dependency('gtest') |
| 230 | cm_gtest_main = gtest_subproject.dependency('gtest_main') |
| 231 | gtest = declare_dependency(dependencies: [cm_gtest, cm_gtest_main, threads]) |
Benjamin Fair | f2f5b7a | 2022-09-09 19:45:02 +0000 | [diff] [blame] | 232 | gmock = gtest_subproject.dependency('gmock') |
| 233 | |
Brad Bishop | b9f50cd | 2020-10-14 09:54:58 -0400 | [diff] [blame] | 234 | endif |
| 235 | |
| 236 | test( |
| 237 | 'test_entity_manager', |
| 238 | executable( |
| 239 | 'test_entity_manager', |
| 240 | 'test/test_entity-manager.cpp', |
Brad Bishop | e45d8c7 | 2022-05-25 15:12:53 -0400 | [diff] [blame] | 241 | 'src/expression.cpp', |
| 242 | 'src/utils.cpp', |
Patrick Venture | a62466c | 2021-02-08 14:55:18 -0800 | [diff] [blame] | 243 | cpp_args: test_boost_args, |
Brad Bishop | b9f50cd | 2020-10-14 09:54:58 -0400 | [diff] [blame] | 244 | dependencies: [ |
| 245 | boost, |
| 246 | gtest, |
Andrew Jeffery | 14a7bc9 | 2021-08-02 10:01:22 +0930 | [diff] [blame] | 247 | nlohmann_json_dep, |
Brad Bishop | b9f50cd | 2020-10-14 09:54:58 -0400 | [diff] [blame] | 248 | sdbusplus, |
| 249 | valijson, |
| 250 | ], |
Andrew Jeffery | a5d25dc | 2023-01-27 12:28:22 +1030 | [diff] [blame] | 251 | include_directories: 'src', |
Brad Bishop | b9f50cd | 2020-10-14 09:54:58 -0400 | [diff] [blame] | 252 | ) |
| 253 | ) |
Patrick Venture | a62466c | 2021-02-08 14:55:18 -0800 | [diff] [blame] | 254 | |
| 255 | test( |
| 256 | 'test_fru_utils', |
| 257 | executable( |
| 258 | 'test_fru_utils', |
| 259 | 'test/test_fru-utils.cpp', |
Brad Bishop | e45d8c7 | 2022-05-25 15:12:53 -0400 | [diff] [blame] | 260 | 'src/fru_utils.cpp', |
Zev Weiss | 309c0b1 | 2022-02-25 01:44:12 +0000 | [diff] [blame] | 261 | 'src/fru_reader.cpp', |
Patrick Venture | a62466c | 2021-02-08 14:55:18 -0800 | [diff] [blame] | 262 | cpp_args: test_boost_args, |
| 263 | dependencies: [ |
| 264 | boost, |
| 265 | gtest, |
Andrew Jeffery | 5bda182 | 2023-01-27 13:40:21 +1030 | [diff] [blame] | 266 | sdbusplus, |
Patrick Venture | a62466c | 2021-02-08 14:55:18 -0800 | [diff] [blame] | 267 | ], |
Andrew Jeffery | a5d25dc | 2023-01-27 12:28:22 +1030 | [diff] [blame] | 268 | include_directories: 'src', |
Patrick Venture | a62466c | 2021-02-08 14:55:18 -0800 | [diff] [blame] | 269 | ) |
| 270 | ) |
Benjamin Fair | f2f5b7a | 2022-09-09 19:45:02 +0000 | [diff] [blame] | 271 | |
| 272 | test( |
| 273 | 'test_topology', |
| 274 | executable( |
| 275 | 'test_topology', |
| 276 | 'test/test_topology.cpp', |
| 277 | 'src/topology.cpp', |
| 278 | cpp_args: test_boost_args, |
| 279 | dependencies: [ |
| 280 | gtest, |
| 281 | gmock, |
Patrick Williams | af29361 | 2023-04-19 10:27:37 -0500 | [diff] [blame] | 282 | nlohmann_json_dep, |
Benjamin Fair | f2f5b7a | 2022-09-09 19:45:02 +0000 | [diff] [blame] | 283 | ], |
Andrew Jeffery | a5d25dc | 2023-01-27 12:28:22 +1030 | [diff] [blame] | 284 | include_directories: 'src', |
Benjamin Fair | f2f5b7a | 2022-09-09 19:45:02 +0000 | [diff] [blame] | 285 | ) |
| 286 | ) |
Jason M. Bills | ff58eba | 2020-04-14 16:05:30 -0700 | [diff] [blame] | 287 | endif |