1project( 2 'entity-manager', 3 'cpp', 4 default_options: [ 5 'warning_level=3', 6 'werror=true', 7 'cpp_std=c++17' 8 ], 9 license: 'Apache-2.0', 10 version: '0.1', 11) 12add_project_arguments('-Wno-psabi', language: 'cpp') 13 14boost_args = [ 15 '-DBOOST_SYSTEM_NO_DEPRECATED', 16 '-DBOOST_ERROR_CODE_HEADER_ONLY', 17 '-DBOOST_NO_RTTI', 18 '-DBOOST_NO_TYPEID', 19 '-DBOOST_ALL_NO_LIB', 20 '-DBOOST_ALLOW_DEPRECATED_HEADERS' 21] 22build_tests = get_option('tests') 23cpp = meson.get_compiler('cpp') 24boost = dependency('boost', required: false) 25if not boost.found() 26 subproject('boost', required: false) 27 boost = declare_dependency( 28 include_directories: 'subprojects/boost_1_71_0', 29 ) 30 boost = boost.as_system('system') 31endif 32if get_option('fru-device') 33 i2c = cpp.find_library('i2c') 34endif 35if cpp.has_header('nlohmann/json.hpp') 36 nlohmann_json = declare_dependency() 37else 38 subproject('nlohmann', required: false) 39 nlohmann_json = declare_dependency( 40 include_directories: [ 41 'subprojects/nlohmann/single_include', 42 'subprojects/nlohmann/single_include/nlohmann', 43 ] 44 ) 45 nlohmann_json = nlohmann_json.as_system('system') 46endif 47sdbusplus = dependency('sdbusplus', required: false) 48if not sdbusplus.found() 49 sdbusplus_proj = subproject('sdbusplus', required: true) 50 sdbusplus = sdbusplus_proj.get_variable('sdbusplus_dep') 51 sdbusplus = sdbusplus.as_system('system') 52endif 53systemd = dependency('systemd') 54systemd_system_unit_dir = systemd.get_pkgconfig_variable( 55 'systemdsystemunitdir', 56 define_variable: ['prefix', get_option('prefix')]) 57packagedir = join_paths( 58 get_option('prefix'), 59 get_option('datadir'), 60 meson.project_name(), 61) 62threads = dependency('threads') 63if cpp.has_header('valijson/validator.hpp') 64 valijson = declare_dependency() 65else 66 subproject('valijson', required: false) 67 valijson = declare_dependency( 68 include_directories: 'subprojects/valijson/include' 69 ) 70 valijson = valijson.as_system('system') 71endif 72 73install_data('blacklist.json') 74 75configs = [ 76 '1Ux16 Riser.json', 77 '2Ux8 Riser.json', 78 '8X25 HSBP.json', 79 'A2UL16RISER.json', 80 'A2UX8X4RISER.json', 81 'ACBELL_RICA_PSU.json', 82 'ASRock_E3C246D4I.json', 83 'Blyth.json', 84 'AHW1UM2RISER.json', 85 'ASPOWER_U1A-D10550_PSU.json', 86 'ASPOWER_U1A-D10800_PSU.json', 87 'ASPOWER_U1A-D11200_PSU.json', 88 'ASPOWER_U1A-D11600_PSU.json', 89 'ASPOWER_U1D-D10800_PSU.json', 90 'AXX1P100HSSI_AIC.json', 91 'AXX2PRTHDHD.json', 92 'BNP Baseboard.json', 93 'Bellavista.json', 94 'Delta DPS-750XB PSU.json', 95 'Delta_DPS-1600AB_PSU.json', 96 'Delta_DPS-2000AB_PSU.json', 97 'Everest.json', 98 'F1U12X25 HSBP.json', 99 'F1U4X25 HSBP.json', 100 'F2U12X35 HSBP.json', 101 'F2U8X25 HSBP.json', 102 'FBTP.json', 103 'FBYV2.json', 104 'Flextronics S-1100ADU00-201 PSU.json', 105 'IBM 1000W CFFPS.json', 106 'IBM 1400W CFFPS.json', 107 'IBM 1600W CFFPS.json', 108 'IBM 2000W CFFPS.json', 109 'IBM 2300W CFFPS.json', 110 'Intel Front Panel.json', 111 'Kudo_BMC.json', 112 'Kudo_Motherboard.json', 113 'Nisqually.json', 114 'NVME P4000.json', 115 'PCIE SSD Retimer.json', 116 'PSSF132202A.json', 117 'PSSF162205A.json', 118 'PSSF212201A.json', 119 'PSSF222201A.json', 120 'Rainier 2U Chassis.json', 121 'Rainier 4U Chassis.json', 122 'Rainier 1S4U Chassis.json', 123 'R1000 Chassis.json', 124 'R2000 Chassis.json', 125 'SAS Module.json', 126 'SOLUM_PSSF162202_PSU.json', 127 'STP Baseboard.json', 128 'STP P4000 Chassis.json', 129 'Tyan_S7106_Baseboard.json', 130 'WFT Baseboard.json', 131] 132 133foreach c : configs 134 install_data( 135 join_paths('configurations', c), 136 install_dir: join_paths( 137 packagedir, 138 'configurations', 139 ) 140 ) 141endforeach 142 143schemas = [ 144 'global.json', 145 'legacy.json', 146 'openbmc-dbus.json', 147 'IBM.json', 148 'Intel.json', 149 'Pid.json', 150 'Pid.Zone.json', 151 'Stepwise.json', 152 'VirtualSensor.json', 153] 154 155foreach s : schemas 156 install_data( 157 join_paths('schemas', s), 158 install_dir: join_paths( 159 packagedir, 160 'configurations', 161 'schemas', 162 ) 163 ) 164endforeach 165 166subdir('service_files') 167subdir('src') 168 169if not build_tests.disabled() 170 test_boost_args = boost_args + ['-DBOOST_ASIO_DISABLE_THREADS'] 171 gtest = dependency('gtest', main: true, disabler: true, required: false) 172 if not gtest.found() and build_tests.enabled() 173 cmake = import('cmake') 174 gtest_subproject = cmake.subproject('gtest') 175 cm_gtest = gtest_subproject.dependency('gtest') 176 cm_gtest_main = gtest_subproject.dependency('gtest_main') 177 gtest = declare_dependency(dependencies: [cm_gtest, cm_gtest_main, threads]) 178 endif 179 180 test( 181 'test_entity_manager', 182 executable( 183 'test_entity_manager', 184 'test/test_entity-manager.cpp', 185 'src/Utils.cpp', 186 cpp_args: test_boost_args, 187 dependencies: [ 188 boost, 189 gtest, 190 nlohmann_json, 191 sdbusplus, 192 valijson, 193 ], 194 implicit_include_directories: false, 195 include_directories: 'include', 196 ) 197 ) 198 199 test( 200 'test_fru_utils', 201 executable( 202 'test_fru_utils', 203 'test/test_fru-utils.cpp', 204 'src/FruUtils.cpp', 205 cpp_args: test_boost_args, 206 dependencies: [ 207 boost, 208 gtest, 209 ], 210 implicit_include_directories: false, 211 include_directories: 'include', 212 ) 213 ) 214endif 215