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 'Blyth.json', 83 'AHW1UM2RISER.json', 84 'ASPOWER_U1A-D10550_PSU.json', 85 'ASPOWER_U1A-D10800_PSU.json', 86 'ASPOWER_U1A-D11200_PSU.json', 87 'ASPOWER_U1A-D11600_PSU.json', 88 'ASPOWER_U1D-D10800_PSU.json', 89 'AXX1P100HSSI_AIC.json', 90 'AXX2PRTHDHD.json', 91 'BNP Baseboard.json', 92 'Bellavista.json', 93 'Delta DPS-750XB PSU.json', 94 'Delta_DPS-1600AB_PSU.json', 95 'Delta_DPS-2000AB_PSU.json', 96 'Everest.json', 97 'F1U12X25 HSBP.json', 98 'F1U4X25 HSBP.json', 99 'F2U12X35 HSBP.json', 100 'F2U8X25 HSBP.json', 101 'FBTP.json', 102 'FBYV2.json', 103 'Flextronics S-1100ADU00-201 PSU.json', 104 'IBM 1000W CFFPS.json', 105 'IBM 1400W CFFPS.json', 106 'IBM 1600W CFFPS.json', 107 'IBM 2000W CFFPS.json', 108 'IBM 2300W CFFPS.json', 109 'Intel Front Panel.json', 110 'Kudo_BMC.json', 111 'Kudo_Motherboard.json', 112 'Nisqually.json', 113 'NVME P4000.json', 114 'PCIE SSD Retimer.json', 115 'PSSF132202A.json', 116 'PSSF162205A.json', 117 'PSSF212201A.json', 118 'PSSF222201A.json', 119 'Rainier 2U Chassis.json', 120 'Rainier 4U Chassis.json', 121 'Rainier 1S4U Chassis.json', 122 'R1000 Chassis.json', 123 'R2000 Chassis.json', 124 'SAS Module.json', 125 'SOLUM_PSSF162202_PSU.json', 126 'STP Baseboard.json', 127 'STP P4000 Chassis.json', 128 'Tyan_S7106_Baseboard.json', 129 'WFT Baseboard.json', 130] 131 132foreach c : configs 133 install_data( 134 join_paths('configurations', c), 135 install_dir: join_paths( 136 packagedir, 137 'configurations', 138 ) 139 ) 140endforeach 141 142schemas = [ 143 'global.json', 144 'legacy.json', 145 'openbmc-dbus.json', 146 'IBM.json', 147 'Intel.json', 148 'Pid.json', 149 'Pid.Zone.json', 150 'Stepwise.json', 151 'VirtualSensor.json', 152] 153 154foreach s : schemas 155 install_data( 156 join_paths('schemas', s), 157 install_dir: join_paths( 158 packagedir, 159 'configurations', 160 'schemas', 161 ) 162 ) 163endforeach 164 165subdir('service_files') 166subdir('src') 167 168if not build_tests.disabled() 169 test_boost_args = boost_args + ['-DBOOST_ASIO_DISABLE_THREADS'] 170 gtest = dependency('gtest', main: true, disabler: true, required: false) 171 if not gtest.found() and build_tests.enabled() 172 cmake = import('cmake') 173 gtest_subproject = cmake.subproject('gtest') 174 cm_gtest = gtest_subproject.dependency('gtest') 175 cm_gtest_main = gtest_subproject.dependency('gtest_main') 176 gtest = declare_dependency(dependencies: [cm_gtest, cm_gtest_main, threads]) 177 endif 178 179 test( 180 'test_entity_manager', 181 executable( 182 'test_entity_manager', 183 'test/test_entity-manager.cpp', 184 'src/Utils.cpp', 185 cpp_args: test_boost_args, 186 dependencies: [ 187 boost, 188 gtest, 189 nlohmann_json, 190 sdbusplus, 191 valijson, 192 ], 193 implicit_include_directories: false, 194 include_directories: 'include', 195 ) 196 ) 197 198 test( 199 'test_fru_utils', 200 executable( 201 'test_fru_utils', 202 'test/test_fru-utils.cpp', 203 'src/FruUtils.cpp', 204 cpp_args: test_boost_args, 205 dependencies: [ 206 boost, 207 gtest, 208 ], 209 implicit_include_directories: false, 210 include_directories: 'include', 211 ) 212 ) 213endif 214