1if get_option('oe-sdk').allowed()
2  # Setup OE SYSROOT
3  OECORE_TARGET_SYSROOT = run_command('sh', '-c', 'echo $OECORE_TARGET_SYSROOT').stdout().strip()
4  if OECORE_TARGET_SYSROOT == ''
5      error('Unable to get $OECORE_TARGET_SYSROOT, check your environment.')
6  endif
7  message('OE_SYSROOT: ' + OECORE_TARGET_SYSROOT)
8  rpath = ':'.join([OECORE_TARGET_SYSROOT + '/lib', OECORE_TARGET_SYSROOT + '/usr/lib'])
9  ld_so = run_command('sh', '-c', 'find ' + OECORE_TARGET_SYSROOT + '/lib/ld-*.so | sort -r -n | head -n1').stdout().strip()
10  dynamic_linker = ['-Wl,-dynamic-linker,' + ld_so]
11else
12  dynamic_linker = []
13endif
14gmock = dependency('gmock', disabler: true, required: build_tests)
15gtest = dependency('gtest', main: true, disabler: true, required: build_tests)
16libgpiodcxx = dependency('libgpiodcxx', default_options: ['bindings=cxx'])
17dependecy_list = [gtest, gmock, sdbusplus, phosphor_logging, phosphor_dbus_interfaces, libgpiodcxx, nlohmann_json_dep]
18
19configuration_inc = include_directories('..', '../vpd-manager', 'vpd-manager-test', '../vpd-parser')
20
21vpd_test = ['store/store.cpp',
22            'ipz_parser/parser.cpp',
23            'keyword_vpd_parser_test/kw_vpd_test.cpp',
24            'vpd-manager-test/reader_test.cpp',
25            'vpd-manager-test/editor_test.cpp'
26]
27
28application_src =['../impl.cpp',
29                   '../vpd-parser/ipz_parser.cpp',
30                   '../ibm_vpd_utils.cpp',
31                   '../common_utility.cpp',
32                   '../vpd-manager/reader_impl.cpp',
33                   '../vpd-parser/keyword_vpd_parser.cpp',
34                   '../vpd-manager/editor_impl.cpp',
35                   '../vpd-parser/parser_factory.cpp',
36                   '../vpd-parser/memory_vpd_parser.cpp',
37                   '../vpd-parser/isdimm_vpd_parser.cpp'
38                  ]
39
40foreach t : vpd_test
41    test(t, executable(t.underscorify(),
42            [t, application_src],
43    build_rpath: get_option('oe-sdk').allowed() ? rpath : '',
44    link_args: dynamic_linker,
45    cpp_args: ['-DIPZ_PARSER', '-DManagerTest'],
46    c_args: ['-Wno-unused-parameter',
47      '-Wno-unused-variable'],
48    dependencies: dependecy_list,
49    include_directories: configuration_inc,
50    link_with : libvpdecc,
51    ),
52    workdir: meson.current_source_dir())
53endforeach
54