1gtest = dependency('gtest', main: true, disabler: true, required: false) 2gmock = dependency('gmock', disabler: true, required: false) 3if not gtest.found() or not gmock.found() 4 gtest_proj = import('cmake').subproject('googletest', required: false) 5 if gtest_proj.found() 6 gtest = declare_dependency( 7 dependencies: [ 8 dependency('threads'), 9 gtest_proj.dependency('gtest'), 10 gtest_proj.dependency('gtest_main'), 11 ] 12 ) 13 gmock = gtest_proj.dependency('gmock') 14 else 15 assert( 16 not get_option('tests').allowed(), 17 'Googletest is required if tests are enabled' 18 ) 19 endif 20endif 21 22sources = [ 23 'ir-tests.cpp', 24 'test-utils.cpp', 25] 26 27test_include_dirs = ['.', '..'] 28 29run_command('cp', '-r', '../specification/json/', meson.current_build_dir()) 30run_command('mv', meson.current_build_dir() / 'json', meson.current_build_dir() / 'specification') 31 32tests = ['cper-tests'] 33 34test('test-cper-tests', 35 executable('cper-tests', 36 sources, 37 implicit_include_directories: false, 38 include_directories:include_directories(test_include_dirs), 39 cpp_args: '-fpermissive', 40 dependencies: [ 41 libcper_parse, 42 libcper_generate, 43 json_c_dep, 44 gtest, 45 gmock]) 46) 47