meson: Add a feature option for tests

This autodetection is needed on iOS inside Cerbero where
gstreamer-check-1.0 is not available.
This commit is contained in:
Nirbheek Chauhan 2018-09-01 12:09:32 +05:30
parent 4ac1362157
commit a86c36b9a9
5 changed files with 10 additions and 5 deletions

View file

@ -66,7 +66,8 @@ gst_pbutils_dep = dependency('gstreamer-pbutils-' + apiversion, version : gst_re
gst_video_dep = dependency('gstreamer-video-' + apiversion, version : gst_req,
fallback : ['gst-plugins-base', 'video_dep'])
if host_machine.system() != 'windows'
gstcheck_dep = dependency('gstreamer-check-1.0', version : gst_req,
gst_check_dep = dependency('gstreamer-check-1.0', version : gst_req,
required : get_option('tests'),
fallback : ['gstreamer', 'gst_check_dep'])
endif

View file

@ -6,3 +6,5 @@ option('gtk_doc', type : 'feature', value : 'auto', yield : true,
description : 'Build API documentation with gtk-doc')
option('introspection', type : 'feature', value : 'auto', yield : true,
description : 'Generate gobject-introspection bindings')
option('tests', type : 'feature', value : 'auto', yield : true,
description : 'Build and enable unit tests')

View file

@ -36,6 +36,8 @@ else
endif
endif
subdir('pkgconfig')
subdir('tests')
if not get_option('tests').disabled()
subdir('tests')
endif
subdir('plugins')
#subdir('po')

View file

@ -37,7 +37,7 @@ foreach t : validate_tests
'validate/test-utils.c',
c_args : gst_c_args + test_defines,
include_directories : [inc_dirs],
dependencies : [validate_dep, gstcheck_dep],
dependencies : [validate_dep, gst_check_dep],
)
env.set('GST_REGISTRY',
'@0@/@1@.registry'.format(meson.current_build_dir(), test_name))

View file

@ -1,6 +1,6 @@
# FIXME: make check work on windows
if host_machine.system() != 'windows'
subdir('check')
if host_machine.system() != 'windows' and gst_check_dep.found()
subdir('check')
endif
subdir('launcher_tests')