[Query] Add meson option.
authorgichan <gichan2.jang@samsung.com>
Thu, 30 Sep 2021 07:02:13 +0000 (16:02 +0900)
committerMyungJoo Ham <myungjoo.ham@samsung.com>
Sat, 9 Oct 2021 05:20:32 +0000 (14:20 +0900)
Exclude tensor_query from nnstreamer plugins if nnsquery is not available.

Signed-off-by: gichan <gichan2.jang@samsung.com>
gst/nnstreamer/meson.build
gst/nnstreamer/registerer/nnstreamer.c
meson.build
meson_options.txt
tests/meson.build

index d795fa6..8bd36fd 100644 (file)
@@ -13,8 +13,7 @@ nnstreamer_base_deps = [
   gst_video_dep,
   gst_audio_dep,
   libm_dep,
-  thread_dep,
-  nns_query_dep
+  thread_dep
 ]
 
 if orcc_support_is_available
@@ -62,14 +61,18 @@ nnst_plugins = [
   'tensor_filter',
   'tensor_repo',
   'tensor_if',
-  'tensor_rate',
-  'tensor_query'
+  'tensor_rate'
 ]
 
 foreach p : nnst_plugins
   subdir(p)
 endforeach
 
+if nnsquery_support_is_available
+  nnstreamer_base_deps += nnsquery_support_deps
+  subdir('tensor_query')
+endif
+
 subdir('include')
 
 # Private header for sub-plugins and native APIs
index fb3491b..0398503 100644 (file)
 #include <tensor_transform/tensor_transform.h>
 #include <tensor_if/gsttensorif.h>
 #include <tensor_rate/gsttensorrate.h>
+#if (ENABLE_NNS_QUERY == 1)
 #include <tensor_query/tensor_query_serversrc.h>
 #include <tensor_query/tensor_query_serversink.h>
 #include <tensor_query/tensor_query_client.h>
+#endif
 
 #define NNSTREAMER_INIT(plugin,name,type) \
   do { \
@@ -102,9 +104,11 @@ gst_nnstreamer_init (GstPlugin * plugin)
   NNSTREAMER_INIT (plugin, transform, TRANSFORM);
   NNSTREAMER_INIT (plugin, if, IF);
   NNSTREAMER_INIT (plugin, rate, RATE);
+#if (ENABLE_NNS_QUERY == 1)
   NNSTREAMER_INIT (plugin, query_serversrc, QUERY_SERVERSRC);
   NNSTREAMER_INIT (plugin, query_serversink, QUERY_SERVERSINK);
   NNSTREAMER_INIT (plugin, query_client, QUERY_CLIENT);
+#endif
 #if defined(__gnu_linux__) && !defined(__ANDROID__)
   /* IIO requires Linux / non-Android */
 #if (GST_VERSION_MAJOR == 1) && (GST_VERSION_MINOR >= 8)
index b6a5c11..b301b74 100644 (file)
@@ -138,7 +138,6 @@ gst_video_dep = dependency('gstreamer-video-' + gst_api_verision)
 gst_audio_dep = dependency('gstreamer-audio-' + gst_api_verision)
 gst_app_dep = dependency('gstreamer-app-' + gst_api_verision)
 gst_check_dep = dependency('gstreamer-check-' + gst_api_verision)
-nns_query_dep = dependency('nnsquery')
 
 libm_dep = cc.find_library('m') # cmath library
 libdl_dep = cc.find_library('dl') # DL library
@@ -374,6 +373,10 @@ features = {
   'tvm-support': {
     'target': 'tvm_runtime',
     'project_args': { 'ENABLE_TVM' : 1 }
+  },
+  'nnsquery-support': {
+    'target': 'nnsquery',
+    'project_args': { 'ENABLE_NNS_QUERY' : 1 }
   }
 }
 
index 296994c..57a435c 100644 (file)
@@ -20,6 +20,7 @@ option('grpc-support', type: 'feature', value: 'auto')
 option('lua-support', type: 'feature', value: 'auto')
 option('mqtt-support', type: 'feature', value: 'auto')
 option('tvm-support', type: 'feature', value: 'auto')
+option('nnsquery-support', type: 'feature', value: 'auto')
 
 # booleans & other options
 option('enable-test', type: 'boolean', value: true)
index c7be319..d2dd384 100644 (file)
@@ -133,14 +133,16 @@ if gtest_dep.found()
     test('unittest_join', unittest_join, env: testenv)
 
     # Run unittest_query
-    unittest_query = executable('unittest_query',
-      join_paths('nnstreamer_query', 'unittest_query.cc'),
-      dependencies: [nnstreamer_unittest_deps, unittest_util_dep],
-      install: get_option('install-test'),
-      install_dir: unittest_install_dir
-    )
+    if nnsquery_support_is_available
+      unittest_query = executable('unittest_query',
+        join_paths('nnstreamer_query', 'unittest_query.cc'),
+        dependencies: [nnstreamer_unittest_deps, unittest_util_dep],
+        install: get_option('install-test'),
+        install_dir: unittest_install_dir
+      )
 
-    test('unittest_query', unittest_query, env: testenv)
+      test('unittest_query', unittest_query, env: testenv)
+    endif
 
     # Run unittest_mqtt
     if mqtt_support_is_available