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', |
Patrick Williams | 22ed428 | 2021-10-06 15:33:01 -0500 | [diff] [blame] | 7 | 'cpp_std=c++20' |
Brad Bishop | b445991 | 2019-11-05 19:39:11 -0500 | [diff] [blame] | 8 | ], |
| 9 | license: 'Apache-2.0', |
| 10 | version: '0.1', |
Patrick Williams | 22ed428 | 2021-10-06 15:33:01 -0500 | [diff] [blame] | 11 | meson_version: '>=0.57.0', |
Brad Bishop | b445991 | 2019-11-05 19:39:11 -0500 | [diff] [blame] | 12 | ) |
Brad Bishop | ec98491 | 2020-10-01 10:24:55 -0400 | [diff] [blame] | 13 | add_project_arguments('-Wno-psabi', language: 'cpp') |
Brad Bishop | b445991 | 2019-11-05 19:39:11 -0500 | [diff] [blame] | 14 | |
| 15 | boost_args = [ |
| 16 | '-DBOOST_SYSTEM_NO_DEPRECATED', |
| 17 | '-DBOOST_ERROR_CODE_HEADER_ONLY', |
| 18 | '-DBOOST_NO_RTTI', |
| 19 | '-DBOOST_NO_TYPEID', |
| 20 | '-DBOOST_ALL_NO_LIB', |
Ed Tanous | 07d467b | 2021-02-23 14:48:37 -0800 | [diff] [blame] | 21 | '-DBOOST_ALLOW_DEPRECATED_HEADERS' |
Brad Bishop | b445991 | 2019-11-05 19:39:11 -0500 | [diff] [blame] | 22 | ] |
| 23 | build_tests = get_option('tests') |
Brad Bishop | e3a12b6 | 2020-01-15 11:56:29 -0500 | [diff] [blame] | 24 | cpp = meson.get_compiler('cpp') |
Brad Bishop | 787e828 | 2020-01-15 12:16:53 -0500 | [diff] [blame] | 25 | boost = dependency('boost', required: false) |
| 26 | if not boost.found() |
| 27 | subproject('boost', required: false) |
| 28 | boost = declare_dependency( |
| 29 | include_directories: 'subprojects/boost_1_71_0', |
| 30 | ) |
Ed Tanous | 07d467b | 2021-02-23 14:48:37 -0800 | [diff] [blame] | 31 | boost = boost.as_system('system') |
Brad Bishop | 787e828 | 2020-01-15 12:16:53 -0500 | [diff] [blame] | 32 | endif |
Brad Bishop | 92daaaa | 2020-01-20 15:45:01 -0500 | [diff] [blame] | 33 | if get_option('fru-device') |
| 34 | i2c = cpp.find_library('i2c') |
| 35 | endif |
Andrew Jeffery | 14a7bc9 | 2021-08-02 10:01:22 +0930 | [diff] [blame] | 36 | |
| 37 | nlohmann_json_dep = dependency('nlohmann_json', |
| 38 | fallback: [ 'nlohmann_json', 'nlohmann_json_dep']) |
| 39 | |
Brad Bishop | 6765d90 | 2020-01-15 12:31:41 -0500 | [diff] [blame] | 40 | sdbusplus = dependency('sdbusplus', required: false) |
| 41 | if not sdbusplus.found() |
Patrick Williams | 7f5a336 | 2020-06-01 09:30:47 -0500 | [diff] [blame] | 42 | sdbusplus_proj = subproject('sdbusplus', required: true) |
| 43 | sdbusplus = sdbusplus_proj.get_variable('sdbusplus_dep') |
Ed Tanous | 07d467b | 2021-02-23 14:48:37 -0800 | [diff] [blame] | 44 | sdbusplus = sdbusplus.as_system('system') |
Brad Bishop | 6765d90 | 2020-01-15 12:31:41 -0500 | [diff] [blame] | 45 | endif |
Brad Bishop | b445991 | 2019-11-05 19:39:11 -0500 | [diff] [blame] | 46 | systemd = dependency('systemd') |
| 47 | systemd_system_unit_dir = systemd.get_pkgconfig_variable( |
| 48 | 'systemdsystemunitdir', |
| 49 | define_variable: ['prefix', get_option('prefix')]) |
| 50 | packagedir = join_paths( |
| 51 | get_option('prefix'), |
| 52 | get_option('datadir'), |
| 53 | meson.project_name(), |
| 54 | ) |
Andrew Jeffery | a9c5892 | 2021-06-01 09:28:59 +0930 | [diff] [blame] | 55 | sysconfdir = join_paths( |
| 56 | get_option('prefix'), |
| 57 | get_option('sysconfdir'), |
| 58 | meson.project_name(), |
| 59 | ) |
Brad Bishop | b445991 | 2019-11-05 19:39:11 -0500 | [diff] [blame] | 60 | threads = dependency('threads') |
Ed Tanous | 55ae5a8 | 2021-08-02 14:00:02 -0700 | [diff] [blame] | 61 | if cpp.has_header('valijson/validator.hpp') |
| 62 | valijson = declare_dependency() |
| 63 | else |
| 64 | subproject('valijson', required: false) |
| 65 | valijson = declare_dependency( |
| 66 | include_directories: 'subprojects/valijson/include' |
| 67 | ) |
| 68 | valijson = valijson.as_system('system') |
Brad Bishop | ff1ddb7 | 2020-01-15 12:24:56 -0500 | [diff] [blame] | 69 | endif |
Brad Bishop | b445991 | 2019-11-05 19:39:11 -0500 | [diff] [blame] | 70 | |
| 71 | install_data('blacklist.json') |
| 72 | |
| 73 | configs = [ |
Brad Bishop | f4b2e5a | 2022-05-26 16:17:12 -0400 | [diff] [blame] | 74 | '1ux16_riser.json', |
| 75 | '2ux8_riser.json', |
| 76 | '8x25_hsbp.json', |
| 77 | 'a2ul16riser.json', |
| 78 | 'a2ux8x4riser.json', |
| 79 | 'acbell_rica_psu.json', |
| 80 | 'asrock_e3c246d4i.json', |
| 81 | 'asrock_romed8hm3.json', |
| 82 | 'bletchley_baseboard.json', |
| 83 | 'bletchley_chassis.json', |
| 84 | 'blyth.json', |
| 85 | 'ahw1um2riser.json', |
| 86 | 'aspower_u1a-d10550_psu.json', |
| 87 | 'aspower_u1a-d10800_psu.json', |
| 88 | 'aspower_u1a-d11200_psu.json', |
| 89 | 'aspower_u1a-d11600_psu.json', |
| 90 | 'aspower_u1d-d10800_psu.json', |
| 91 | 'axx1p100hssi_aic.json', |
| 92 | 'axx2prthdhd.json', |
| 93 | 'bnp_baseboard.json', |
| 94 | 'bellavista.json', |
| 95 | 'delta_awf2dc3200w_psu.json', |
| 96 | 'delta_dps-750xb_psu.json', |
| 97 | 'delta_dps-1600ab_psu.json', |
| 98 | 'delta_dps-2000ab_psu.json', |
| 99 | 'everest.json', |
| 100 | 'f1u12x25_hsbp.json', |
| 101 | 'f1u4x25_hsbp.json', |
| 102 | 'f2u12x35_hsbp.json', |
| 103 | 'f2u8x25_hsbp.json', |
| 104 | 'fbtp.json', |
| 105 | 'fbyv2.json', |
Jayashree Dhanapal | 90249e2 | 2022-06-13 15:00:57 +0530 | [diff] [blame^] | 106 | 'fbyv35.json', |
Brad Bishop | f4b2e5a | 2022-05-26 16:17:12 -0400 | [diff] [blame] | 107 | 'flextronics_s-1100adu00-201_psu.json', |
| 108 | 'ibm_1000w_cffps.json', |
| 109 | 'ibm_1400w_cffps.json', |
| 110 | 'ibm_1600w_cffps.json', |
| 111 | 'ibm_2000w_cffps.json', |
| 112 | 'ibm_2300w_cffps.json', |
| 113 | 'intel_front_panel.json', |
| 114 | 'kudo_bmc.json', |
| 115 | 'kudo_motherboard.json', |
| 116 | 'mt_jade.json', |
| 117 | 'nisqually.json', |
| 118 | 'nvme_p4000.json', |
| 119 | 'pcie_ssd_retimer.json', |
| 120 | 'pssf132202a.json', |
| 121 | 'pssf162205a.json', |
| 122 | 'pssf212201a.json', |
| 123 | 'pssf222201a.json', |
| 124 | 'rainier_2u_chassis.json', |
| 125 | 'rainier_4u_chassis.json', |
| 126 | 'rainier_1s4u_chassis.json', |
| 127 | 'r1000_chassis.json', |
| 128 | 'r2000_chassis.json', |
| 129 | 'sas_module.json', |
| 130 | 'solum_pssf162202_psu.json', |
| 131 | 'storm_king.json', |
| 132 | 'stp_baseboard.json', |
| 133 | 'stp_p4000_chassis.json', |
| 134 | 'tyan_s7106_baseboard.json', |
| 135 | 'tyan_s8036_baseboard.json', |
Andrei Kartashev | 9d45552 | 2022-01-11 13:27:29 +0300 | [diff] [blame] | 136 | 'vegman_n110_baseboard.json', |
| 137 | 'vegman_rx20_baseboard.json', |
| 138 | 'vegman_sx20_baseboard.json', |
Brad Bishop | f4b2e5a | 2022-05-26 16:17:12 -0400 | [diff] [blame] | 139 | 'wft_baseboard.json', |
Brad Bishop | b445991 | 2019-11-05 19:39:11 -0500 | [diff] [blame] | 140 | ] |
Ed Tanous | 9dc2cc5 | 2021-12-20 16:05:49 -0800 | [diff] [blame] | 141 | filepaths = [] |
Brad Bishop | b445991 | 2019-11-05 19:39:11 -0500 | [diff] [blame] | 142 | foreach c : configs |
Ed Tanous | 9dc2cc5 | 2021-12-20 16:05:49 -0800 | [diff] [blame] | 143 | file = join_paths('configurations', c) |
Brad Bishop | b445991 | 2019-11-05 19:39:11 -0500 | [diff] [blame] | 144 | install_data( |
Ed Tanous | 9dc2cc5 | 2021-12-20 16:05:49 -0800 | [diff] [blame] | 145 | file, |
Brad Bishop | b445991 | 2019-11-05 19:39:11 -0500 | [diff] [blame] | 146 | install_dir: join_paths( |
| 147 | packagedir, |
| 148 | 'configurations', |
| 149 | ) |
| 150 | ) |
Ed Tanous | 9dc2cc5 | 2021-12-20 16:05:49 -0800 | [diff] [blame] | 151 | filepaths += [file] |
Brad Bishop | b445991 | 2019-11-05 19:39:11 -0500 | [diff] [blame] | 152 | endforeach |
| 153 | |
Brad Bishop | bfc7296 | 2022-05-26 16:33:00 -0400 | [diff] [blame] | 154 | validate_script = files('scripts/validate_configs.py') |
Ed Tanous | 9dc2cc5 | 2021-12-20 16:05:49 -0800 | [diff] [blame] | 155 | autojson = custom_target( |
| 156 | 'check_syntax', |
| 157 | command: [ |
| 158 | validate_script, |
| 159 | '-v', |
| 160 | '-k', |
| 161 | ], |
| 162 | depend_files: files(filepaths), |
| 163 | build_by_default: true, |
| 164 | capture: true, |
| 165 | output: 'validate_configs.log', |
| 166 | ) |
| 167 | |
Brad Bishop | b445991 | 2019-11-05 19:39:11 -0500 | [diff] [blame] | 168 | schemas = [ |
| 169 | 'global.json', |
Brad Bishop | 6666588 | 2020-05-07 17:05:18 -0400 | [diff] [blame] | 170 | 'legacy.json', |
Brad Bishop | b980991 | 2020-05-07 17:15:31 -0400 | [diff] [blame] | 171 | 'openbmc-dbus.json', |
Brad Bishop | 7d05ee5 | 2022-05-26 16:27:48 -0400 | [diff] [blame] | 172 | 'ibm.json', |
| 173 | 'intel.json', |
| 174 | 'pid.json', |
| 175 | 'pid_zone.json', |
| 176 | 'stepwise.json', |
| 177 | 'virtual_sensor.json', |
Brad Bishop | b445991 | 2019-11-05 19:39:11 -0500 | [diff] [blame] | 178 | ] |
| 179 | |
| 180 | foreach s : schemas |
| 181 | install_data( |
| 182 | join_paths('schemas', s), |
| 183 | install_dir: join_paths( |
| 184 | packagedir, |
| 185 | 'configurations', |
| 186 | 'schemas', |
| 187 | ) |
| 188 | ) |
| 189 | endforeach |
| 190 | |
| 191 | subdir('service_files') |
| 192 | subdir('src') |
Brad Bishop | b9f50cd | 2020-10-14 09:54:58 -0400 | [diff] [blame] | 193 | |
Jason M. Bills | ff58eba | 2020-04-14 16:05:30 -0700 | [diff] [blame] | 194 | if not build_tests.disabled() |
Patrick Venture | a62466c | 2021-02-08 14:55:18 -0800 | [diff] [blame] | 195 | test_boost_args = boost_args + ['-DBOOST_ASIO_DISABLE_THREADS'] |
Brad Bishop | b9f50cd | 2020-10-14 09:54:58 -0400 | [diff] [blame] | 196 | gtest = dependency('gtest', main: true, disabler: true, required: false) |
| 197 | if not gtest.found() and build_tests.enabled() |
Ed Tanous | 55ae5a8 | 2021-08-02 14:00:02 -0700 | [diff] [blame] | 198 | cmake = import('cmake') |
Brad Bishop | b9f50cd | 2020-10-14 09:54:58 -0400 | [diff] [blame] | 199 | gtest_subproject = cmake.subproject('gtest') |
| 200 | cm_gtest = gtest_subproject.dependency('gtest') |
| 201 | cm_gtest_main = gtest_subproject.dependency('gtest_main') |
| 202 | gtest = declare_dependency(dependencies: [cm_gtest, cm_gtest_main, threads]) |
| 203 | endif |
| 204 | |
| 205 | test( |
| 206 | 'test_entity_manager', |
| 207 | executable( |
| 208 | 'test_entity_manager', |
| 209 | 'test/test_entity-manager.cpp', |
Brad Bishop | e45d8c7 | 2022-05-25 15:12:53 -0400 | [diff] [blame] | 210 | 'src/expression.cpp', |
| 211 | 'src/utils.cpp', |
Patrick Venture | a62466c | 2021-02-08 14:55:18 -0800 | [diff] [blame] | 212 | cpp_args: test_boost_args, |
Brad Bishop | b9f50cd | 2020-10-14 09:54:58 -0400 | [diff] [blame] | 213 | dependencies: [ |
| 214 | boost, |
| 215 | gtest, |
Andrew Jeffery | 14a7bc9 | 2021-08-02 10:01:22 +0930 | [diff] [blame] | 216 | nlohmann_json_dep, |
Brad Bishop | b9f50cd | 2020-10-14 09:54:58 -0400 | [diff] [blame] | 217 | sdbusplus, |
| 218 | valijson, |
| 219 | ], |
| 220 | implicit_include_directories: false, |
| 221 | include_directories: 'include', |
| 222 | ) |
| 223 | ) |
Patrick Venture | a62466c | 2021-02-08 14:55:18 -0800 | [diff] [blame] | 224 | |
| 225 | test( |
| 226 | 'test_fru_utils', |
| 227 | executable( |
| 228 | 'test_fru_utils', |
| 229 | 'test/test_fru-utils.cpp', |
Brad Bishop | e45d8c7 | 2022-05-25 15:12:53 -0400 | [diff] [blame] | 230 | 'src/fru_utils.cpp', |
Zev Weiss | 309c0b1 | 2022-02-25 01:44:12 +0000 | [diff] [blame] | 231 | 'src/fru_reader.cpp', |
Patrick Venture | a62466c | 2021-02-08 14:55:18 -0800 | [diff] [blame] | 232 | cpp_args: test_boost_args, |
| 233 | dependencies: [ |
| 234 | boost, |
| 235 | gtest, |
| 236 | ], |
| 237 | implicit_include_directories: false, |
| 238 | include_directories: 'include', |
| 239 | ) |
| 240 | ) |
Jason M. Bills | ff58eba | 2020-04-14 16:05:30 -0700 | [diff] [blame] | 241 | endif |