1project( 2 'entity-manager', 3 'cpp', 4 default_options: [ 5 'warning_level=3', 6 'werror=true', 7 'cpp_std=c++23' 8 ], 9 license: 'Apache-2.0', 10 version: '0.1', 11 meson_version: '>=1.1.1', 12) 13add_project_arguments('-Wno-psabi', language: 'cpp') 14 15boost_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', 21 '-DBOOST_ALLOW_DEPRECATED_HEADERS' 22] 23build_tests = get_option('tests') 24cpp = meson.get_compiler('cpp') 25boost = dependency('boost', required: false) 26if not boost.found() 27 subproject('boost', required: false) 28 boost = declare_dependency( 29 include_directories: 'subprojects/boost_1_71_0', 30 ) 31 boost = boost.as_system('system') 32endif 33if get_option('fru-device') 34 i2c = cpp.find_library('i2c') 35endif 36 37nlohmann_json_dep = dependency('nlohmann_json', include_type: 'system') 38sdbusplus = dependency('sdbusplus', include_type: 'system') 39phosphor_logging_dep = dependency('phosphor-logging') 40 41systemd = dependency('systemd') 42systemd_system_unit_dir = systemd.get_variable( 43 'systemdsystemunitdir', 44 pkgconfig_define: ['prefix', get_option('prefix')]) 45packagedir = join_paths( 46 get_option('prefix'), 47 get_option('datadir'), 48 meson.project_name(), 49) 50sysconfdir = join_paths( 51 get_option('prefix'), 52 get_option('sysconfdir'), 53 meson.project_name(), 54) 55threads = dependency('threads') 56if cpp.has_header('valijson/validator.hpp') 57 valijson = declare_dependency() 58else 59 subproject('valijson', required: false) 60 valijson = declare_dependency( 61 include_directories: 'subprojects/valijson/include' 62 ) 63 valijson = valijson.as_system('system') 64endif 65 66install_data('blacklist.json') 67 68configs = [ 69 '1ux16_riser.json', 70 '2ux8_riser.json', 71 '3ypower_vast2112_psu.json', 72 '8x25_hsbp.json', 73 'a2ul16riser.json', 74 'a2ux8x4riser.json', 75 'acbel_r1ca2122a_psu.json', 76 'acbell_rica_psu.json', 77 'ahw1um2riser.json', 78 'aspower_u1a-d10550_psu.json', 79 'aspower_u1a-d10800_psu.json', 80 'aspower_u1a-d11200_psu.json', 81 'aspower_u1a-d11600_psu.json', 82 'aspower_u1d-d10800_psu.json', 83 'asrock_c3_medium_x86.json', 84 'asrock_e3c246d4i.json', 85 'asrock_e3c256d4i.json', 86 'asrock_m3_small_x86.json', 87 'asrock_n3_xlarge_x86.json', 88 'asrock_romed8hm3.json', 89 'asrock_spc621d8hm3.json', 90 'axx1p100hssi_aic.json', 91 'axx2prthdhd.json', 92 'bellavista.json', 93 'bletchley_baseboard.json', 94 'bletchley_chassis.json', 95 'bletchley_frontpanel.json', 96 'blueridge_1s4u_chassis.json', 97 'blueridge_2u_chassis.json', 98 'blueridge_4u_chassis.json', 99 'blyth.json', 100 'bmc_storage_module.json', 101 'bnp_baseboard.json', 102 'bonnell.json', 103 'brcm_100g_1p_ocp_mezz.json', 104 'brcm_200g_1p_ocp_mezz.json', 105 'catalina_fio.json', 106 'catalina_hdd.json', 107 'catalina_osfp.json', 108 'catalina_pdb.json', 109 'catalina_scm.json', 110 'cx7_ocp.json', 111 'delta_awf2dc3200w_psu.json', 112 'delta_dps-1600ab_psu.json', 113 'delta_dps-2000ab_psu.json', 114 'delta_dps-750xb_psu.json', 115 'everest.json', 116 'f1u12x25_hsbp.json', 117 'f1u4x25_hsbp.json', 118 'f2u12x35_hsbp.json', 119 'f2u8x25_hsbp.json', 120 'fbtp.json', 121 'fbyv2.json', 122 'fbyv35.json', 123 'fbyv35_nic_mellanox.json', 124 'flextronics_s-1100adu00-201_psu.json', 125 'fp5280g3_chassis.json', 126 'fp5280g3_fanboard.json', 127 'fuji.json', 128 'genesis3_baseboard.json', 129 'genesis3_chassis.json', 130 'genesis3_psu.json', 131 'gospower_g1136-1300wna_psu.json', 132 'greatlakes.json', 133 'greatlakes_nic_mellanox.json', 134 'harma_bsm.json', 135 'harma_fanboard.json', 136 'harma_mb.json', 137 'harma_mb_vr_infineon.json', 138 'harma_scm.json', 139 'ibm_tacoma_rack_controller.json', 140 'ingraham.json', 141 'intel_front_panel.json', 142 'kudo_bmc.json', 143 'kudo_motherboard.json', 144 'micron_7450.json', 145 'minerva_cmm.json', 146 'minerva_cmm_bsm.json', 147 'minerva_cmm_hsc_infineon.json', 148 'minerva_cmm_scm.json', 149 'minerva_fanboard.json', 150 'minerva_pdb.json', 151 'minerva_pdb_hsc_xdp.json', 152 'minerva_pttv.json', 153 'minerva_sitv.json', 154 'mori_bmc.json', 155 'mori_motherboard.json', 156 'mtjade.json', 157 'mtmitchell_bmc.json', 158 'mtmitchell_mb.json', 159 'mudflap.json', 160 'nf5280m7_baseboard.json', 161 'nisqually.json', 162 'nuvoton_npcm8xx_evb.json', 163 'nvme_intel_p_series.json', 164 'nvme_p4500_p5500.json', 165 'pcie_ssd_retimer.json', 166 'pennybacker.json', 167 'pssf132202a.json', 168 'pssf162205a.json', 169 'pssf212201a.json', 170 'pssf222201a.json', 171 'r1000_chassis.json', 172 'r2000_chassis.json', 173 'rainier_1s4u_chassis.json', 174 'rainier_2u_chassis.json', 175 'rainier_4u_chassis.json', 176 'sas_module.json', 177 'sbp1_baseboard.json', 178 'sbp1_chassis.json', 179 'sbp1_hbm.json', 180 'sbp1_nvme.json', 181 'sbp1_psu.json', 182 'sbp1_rssd.json', 183 'solum_pssf162202_psu.json', 184 'storm_king.json', 185 'stp_baseboard.json', 186 'stp_p4000_chassis.json', 187 'supermicro-pws-920p-sq_psu.json', 188 'system1_baseboard.json', 189 'system1_chassis.json', 190 'terminus_2x100g_nic_tsff.json', 191 'tola.json', 192 'twinlake.json', 193 'tyan_s7106_baseboard.json', 194 'tyan_s8036_baseboard.json', 195 'vegman_n110_baseboard.json', 196 'vegman_rx20_baseboard.json', 197 'vegman_sx20_baseboard.json', 198 'wft_baseboard.json', 199 'yosemite4.json', 200 'yosemite4_chassis.json', 201 'yosemite4_fanboard_fsc_max_adc_ti_led_nxp_efuse_max.json', 202 'yosemite4_fanboard_fsc_max_adc_ti_led_nxp_efuse_mps.json', 203 'yosemite4_fanboard_fsc_nct_adc_max_led_ons_efuse_max.json', 204 'yosemite4_fanboard_fsc_nct_adc_max_led_ons_efuse_mps.json', 205 'yosemite4_floatingfalls.json', 206 'yosemite4_medusaboard_adc_rns_12vhsc_adi_48vhsc_inf.json', 207 'yosemite4_medusaboard_adc_rns_12vhsc_mps_48vhsc_adi.json', 208 'yosemite4_medusaboard_adc_rns_12vhsc_mps_48vhsc_inf.json', 209 'yosemite4_medusaboard_adc_rns_hsc_adi.json', 210 'yosemite4_medusaboard_adc_ti_12vhsc_adi_48vhsc_inf.json', 211 'yosemite4_medusaboard_adc_ti_12vhsc_mps_48vhsc_adi.json', 212 'yosemite4_medusaboard_adc_ti_12vhsc_mps_48vhsc_inf.json', 213 'yosemite4_medusaboard_adc_ti_hsc_adi.json', 214 'yosemite4_sentineldome_chassis.json', 215 'yosemite4_sentineldome_t1.json', 216 'yosemite4_sentineldome_t1_retimer.json', 217 'yosemite4_sentineldome_t2.json', 218 'yosemite4_sentineldome_t2_retimer.json', 219 'yosemite4_spiderboard_adc_max_pwr_ti.json', 220 'yosemite4_spiderboard_adc_ti_pwr_ti.json', 221 'yosemite4_wailuafalls.json', 222 'yosemite4n.json', 223] 224filepaths = [] 225foreach c : configs 226 file = join_paths('configurations', c) 227 install_data( 228 file, 229 install_dir: join_paths( 230 packagedir, 231 'configurations', 232 ) 233 ) 234 filepaths += [file] 235endforeach 236 237if get_option('validate-json') 238 validate_script = files('scripts/validate_configs.py') 239 autojson = custom_target( 240 'check_syntax', 241 command: [ 242 validate_script, 243 '-v', 244 '-k', 245 ], 246 depend_files: files(filepaths), 247 build_by_default: true, 248 capture: true, 249 output: 'validate_configs.log', 250 ) 251endif 252 253schemas = [ 254 'global.json', 255 'legacy.json', 256 'openbmc-dbus.json', 257 'ibm.json', 258 'intel.json', 259 'pid.json', 260 'pid_zone.json', 261 'stepwise.json', 262 'virtual_sensor.json', 263 'satellite_controller.json', 264] 265 266foreach s : schemas 267 install_data( 268 join_paths('schemas', s), 269 install_dir: join_paths( 270 packagedir, 271 'configurations', 272 'schemas', 273 ) 274 ) 275endforeach 276 277subdir('service_files') 278subdir('src') 279 280if not build_tests.disabled() 281 test_boost_args = boost_args + ['-DBOOST_ASIO_DISABLE_THREADS'] 282 gtest = dependency('gtest', main: true, disabler: true, required: false) 283 gmock = dependency('gmock', disabler: true, required: false) 284 if not (gtest.found() and gmock.found()) and build_tests.enabled() 285 cmake = import('cmake') 286 gtest_subproject = cmake.subproject('gtest') 287 cm_gtest = gtest_subproject.dependency('gtest') 288 cm_gtest_main = gtest_subproject.dependency('gtest_main') 289 gtest = declare_dependency(dependencies: [cm_gtest, cm_gtest_main, threads]) 290 gmock = gtest_subproject.dependency('gmock') 291 292 endif 293 294 test( 295 'test_entity_manager', 296 executable( 297 'test_entity_manager', 298 'test/test_entity-manager.cpp', 299 'src/expression.cpp', 300 'src/utils.cpp', 301 cpp_args: test_boost_args, 302 dependencies: [ 303 boost, 304 gtest, 305 nlohmann_json_dep, 306 phosphor_logging_dep, 307 sdbusplus, 308 valijson, 309 ], 310 include_directories: 'src', 311 ) 312 ) 313 314 test( 315 'test_fru_utils', 316 executable( 317 'test_fru_utils', 318 'test/test_fru-utils.cpp', 319 'src/fru_utils.cpp', 320 'src/fru_reader.cpp', 321 cpp_args: test_boost_args, 322 dependencies: [ 323 boost, 324 gtest, 325 phosphor_logging_dep, 326 sdbusplus, 327 ], 328 include_directories: 'src', 329 ) 330 ) 331 332 test( 333 'test_topology', 334 executable( 335 'test_topology', 336 'test/test_topology.cpp', 337 'src/topology.cpp', 338 cpp_args: test_boost_args, 339 dependencies: [ 340 gtest, 341 gmock, 342 nlohmann_json_dep, 343 phosphor_logging_dep, 344 ], 345 include_directories: 'src', 346 ) 347 ) 348endif 349