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 'Nisqually.json', 111 'NVME P4000.json', 112 'PCIE SSD Retimer.json', 113 'PSSF132202A.json', 114 'PSSF162205A.json', 115 'PSSF212201A.json', 116 'PSSF222201A.json', 117 'Rainier 2U Chassis.json', 118 'Rainier 4U Chassis.json', 119 'Rainier 1S4U Chassis.json', 120 'R1000 Chassis.json', 121 'R2000 Chassis.json', 122 'SAS Module.json', 123 'SOLUM_PSSF162202_PSU.json', 124 'STP Baseboard.json', 125 'STP P4000 Chassis.json', 126 'Tyan_S7106_Baseboard.json', 127 'WFT Baseboard.json', 128] 129 130foreach c : configs 131 install_data( 132 join_paths('configurations', c), 133 install_dir: join_paths( 134 packagedir, 135 'configurations', 136 ) 137 ) 138endforeach 139 140schemas = [ 141 'global.json', 142 'legacy.json', 143 'openbmc-dbus.json', 144 'IBM.json', 145 'Intel.json', 146 'Pid.json', 147 'Pid.Zone.json', 148 'Stepwise.json', 149] 150 151foreach s : schemas 152 install_data( 153 join_paths('schemas', s), 154 install_dir: join_paths( 155 packagedir, 156 'configurations', 157 'schemas', 158 ) 159 ) 160endforeach 161 162subdir('service_files') 163subdir('src') 164 165if not build_tests.disabled() 166 test_boost_args = boost_args + ['-DBOOST_ASIO_DISABLE_THREADS'] 167 gtest = dependency('gtest', main: true, disabler: true, required: false) 168 if not gtest.found() and build_tests.enabled() 169 cmake = import('cmake') 170 gtest_subproject = cmake.subproject('gtest') 171 cm_gtest = gtest_subproject.dependency('gtest') 172 cm_gtest_main = gtest_subproject.dependency('gtest_main') 173 gtest = declare_dependency(dependencies: [cm_gtest, cm_gtest_main, threads]) 174 endif 175 176 test( 177 'test_entity_manager', 178 executable( 179 'test_entity_manager', 180 'test/test_entity-manager.cpp', 181 'src/Utils.cpp', 182 cpp_args: test_boost_args, 183 dependencies: [ 184 boost, 185 gtest, 186 nlohmann_json, 187 sdbusplus, 188 valijson, 189 ], 190 implicit_include_directories: false, 191 include_directories: 'include', 192 ) 193 ) 194 195 test( 196 'test_fru_utils', 197 executable( 198 'test_fru_utils', 199 'test/test_fru-utils.cpp', 200 'src/FruUtils.cpp', 201 cpp_args: test_boost_args, 202 dependencies: [ 203 boost, 204 gtest, 205 ], 206 implicit_include_directories: false, 207 include_directories: 'include', 208 ) 209 ) 210endif 211