Andrew Jeffery | 2f20c5a | 2021-05-27 14:52:49 +0930 | [diff] [blame] | 1 | gtest_dep = dependency('gtest', main: true, disabler: true, required: false) |
| 2 | gmock_dep = dependency('gmock', disabler: true, required: false) |
| 3 | if not gtest_dep.found() or not gmock_dep.found() |
| 4 | gtest_proj = import('cmake').subproject('googletest', required: false) |
| 5 | if gtest_proj.found() |
| 6 | gtest_dep = declare_dependency( |
| 7 | dependencies: [ |
| 8 | dependency('threads'), |
| 9 | gtest_proj.dependency('gtest'), |
| 10 | gtest_proj.dependency('gtest_main'), |
| 11 | ] |
| 12 | ) |
| 13 | gmock_dep = gtest_proj.dependency('gmock') |
| 14 | else |
| 15 | assert( |
| 16 | not get_option('tests').enabled(), |
| 17 | 'Googletest is required if tests are enabled' |
| 18 | ) |
| 19 | endif |
| 20 | endif |
Brad Bishop | feb19ef | 2019-11-07 18:02:16 -0500 | [diff] [blame] | 21 | |
Andrew Jeffery | 2f20c5a | 2021-05-27 14:52:49 +0930 | [diff] [blame] | 22 | have_boost_dbus = meson.get_compiler('cpp').has_header('dbus/connection.hpp') |
Brad Bishop | feb19ef | 2019-11-07 18:02:16 -0500 | [diff] [blame] | 23 | if have_boost_dbus |
| 24 | test( |
| 25 | 'test_hwmon_temp_sensor', |
| 26 | executable( |
| 27 | 'test_hwmon_temp_sensor', |
| 28 | 'test_HwmonTempSensor.cpp', |
| 29 | dependencies: [ |
| 30 | gtest, |
| 31 | boost_dbus, |
| 32 | ], |
| 33 | implicit_include_directories: false, |
| 34 | include_directories: '../include', |
| 35 | ) |
| 36 | ) |
| 37 | |
| 38 | test( |
| 39 | 'test_tach_sensor', |
| 40 | executable( |
| 41 | 'test_tach_sensor', |
| 42 | 'test_TachSensor.cpp', |
| 43 | dependencies: [ |
| 44 | gtest, |
| 45 | boost_dbus, |
| 46 | ], |
| 47 | implicit_include_directories: false, |
| 48 | include_directories: '../include', |
| 49 | ) |
| 50 | ) |
| 51 | endif |