George Liu | 73e0bab | 2021-06-29 15:57:43 +0800 | [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 |
Chirag Sharma | 5042725 | 2020-08-11 12:11:38 -0500 | [diff] [blame] | 20 | endif |
| 21 | |
Chirag Sharma | 5042725 | 2020-08-11 12:11:38 -0500 | [diff] [blame] | 22 | dump = declare_dependency( |
| 23 | sources: [ |
| 24 | '../dump_serialize.cpp' |
| 25 | ]) |
| 26 | |
| 27 | tests = [ |
| 28 | 'debug_inif_test', |
| 29 | ] |
| 30 | |
| 31 | foreach t : tests |
| 32 | test(t, executable(t.underscorify(), t + '.cpp', |
| 33 | include_directories: ['.', '../'], |
| 34 | implicit_include_directories: false, |
George Liu | 73e0bab | 2021-06-29 15:57:43 +0800 | [diff] [blame] | 35 | dependencies:[ gtest_dep, |
| 36 | gmock_dep, |
Chirag Sharma | 5042725 | 2020-08-11 12:11:38 -0500 | [diff] [blame] | 37 | dump, |
George Liu | 73e0bab | 2021-06-29 15:57:43 +0800 | [diff] [blame] | 38 | phosphor_logging_dep, |
George Liu | 858fbb2 | 2021-07-01 12:25:44 +0800 | [diff] [blame] | 39 | fmt_dep, |
Patrick Williams | 7328771 | 2021-10-01 16:07:20 -0500 | [diff] [blame] | 40 | ]), |
Chirag Sharma | 5042725 | 2020-08-11 12:11:38 -0500 | [diff] [blame] | 41 | workdir: meson.current_source_dir()) |
| 42 | endforeach |