xref: /openbmc/phosphor-debug-collector/test/meson.build (revision fdc0c3a12d58a0694718fe4616d9d91eab97b460)
1# SPDX-License-Identifier: Apache-2.0
2if get_option('oe-sdk').enabled()
3    # Setup OE SYSROOT
4    OECORE_TARGET_SYSROOT = run_command('sh', '-c', 'echo $OECORE_TARGET_SYSROOT').stdout().strip()
5    if OECORE_TARGET_SYSROOT == ''
6        error('Unable to get OECORE_TARGET_SYSROOT, check your environment.')
7    endif
8    message('OECORE_TARGET_SYSROOT: ' + OECORE_TARGET_SYSROOT)
9    rpath = ':'.join([OECORE_TARGET_SYSROOT + '/lib', OECORE_TARGET_SYSROOT + '/usr/lib'])
10    ld_so = run_command('sh', '-c', 'find ' + OECORE_TARGET_SYSROOT + '/lib/ld-*.so | sort -r -n | head -n1').stdout().strip()
11    dynamic_linker = ['-Wl,-dynamic-linker,' + ld_so]
12else
13    dynamic_linker = []
14endif
15
16gtest = dependency('gtest', main: true, disabler: true, required: true)
17gmock = dependency('gmock', disabler: true, required: true)
18
19dump = declare_dependency(
20         sources: [
21        '../dump_serialize.cpp'
22    ])
23
24tests = [
25    'debug_inif_test',
26]
27
28foreach t : tests
29  test(t, executable(t.underscorify(), t + '.cpp',
30                     include_directories: ['.', '../'],
31                     implicit_include_directories: false,
32                     link_args: dynamic_linker,
33                     build_rpath: get_option('oe-sdk').enabled() ? rpath : '',
34                     dependencies:[ gtest,
35                                    gmock,
36                                    dump,
37                                    phosphor_logging,
38                                    cppfs]),
39       workdir: meson.current_source_dir())
40endforeach
41