xref: /openbmc/phosphor-gpio-monitor/test/meson.build (revision c087fa76fb457790c93cfebc0acaaf14bf5023ad)
1gmock_dep = dependency('gmock', disabler: true, required: build_tests)
2gtest_dep = dependency(
3    'gtest',
4    main: true,
5    disabler: true,
6    required: build_tests,
7)
8if not gtest_dep.found() or not gmock_dep.found()
9    gtest_proj = import('cmake').subproject('googletest', required: false)
10    if gtest_proj.found()
11        gtest_dep = declare_dependency(
12            dependencies: [
13                dependency('threads'),
14                gtest_proj.dependency('gtest'),
15                gtest_proj.dependency('gtest_main'),
16            ],
17        )
18        gmock_dep = gtest_proj.dependency('gmock')
19    else
20        assert(
21            not get_option('tests').enabled(),
22            'Googletest is required if tests are enabled',
23        )
24    endif
25endif
26
27test(
28    'utest',
29    executable(
30        'utest',
31        'utest.cpp',
32        dependencies: [gmock_dep, gtest_dep, libevdev, sdbusplus],
33        implicit_include_directories: false,
34        include_directories: '..',
35        link_with: [libevdev_o, libmonitor_o],
36    ),
37)
38