From a86c36b9a96e7f317dfab7c0e025ba3914be9be3 Mon Sep 17 00:00:00 2001 From: Nirbheek Chauhan Date: Sat, 1 Sep 2018 12:09:32 +0530 Subject: [PATCH] meson: Add a feature option for tests This autodetection is needed on iOS inside Cerbero where gstreamer-check-1.0 is not available. --- meson.build | 3 ++- meson_options.txt | 2 ++ validate/meson.build | 4 +++- validate/tests/check/meson.build | 2 +- validate/tests/meson.build | 4 ++-- 5 files changed, 10 insertions(+), 5 deletions(-) diff --git a/meson.build b/meson.build index 355ba27..d8730c6 100644 --- a/meson.build +++ b/meson.build @@ -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 diff --git a/meson_options.txt b/meson_options.txt index f8228a2..10718b5 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -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') diff --git a/validate/meson.build b/validate/meson.build index f9c574b..1de98b5 100644 --- a/validate/meson.build +++ b/validate/meson.build @@ -36,6 +36,8 @@ else endif endif subdir('pkgconfig') -subdir('tests') +if not get_option('tests').disabled() + subdir('tests') +endif subdir('plugins') #subdir('po') diff --git a/validate/tests/check/meson.build b/validate/tests/check/meson.build index 7b7be22..d5861fc 100644 --- a/validate/tests/check/meson.build +++ b/validate/tests/check/meson.build @@ -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)) diff --git a/validate/tests/meson.build b/validate/tests/meson.build index 2153ca1..be350f2 100644 --- a/validate/tests/meson.build +++ b/validate/tests/meson.build @@ -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') -- 2.7.4