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 'cx7_ocp.json', 106 'delta_awf2dc3200w_psu.json', 107 'delta_dps-1600ab_psu.json', 108 'delta_dps-2000ab_psu.json', 109 'delta_dps-750xb_psu.json', 110 'everest.json', 111 'f1u12x25_hsbp.json', 112 'f1u4x25_hsbp.json', 113 'f2u12x35_hsbp.json', 114 'f2u8x25_hsbp.json', 115 'fbtp.json', 116 'fbyv2.json', 117 'fbyv35.json', 118 'fbyv35_nic_mellanox.json', 119 'flextronics_s-1100adu00-201_psu.json', 120 'fp5280g3_chassis.json', 121 'fp5280g3_fanboard.json', 122 'fuji.json', 123 'genesis3_baseboard.json', 124 'genesis3_chassis.json', 125 'genesis3_psu.json', 126 'gospower_g1136-1300wna_psu.json', 127 'greatlakes.json', 128 'greatlakes_nic_mellanox.json', 129 'harma_bsm.json', 130 'harma_fanboard.json', 131 'harma_mb.json', 132 'harma_mb_vr_infineon.json', 133 'harma_scm.json', 134 'ibm_tacoma_rack_controller.json', 135 'ingraham.json', 136 'intel_front_panel.json', 137 'kudo_bmc.json', 138 'kudo_motherboard.json', 139 'micron_7450.json', 140 'minerva_cmm.json', 141 'minerva_cmm_bsm.json', 142 'minerva_cmm_hsc_infineon.json', 143 'minerva_cmm_scm.json', 144 'minerva_fanboard.json', 145 'minerva_pdb.json', 146 'minerva_pdb_hsc_xdp.json', 147 'minerva_pttv.json', 148 'minerva_sitv.json', 149 'mori_bmc.json', 150 'mori_motherboard.json', 151 'mtjade.json', 152 'mtmitchell_bmc.json', 153 'mtmitchell_mb.json', 154 'mudflap.json', 155 'nf5280m7_baseboard.json', 156 'nisqually.json', 157 'nuvoton_npcm8xx_evb.json', 158 'nvme_intel_p_series.json', 159 'nvme_p4500_p5500.json', 160 'pcie_ssd_retimer.json', 161 'pennybacker.json', 162 'pssf132202a.json', 163 'pssf162205a.json', 164 'pssf212201a.json', 165 'pssf222201a.json', 166 'r1000_chassis.json', 167 'r2000_chassis.json', 168 'rainier_1s4u_chassis.json', 169 'rainier_2u_chassis.json', 170 'rainier_4u_chassis.json', 171 'sas_module.json', 172 'sbp1_baseboard.json', 173 'sbp1_chassis.json', 174 'sbp1_hbm.json', 175 'sbp1_nvme.json', 176 'sbp1_psu.json', 177 'sbp1_rssd.json', 178 'solum_pssf162202_psu.json', 179 'storm_king.json', 180 'stp_baseboard.json', 181 'stp_p4000_chassis.json', 182 'supermicro-pws-920p-sq_psu.json', 183 'system1_baseboard.json', 184 'system1_chassis.json', 185 'terminus_2x100g_nic_tsff.json', 186 'tola.json', 187 'twinlake.json', 188 'tyan_s7106_baseboard.json', 189 'tyan_s8036_baseboard.json', 190 'vegman_n110_baseboard.json', 191 'vegman_rx20_baseboard.json', 192 'vegman_sx20_baseboard.json', 193 'wft_baseboard.json', 194 'yosemite4.json', 195 'yosemite4_chassis.json', 196 'yosemite4_fanboard_fsc_max_adc_ti_led_nxp_efuse_max.json', 197 'yosemite4_fanboard_fsc_max_adc_ti_led_nxp_efuse_mps.json', 198 'yosemite4_fanboard_fsc_nct_adc_max_led_ons_efuse_max.json', 199 'yosemite4_fanboard_fsc_nct_adc_max_led_ons_efuse_mps.json', 200 'yosemite4_floatingfalls.json', 201 'yosemite4_medusaboard_adc_rns_12vhsc_adi_48vhsc_inf.json', 202 'yosemite4_medusaboard_adc_rns_12vhsc_mps_48vhsc_adi.json', 203 'yosemite4_medusaboard_adc_rns_12vhsc_mps_48vhsc_inf.json', 204 'yosemite4_medusaboard_adc_rns_hsc_adi.json', 205 'yosemite4_medusaboard_adc_ti_12vhsc_adi_48vhsc_inf.json', 206 'yosemite4_medusaboard_adc_ti_12vhsc_mps_48vhsc_adi.json', 207 'yosemite4_medusaboard_adc_ti_12vhsc_mps_48vhsc_inf.json', 208 'yosemite4_medusaboard_adc_ti_hsc_adi.json', 209 'yosemite4_sentineldome_chassis.json', 210 'yosemite4_sentineldome_t1.json', 211 'yosemite4_sentineldome_t1_retimer.json', 212 'yosemite4_sentineldome_t2.json', 213 'yosemite4_sentineldome_t2_retimer.json', 214 'yosemite4_spiderboard_adc_max_pwr_ti.json', 215 'yosemite4_spiderboard_adc_ti_pwr_ti.json', 216 'yosemite4_wailuafalls.json', 217 'yosemite4n.json', 218] 219filepaths = [] 220foreach c : configs 221 file = join_paths('configurations', c) 222 install_data( 223 file, 224 install_dir: join_paths( 225 packagedir, 226 'configurations', 227 ) 228 ) 229 filepaths += [file] 230endforeach 231 232if get_option('validate-json') 233 validate_script = files('scripts/validate_configs.py') 234 autojson = custom_target( 235 'check_syntax', 236 command: [ 237 validate_script, 238 '-v', 239 '-k', 240 ], 241 depend_files: files(filepaths), 242 build_by_default: true, 243 capture: true, 244 output: 'validate_configs.log', 245 ) 246endif 247 248schemas = [ 249 'global.json', 250 'legacy.json', 251 'openbmc-dbus.json', 252 'ibm.json', 253 'intel.json', 254 'pid.json', 255 'pid_zone.json', 256 'stepwise.json', 257 'virtual_sensor.json', 258 'satellite_controller.json', 259] 260 261foreach s : schemas 262 install_data( 263 join_paths('schemas', s), 264 install_dir: join_paths( 265 packagedir, 266 'configurations', 267 'schemas', 268 ) 269 ) 270endforeach 271 272subdir('service_files') 273subdir('src') 274 275if not build_tests.disabled() 276 test_boost_args = boost_args + ['-DBOOST_ASIO_DISABLE_THREADS'] 277 gtest = dependency('gtest', main: true, disabler: true, required: false) 278 gmock = dependency('gmock', disabler: true, required: false) 279 if not (gtest.found() and gmock.found()) and build_tests.enabled() 280 cmake = import('cmake') 281 gtest_subproject = cmake.subproject('gtest') 282 cm_gtest = gtest_subproject.dependency('gtest') 283 cm_gtest_main = gtest_subproject.dependency('gtest_main') 284 gtest = declare_dependency(dependencies: [cm_gtest, cm_gtest_main, threads]) 285 gmock = gtest_subproject.dependency('gmock') 286 287 endif 288 289 test( 290 'test_entity_manager', 291 executable( 292 'test_entity_manager', 293 'test/test_entity-manager.cpp', 294 'src/expression.cpp', 295 'src/utils.cpp', 296 cpp_args: test_boost_args, 297 dependencies: [ 298 boost, 299 gtest, 300 nlohmann_json_dep, 301 phosphor_logging_dep, 302 sdbusplus, 303 valijson, 304 ], 305 include_directories: 'src', 306 ) 307 ) 308 309 test( 310 'test_fru_utils', 311 executable( 312 'test_fru_utils', 313 'test/test_fru-utils.cpp', 314 'src/fru_utils.cpp', 315 'src/fru_reader.cpp', 316 cpp_args: test_boost_args, 317 dependencies: [ 318 boost, 319 gtest, 320 phosphor_logging_dep, 321 sdbusplus, 322 ], 323 include_directories: 'src', 324 ) 325 ) 326 327 test( 328 'test_topology', 329 executable( 330 'test_topology', 331 'test/test_topology.cpp', 332 'src/topology.cpp', 333 cpp_args: test_boost_args, 334 dependencies: [ 335 gtest, 336 gmock, 337 nlohmann_json_dep, 338 phosphor_logging_dep, 339 ], 340 include_directories: 'src', 341 ) 342 ) 343endif 344