Brad Bishop | b445991 | 2019-11-05 19:39:11 -0500 | [diff] [blame] | 1 | project( |
| 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 | ) |
Brad Bishop | ec98491 | 2020-10-01 10:24:55 -0400 | [diff] [blame] | 12 | add_project_arguments('-Wno-psabi', language: 'cpp') |
Brad Bishop | b445991 | 2019-11-05 19:39:11 -0500 | [diff] [blame] | 13 | |
| 14 | boost_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 | ] |
| 21 | build_tests = get_option('tests') |
Brad Bishop | e3a12b6 | 2020-01-15 11:56:29 -0500 | [diff] [blame] | 22 | cpp = meson.get_compiler('cpp') |
Brad Bishop | 787e828 | 2020-01-15 12:16:53 -0500 | [diff] [blame] | 23 | boost = dependency('boost', required: false) |
| 24 | if not boost.found() |
| 25 | subproject('boost', required: false) |
| 26 | boost = declare_dependency( |
| 27 | include_directories: 'subprojects/boost_1_71_0', |
| 28 | ) |
| 29 | endif |
Brad Bishop | 92daaaa | 2020-01-20 15:45:01 -0500 | [diff] [blame] | 30 | if get_option('fru-device') |
| 31 | i2c = cpp.find_library('i2c') |
| 32 | endif |
Brad Bishop | 79a09a8 | 2020-01-15 12:23:07 -0500 | [diff] [blame] | 33 | if cpp.has_header('nlohmann/json.hpp') |
| 34 | nlohmann_json = declare_dependency() |
| 35 | else |
| 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 | ) |
| 43 | endif |
Brad Bishop | 6765d90 | 2020-01-15 12:31:41 -0500 | [diff] [blame] | 44 | sdbusplus = dependency('sdbusplus', required: false) |
| 45 | if not sdbusplus.found() |
Patrick Williams | 7f5a336 | 2020-06-01 09:30:47 -0500 | [diff] [blame] | 46 | sdbusplus_proj = subproject('sdbusplus', required: true) |
| 47 | sdbusplus = sdbusplus_proj.get_variable('sdbusplus_dep') |
Brad Bishop | 6765d90 | 2020-01-15 12:31:41 -0500 | [diff] [blame] | 48 | endif |
Brad Bishop | b445991 | 2019-11-05 19:39:11 -0500 | [diff] [blame] | 49 | systemd = dependency('systemd') |
| 50 | systemd_system_unit_dir = systemd.get_pkgconfig_variable( |
| 51 | 'systemdsystemunitdir', |
| 52 | define_variable: ['prefix', get_option('prefix')]) |
| 53 | packagedir = join_paths( |
| 54 | get_option('prefix'), |
| 55 | get_option('datadir'), |
| 56 | meson.project_name(), |
| 57 | ) |
| 58 | threads = dependency('threads') |
Brad Bishop | ff1ddb7 | 2020-01-15 12:24:56 -0500 | [diff] [blame] | 59 | if cpp.has_header('valijson/validator.hpp') |
| 60 | valijson = declare_dependency() |
| 61 | else |
| 62 | subproject('valijson', required: false) |
| 63 | valijson = declare_dependency( |
| 64 | include_directories: 'subprojects/valijson/include' |
| 65 | ) |
| 66 | endif |
Brad Bishop | b445991 | 2019-11-05 19:39:11 -0500 | [diff] [blame] | 67 | |
| 68 | install_data('blacklist.json') |
| 69 | |
| 70 | configs = [ |
| 71 | '1Ux16 Riser.json', |
| 72 | '2Ux8 Riser.json', |
| 73 | '8X25 HSBP.json', |
| 74 | 'A2UL16RISER.json', |
| 75 | 'A2UX8X4RISER.json', |
| 76 | 'AHW1UM2RISER.json', |
Andrei Kartashev | b32e00d | 2020-09-11 22:40:38 +0300 | [diff] [blame] | 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', |
Brad Bishop | b445991 | 2019-11-05 19:39:11 -0500 | [diff] [blame] | 82 | 'AXX1P100HSSI_AIC.json', |
| 83 | 'AXX2PRTHDHD.json', |
| 84 | 'BNP Baseboard.json', |
| 85 | 'Delta DPS-750XB PSU.json', |
Andrei Kartashev | b32e00d | 2020-09-11 22:40:38 +0300 | [diff] [blame] | 86 | 'Delta_DPS-1600AB_PSU.json', |
| 87 | 'Delta_DPS-2000AB_PSU.json', |
Brad Bishop | b445991 | 2019-11-05 19:39:11 -0500 | [diff] [blame] | 88 | 'F1U12X25 HSBP.json', |
| 89 | 'F1U4X25 HSBP.json', |
| 90 | 'F2U12X35 HSBP.json', |
| 91 | 'F2U8X25 HSBP.json', |
| 92 | 'FBTP.json', |
| 93 | 'FBYV2.json', |
| 94 | 'Flextronics S-1100ADU00-201 PSU.json', |
| 95 | 'Intel Front Panel.json', |
Brad Bishop | 55237c4 | 2020-10-01 10:08:42 -0400 | [diff] [blame] | 96 | 'Nisqually.json', |
Brad Bishop | b445991 | 2019-11-05 19:39:11 -0500 | [diff] [blame] | 97 | 'NVME P4000.json', |
| 98 | 'PCIE SSD Retimer.json', |
| 99 | 'PSSF132202A.json', |
| 100 | 'PSSF162205A.json', |
| 101 | 'PSSF212201A.json', |
| 102 | 'PSSF222201A.json', |
Brad Bishop | 5f4a026 | 2020-10-09 08:30:19 -0400 | [diff] [blame^] | 103 | 'Rainier 2U Chassis.json', |
| 104 | 'Rainier 4U Chassis.json', |
Brad Bishop | b445991 | 2019-11-05 19:39:11 -0500 | [diff] [blame] | 105 | 'R1000 Chassis.json', |
| 106 | 'R2000 Chassis.json', |
| 107 | 'SAS Module.json', |
| 108 | 'SOLUM_PSSF162202_PSU.json', |
| 109 | 'STP Baseboard.json', |
| 110 | 'STP P4000 Chassis.json', |
| 111 | 'WFT Baseboard.json', |
| 112 | ] |
| 113 | |
| 114 | foreach c : configs |
| 115 | install_data( |
| 116 | join_paths('configurations', c), |
| 117 | install_dir: join_paths( |
| 118 | packagedir, |
| 119 | 'configurations', |
| 120 | ) |
| 121 | ) |
| 122 | endforeach |
| 123 | |
| 124 | schemas = [ |
| 125 | 'global.json', |
Brad Bishop | 6666588 | 2020-05-07 17:05:18 -0400 | [diff] [blame] | 126 | 'legacy.json', |
Brad Bishop | b980991 | 2020-05-07 17:15:31 -0400 | [diff] [blame] | 127 | 'openbmc-dbus.json', |
Brad Bishop | 4afe708 | 2020-10-01 09:59:26 -0400 | [diff] [blame] | 128 | 'IBM.json', |
Brad Bishop | 6fe729d | 2020-10-01 09:54:20 -0400 | [diff] [blame] | 129 | 'Intel.json', |
Brad Bishop | b445991 | 2019-11-05 19:39:11 -0500 | [diff] [blame] | 130 | 'Pid.json', |
| 131 | 'Pid.Zone.json', |
| 132 | 'Stepwise.json', |
| 133 | ] |
| 134 | |
| 135 | foreach s : schemas |
| 136 | install_data( |
| 137 | join_paths('schemas', s), |
| 138 | install_dir: join_paths( |
| 139 | packagedir, |
| 140 | 'configurations', |
| 141 | 'schemas', |
| 142 | ) |
| 143 | ) |
| 144 | endforeach |
| 145 | |
| 146 | subdir('service_files') |
| 147 | subdir('src') |
Brad Bishop | b9f50cd | 2020-10-14 09:54:58 -0400 | [diff] [blame] | 148 | |
Jason M. Bills | ff58eba | 2020-04-14 16:05:30 -0700 | [diff] [blame] | 149 | if not build_tests.disabled() |
Brad Bishop | b9f50cd | 2020-10-14 09:54:58 -0400 | [diff] [blame] | 150 | gtest = dependency('gtest', main: true, disabler: true, required: false) |
| 151 | if not gtest.found() and build_tests.enabled() |
| 152 | cmake = import('cmake') |
| 153 | gtest_subproject = cmake.subproject('gtest') |
| 154 | cm_gtest = gtest_subproject.dependency('gtest') |
| 155 | cm_gtest_main = gtest_subproject.dependency('gtest_main') |
| 156 | gtest = declare_dependency(dependencies: [cm_gtest, cm_gtest_main, threads]) |
| 157 | endif |
| 158 | |
| 159 | test( |
| 160 | 'test_entity_manager', |
| 161 | executable( |
| 162 | 'test_entity_manager', |
| 163 | 'test/test_entity-manager.cpp', |
| 164 | 'src/Utils.cpp', |
| 165 | cpp_args: boost_args + ['-DBOOST_ASIO_DISABLE_THREADS'], |
| 166 | dependencies: [ |
| 167 | boost, |
| 168 | gtest, |
| 169 | nlohmann_json, |
| 170 | sdbusplus, |
| 171 | valijson, |
| 172 | ], |
| 173 | implicit_include_directories: false, |
| 174 | include_directories: 'include', |
| 175 | ) |
| 176 | ) |
Jason M. Bills | ff58eba | 2020-04-14 16:05:30 -0700 | [diff] [blame] | 177 | endif |