12f20c5abSAndrew Jefferygtest_dep = dependency('gtest', main: true, disabler: true, required: false) 22f20c5abSAndrew Jefferygmock_dep = dependency('gmock', disabler: true, required: false) 32f20c5abSAndrew Jefferyif not gtest_dep.found() or not gmock_dep.found() 42f20c5abSAndrew Jeffery gtest_proj = import('cmake').subproject('googletest', required: false) 52f20c5abSAndrew Jeffery if gtest_proj.found() 62f20c5abSAndrew Jeffery gtest_dep = declare_dependency( 72f20c5abSAndrew Jeffery dependencies: [ 82f20c5abSAndrew Jeffery dependency('threads'), 92f20c5abSAndrew Jeffery gtest_proj.dependency('gtest'), 102f20c5abSAndrew Jeffery gtest_proj.dependency('gtest_main'), 112f20c5abSAndrew Jeffery ] 122f20c5abSAndrew Jeffery ) 132f20c5abSAndrew Jeffery gmock_dep = gtest_proj.dependency('gmock') 142f20c5abSAndrew Jeffery else 152f20c5abSAndrew Jeffery assert( 162f20c5abSAndrew Jeffery not get_option('tests').enabled(), 172f20c5abSAndrew Jeffery 'Googletest is required if tests are enabled' 182f20c5abSAndrew Jeffery ) 192f20c5abSAndrew Jeffery endif 202f20c5abSAndrew Jefferyendif 21feb19ef0SBrad Bishop 222f20c5abSAndrew Jefferyhave_boost_dbus = meson.get_compiler('cpp').has_header('dbus/connection.hpp') 23feb19ef0SBrad Bishopif have_boost_dbus 24feb19ef0SBrad Bishoptest( 25feb19ef0SBrad Bishop 'test_hwmon_temp_sensor', 26feb19ef0SBrad Bishop executable( 27feb19ef0SBrad Bishop 'test_hwmon_temp_sensor', 28feb19ef0SBrad Bishop 'test_HwmonTempSensor.cpp', 29feb19ef0SBrad Bishop dependencies: [ 30feb19ef0SBrad Bishop gtest, 31feb19ef0SBrad Bishop boost_dbus, 32feb19ef0SBrad Bishop ], 33feb19ef0SBrad Bishop implicit_include_directories: false, 34feb19ef0SBrad Bishop include_directories: '../include', 35feb19ef0SBrad Bishop ) 36feb19ef0SBrad Bishop) 37feb19ef0SBrad Bishop 38feb19ef0SBrad Bishoptest( 39feb19ef0SBrad Bishop 'test_tach_sensor', 40feb19ef0SBrad Bishop executable( 41feb19ef0SBrad Bishop 'test_tach_sensor', 42feb19ef0SBrad Bishop 'test_TachSensor.cpp', 43feb19ef0SBrad Bishop dependencies: [ 44feb19ef0SBrad Bishop gtest, 45feb19ef0SBrad Bishop boost_dbus, 46feb19ef0SBrad Bishop ], 47feb19ef0SBrad Bishop implicit_include_directories: false, 48feb19ef0SBrad Bishop include_directories: '../include', 49feb19ef0SBrad Bishop ) 50feb19ef0SBrad Bishop) 51feb19ef0SBrad Bishopendif 52*d3204145SLei YU 53*d3204145SLei YUtest( 54*d3204145SLei YU 'test_utils', 55*d3204145SLei YU executable( 56*d3204145SLei YU 'test_utils', 57*d3204145SLei YU 'test_Utils.cpp', 58*d3204145SLei YU '../src/Utils.cpp', 59*d3204145SLei YU dependencies: [ 60*d3204145SLei YU sdbusplus, 61*d3204145SLei YU gtest_dep, 62*d3204145SLei YU ], 63*d3204145SLei YU implicit_include_directories: false, 64*d3204145SLei YU include_directories: '../include', 65*d3204145SLei YU ) 66*d3204145SLei YU) 67