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] 21build_tests = get_option('tests') 22cpp = meson.get_compiler('cpp') 23boost = dependency('boost', required: false) 24if not boost.found() 25 subproject('boost', required: false) 26 boost = declare_dependency( 27 include_directories: 'subprojects/boost_1_71_0', 28 ) 29endif 30if get_option('fru-device') 31 i2c = cpp.find_library('i2c') 32endif 33if cpp.has_header('nlohmann/json.hpp') 34 nlohmann_json = declare_dependency() 35else 36 subproject('nlohmann', required: false) 37 nlohmann_json = declare_dependency( 38 include_directories: [ 39 'subprojects/nlohmann/single_include', 40 'subprojects/nlohmann/single_include/nlohmann', 41 ] 42 ) 43endif 44sdbusplus = dependency('sdbusplus', required: false) 45if not sdbusplus.found() 46 sdbusplus_proj = subproject('sdbusplus', required: true) 47 sdbusplus = sdbusplus_proj.get_variable('sdbusplus_dep') 48endif 49systemd = dependency('systemd') 50systemd_system_unit_dir = systemd.get_pkgconfig_variable( 51 'systemdsystemunitdir', 52 define_variable: ['prefix', get_option('prefix')]) 53packagedir = join_paths( 54 get_option('prefix'), 55 get_option('datadir'), 56 meson.project_name(), 57) 58threads = dependency('threads') 59if cpp.has_header('valijson/validator.hpp') 60 valijson = declare_dependency() 61else 62 subproject('valijson', required: false) 63 valijson = declare_dependency( 64 include_directories: 'subprojects/valijson/include' 65 ) 66endif 67 68install_data('blacklist.json') 69 70configs = [ 71 '1Ux16 Riser.json', 72 '2Ux8 Riser.json', 73 '8X25 HSBP.json', 74 'A2UL16RISER.json', 75 'A2UX8X4RISER.json', 76 'AHW1UM2RISER.json', 77 'ASPOWER_U1A-D10550_PSU.json', 78 'ASPOWER_U1A-D10800_PSU.json', 79 'ASPOWER_U1A-D11200_PSU.json', 80 'ASPOWER_U1A-D11600_PSU.json', 81 'ASPOWER_U1D-D10800_PSU.json', 82 'AXX1P100HSSI_AIC.json', 83 'AXX2PRTHDHD.json', 84 'BNP Baseboard.json', 85 'Delta DPS-750XB PSU.json', 86 'Delta_DPS-1600AB_PSU.json', 87 'Delta_DPS-2000AB_PSU.json', 88 'Everest.json', 89 'F1U12X25 HSBP.json', 90 'F1U4X25 HSBP.json', 91 'F2U12X35 HSBP.json', 92 'F2U8X25 HSBP.json', 93 'FBTP.json', 94 'FBYV2.json', 95 'Flextronics S-1100ADU00-201 PSU.json', 96 'Intel Front Panel.json', 97 'Nisqually.json', 98 'NVME P4000.json', 99 'PCIE SSD Retimer.json', 100 'PSSF132202A.json', 101 'PSSF162205A.json', 102 'PSSF212201A.json', 103 'PSSF222201A.json', 104 'Rainier 2U Chassis.json', 105 'Rainier 4U Chassis.json', 106 'R1000 Chassis.json', 107 'R2000 Chassis.json', 108 'SAS Module.json', 109 'SOLUM_PSSF162202_PSU.json', 110 'STP Baseboard.json', 111 'STP P4000 Chassis.json', 112 'WFT Baseboard.json', 113] 114 115foreach c : configs 116 install_data( 117 join_paths('configurations', c), 118 install_dir: join_paths( 119 packagedir, 120 'configurations', 121 ) 122 ) 123endforeach 124 125schemas = [ 126 'global.json', 127 'legacy.json', 128 'openbmc-dbus.json', 129 'IBM.json', 130 'Intel.json', 131 'Pid.json', 132 'Pid.Zone.json', 133 'Stepwise.json', 134] 135 136foreach s : schemas 137 install_data( 138 join_paths('schemas', s), 139 install_dir: join_paths( 140 packagedir, 141 'configurations', 142 'schemas', 143 ) 144 ) 145endforeach 146 147subdir('service_files') 148subdir('src') 149 150if not build_tests.disabled() 151 gtest = dependency('gtest', main: true, disabler: true, required: false) 152 if not gtest.found() and build_tests.enabled() 153 cmake = import('cmake') 154 gtest_subproject = cmake.subproject('gtest') 155 cm_gtest = gtest_subproject.dependency('gtest') 156 cm_gtest_main = gtest_subproject.dependency('gtest_main') 157 gtest = declare_dependency(dependencies: [cm_gtest, cm_gtest_main, threads]) 158 endif 159 160 test( 161 'test_entity_manager', 162 executable( 163 'test_entity_manager', 164 'test/test_entity-manager.cpp', 165 'src/Utils.cpp', 166 cpp_args: boost_args + ['-DBOOST_ASIO_DISABLE_THREADS'], 167 dependencies: [ 168 boost, 169 gtest, 170 nlohmann_json, 171 sdbusplus, 172 valijson, 173 ], 174 implicit_include_directories: false, 175 include_directories: 'include', 176 ) 177 ) 178endif 179