[Tizen 4.0] Disable code w/ GST1.8 requirements if GST < 1.8
authorMyungJoo Ham <myungjoo.ham@samsung.com>
Tue, 31 Mar 2020 02:13:37 +0000 (11:13 +0900)
committerJijoong Moon <jijoong.moon@samsung.com>
Tue, 7 Apr 2020 07:32:09 +0000 (16:32 +0900)
src_iio uses GST 1.8 APIs.
A few unit tests uses GST 1.8 APIs

Do not build them if it is < 1.8.

Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Documentation/component-description.md
gst/nnstreamer/nnstreamer.c
gst/nnstreamer/tensor_source/meson.build
tests/meson.build

index d14e4ca..22ca77a 100644 (file)
@@ -82,6 +82,7 @@ In this page, we focus on the status of each elements. For requirements and desi
 - [tensor\_repo\_sink](../gst/nnstreamer/tensor_repo) (stable)
 - [tensor\_repo\_src](../gst/nnstreamer/tensor_repo) (stable)
 - [tensor\_src\_iio](../gst/nnstreamer/tensor_source) (stable)
+  - Requires GStreamer 1.8 or above.
 - [tensor\_src\_tizensensor](../ext/nnstreamer/tensor_source) (stable)
 - [tensor\_ros\_sink](https://github.com/nnstreamer/nnstreamer-ros) (stable for ROS1)
 - [tensor\_ros\_src](https://github.com/nnstreamer/nnstreamer-ros) (stable for ROS1)
index bcd89a3..a77d3ea 100644 (file)
@@ -90,7 +90,11 @@ gst_nnstreamer_init (GstPlugin * plugin)
   NNSTREAMER_INIT (plugin, split, SPLIT);
   NNSTREAMER_INIT (plugin, transform, TRANSFORM);
 #if defined(__gnu_linux__) && !defined(__ANDROID__)
+  /* IIO requires Linux / non-Android */
+#if (GST_VERSION_MAJOR == 1) && (GST_VERSION_MINOR >= 8)
+  /* SRC-IIO code uses GST 1.8+ APIs. */
   NNSTREAMER_INIT (plugin, src_iio, SRC_IIO);
+#endif
 #endif /* __gnu_linux__ && !__ANDROID__ */
   return TRUE;
 }
index 8ff2697..40522fb 100644 (file)
@@ -1,7 +1,13 @@
 tensor_src_sources = [
-  'tensor_src_iio.c'
 ]
 
+gst18_dep = dependency('gstreamer-' + gst_api_verision, version : '>=1.8', required : false)
+if gst18_dep.found()
+  tensor_src_sources += 'tensor_src_iio.c'
+else
+  message('tensor_src_iio requires GStreamer >= 1.8. Skipping it')
+endif
+
 foreach s : tensor_src_sources
   if build_platform != 'macos'
     nnstreamer_sources += join_paths(meson.current_source_dir(), s)
index 14d9ac4..75e0612 100644 (file)
@@ -77,35 +77,38 @@ if gtest_dep.found()
   test('unittest_common', unittest_common)
 
   # Run unittest_sink
-  unittest_sink = executable('unittest_sink',
-    join_paths('nnstreamer_sink', 'unittest_sink.cc'),
-    dependencies: [nnstreamer_unittest_deps, unittest_util_dep],
-    install: get_option('install-test'),
-    install_dir: unittest_install_dir
-  )
-
-  test('unittest_sink', unittest_sink, timeout: 120, args: ['--gst-plugin-path=..'])
-
-  # Run unittest_plugins
-  unittest_plugins = executable('unittest_plugins',
-    join_paths('nnstreamer_plugins', 'unittest_plugins.cc'),
-    dependencies: [nnstreamer_unittest_deps],
-    install: get_option('install-test'),
-    install_dir: unittest_install_dir
-  )
+  gst18_dep = dependency('gstreamer-' + gst_api_verision, version : '>=1.8', required : false)
+  if gst18_dep.found()
+    unittest_sink = executable('unittest_sink',
+      join_paths('nnstreamer_sink', 'unittest_sink.cc'),
+      dependencies: [nnstreamer_unittest_deps, unittest_util_dep],
+      install: get_option('install-test'),
+      install_dir: unittest_install_dir
+    )
 
-  test('unittest_plugins', unittest_plugins, args: ['--gst-plugin-path=..'])
+    test('unittest_sink', unittest_sink, timeout: 120, args: ['--gst-plugin-path=..'])
 
-  # Run unittest_src_iio
-  if build_platform != 'macos'
-    unittest_src_iio = executable('unittest_src_iio',
-      join_paths('nnstreamer_source', 'unittest_src_iio.cc'),
+    # Run unittest_plugins
+    unittest_plugins = executable('unittest_plugins',
+      join_paths('nnstreamer_plugins', 'unittest_plugins.cc'),
       dependencies: [nnstreamer_unittest_deps],
       install: get_option('install-test'),
       install_dir: unittest_install_dir
     )
 
-    test('unittest_src_iio', unittest_src_iio, timeout: 120, args: ['--gst-plugin-path=..'])
+    test('unittest_plugins', unittest_plugins, args: ['--gst-plugin-path=..'])
+
+  # Run unittest_src_iio
+    if build_platform != 'macos'
+      unittest_src_iio = executable('unittest_src_iio',
+        join_paths('nnstreamer_source', 'unittest_src_iio.cc'),
+        dependencies: [nnstreamer_unittest_deps],
+        install: get_option('install-test'),
+        install_dir: unittest_install_dir
+      )
+
+      test('unittest_src_iio', unittest_src_iio, timeout: 120, args: ['--gst-plugin-path=..'])
+    endif
   endif
 
   # Armnn unittest