meson: Add a feature option for tests
authorNirbheek Chauhan <nirbheek@centricular.com>
Sat, 1 Sep 2018 06:39:32 +0000 (12:09 +0530)
committerNirbheek Chauhan <nirbheek@centricular.com>
Sat, 1 Sep 2018 06:39:32 +0000 (12:09 +0530)
This autodetection is needed on iOS inside Cerbero where
gstreamer-check-1.0 is not available.

meson.build
meson_options.txt
validate/meson.build
validate/tests/check/meson.build
validate/tests/meson.build

index 355ba27..d8730c6 100644 (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
 
index f8228a2..10718b5 100644 (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')
index f9c574b..1de98b5 100644 (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')
index 7b7be22..d5861fc 100644 (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))
index 2153ca1..be350f2 100644 (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')