Move to meson build configuration
cmake is Deprecated
Signed-off-by: John Chung <john.chung@arm.com>
Change-Id: I9d08b087828aa5a16f601785dcb7868704ec73a3
diff --git a/tests/meson.build b/tests/meson.build
new file mode 100644
index 0000000..0d381a6
--- /dev/null
+++ b/tests/meson.build
@@ -0,0 +1,46 @@
+gtest = dependency('gtest', main: true, disabler: true, required: false)
+gmock = dependency('gmock', disabler: true, required: false)
+if not gtest.found() or not gmock.found()
+ gtest_proj = import('cmake').subproject('googletest', required: false)
+ if gtest_proj.found()
+ gtest = declare_dependency(
+ dependencies: [
+ dependency('threads'),
+ gtest_proj.dependency('gtest'),
+ gtest_proj.dependency('gtest_main'),
+ ]
+ )
+ gmock = gtest_proj.dependency('gmock')
+ else
+ assert(
+ not get_option('tests').allowed(),
+ 'Googletest is required if tests are enabled'
+ )
+ endif
+endif
+
+sources = [
+ 'ir-tests.cpp',
+ 'test-utils.cpp',
+]
+
+test_include_dirs = ['.', '..']
+
+run_command('cp', '-r', '../specification/json/', meson.current_build_dir())
+run_command('mv', meson.current_build_dir() / 'json', meson.current_build_dir() / 'specification')
+
+tests = ['cper-tests']
+
+test('test-cper-tests',
+ executable('cper-tests',
+ sources,
+ implicit_include_directories: false,
+ include_directories:include_directories(test_include_dirs),
+ cpp_args: '-fpermissive',
+ dependencies: [
+ libcper_parse,
+ libcper_generate,
+ json_c_dep,
+ gtest,
+ gmock])
+)