[meson] Use subdir_done to simplify test/api/meson.build

This commit is contained in:
Ebrahim Byagowi 2020-05-21 08:24:15 +04:30
parent a79d0e405b
commit 759ab4fe56
1 changed files with 85 additions and 84 deletions

View File

@ -1,5 +1,9 @@
if conf.get('HAVE_GLIB', 0) == 1 if conf.get('HAVE_GLIB', 0) == 0
tests = [ message('You need to have glib support enabled to run test/api tests')
subdir_done()
endif
tests = [
'test-aat-layout.c', 'test-aat-layout.c',
'test-baseline.c', 'test-baseline.c',
'test-blob.c', 'test-blob.c',
@ -46,25 +50,25 @@ if conf.get('HAVE_GLIB', 0) == 1
'test-unicode.c', 'test-unicode.c',
'test-var-coords.c', 'test-var-coords.c',
'test-version.c', 'test-version.c',
] ]
if conf.get('HAVE_FREETYPE', 0) == 1 if conf.get('HAVE_FREETYPE', 0) == 1
tests += 'test-ot-math.c' tests += 'test-ot-math.c'
endif endif
if conf.get('HAVE_FREETYPE', 0) == 1 and conf.get('HAVE_PTHREAD', 0) == 1 if conf.get('HAVE_FREETYPE', 0) == 1 and conf.get('HAVE_PTHREAD', 0) == 1
tests += 'test-multithread.c' tests += 'test-multithread.c'
endif endif
# Default test running environment # Default test running environment
env = environment() env = environment()
env.set('MALLOC_CHECK_', '2') env.set('MALLOC_CHECK_', '2')
env.set('G_DEBUG', 'gc-friendly') env.set('G_DEBUG', 'gc-friendly')
env.set('G_SLICE', 'always-malloc') env.set('G_SLICE', 'always-malloc')
env.set('G_TEST_SRCDIR', meson.current_source_dir()) env.set('G_TEST_SRCDIR', meson.current_source_dir())
env.set('G_TEST_BUILDDIR', meson.current_build_dir()) env.set('G_TEST_BUILDDIR', meson.current_build_dir())
foreach source : tests foreach source : tests
test_name = source.split('.')[0] test_name = source.split('.')[0]
link_withs = libharfbuzz link_withs = libharfbuzz
@ -80,7 +84,4 @@ if conf.get('HAVE_GLIB', 0) == 1
link_with: link_withs, link_with: link_withs,
install: false, install: false,
), env: env) ), env: env)
endforeach endforeach
else
message('You need to have glib support enabled to run test/api tests')
endif