datarepo: clean up meson scripts
authorMyungJoo Ham <myungjoo.ham@samsung.com>
Mon, 14 Aug 2023 02:03:49 +0000 (11:03 +0900)
committerjaeyun-jung <39614140+jaeyun-jung@users.noreply.github.com>
Wed, 16 Aug 2023 04:56:13 +0000 (13:56 +0900)
1. Make it 'feature' so that it can be resolved automatically.
2. Because it has an additional dependency, don't make it default true.

Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
gst/meson.build
meson.build
meson_options.txt
tests/meson.build

index 1188cd9..6e4edc8 100644 (file)
@@ -7,8 +7,6 @@ if mqtt_support_is_available
 endif
 subdir('nnstreamer')
 
-if get_option('enable-datarepo')
-  json_glib_dep = dependency('json-glib-1.0', required : true, \
-      not_found_message : 'json-glib-1.0 package should be installed to build the datarepo elements.')
+if datarepo_support_is_available
   subdir('datarepo')
 endif
index cbf9b2c..96a66c8 100644 (file)
@@ -344,6 +344,15 @@ if get_option('nnstreamer-edge-support').enabled()
 endif
 ## Without the explicit method designation, it fails to find cflags in older Meson
 
+# datarepo requires json-glib-1.0 in the name of json_glib_dep
+json_glib_dep = dependency('json-glib-1.0', required: false)
+if get_option('datarepo-support').enabled() and not json_glib_dep.found()
+  error('json-glib-1.0 is required for datarepo-support option.')
+endif
+if not get_option('datarepo-support').disabled() and not json_glib_dep.found()
+  message('datarepo-support is off because json-glib-1.0 is not available.')
+endif
+
 # features registration to be controlled
 #
 # register feature as follows
@@ -446,7 +455,10 @@ features = {
   'mxnet-support': {
     'extra_deps': [ mxnet_dep ],
     'project_args': { 'ENABLE_MXNET' : 1 }
-  }
+  },
+  'datarepo-support': {
+    'extra_deps': [ json_glib_dep ],
+  },
 }
 
 project_args = {}
index bcee95f..6ed00b3 100644 (file)
@@ -26,6 +26,7 @@ option('trix-engine-support', type: 'feature', value: 'auto')
 option('nnstreamer-edge-support', type: 'feature', value: 'auto')
 option('mxnet-support', type: 'feature', value: 'auto')
 option('parser-support', type: 'feature', value: 'auto') # gstreamer pipeline description <--> pbtxt pipeline
+option('datarepo-support', type: 'feature', value: 'auto', description: 'Data repository sink/src for in-pipeline training') # this required json-glib-1.0.
 
 # booleans & other options
 option('enable-test', type: 'boolean', value: true)
@@ -50,7 +51,6 @@ option('framework-priority-bin', type: 'string', value: '', description: 'A comm
 option('skip-tflite-flatbuf-check', type: 'boolean', value: false, description: 'Do not check the availability of flatbuf for tensorflow-lite build. In some systems, flatbuffers\' dependency cannot be found with meson.')
 option('trix-engine-alias', type: 'string', value: 'srnpu', description: 'The alias name list of trix-engine sub-plugin. This option provides backward compatibility of the previous framework name.')
 option('enable-float16', type: 'boolean', value: false, description: 'Support float16 streams with GCC extensions')
-option('enable-datarepo', type: 'boolean', value: true, description: 'Data repository sink/src for in-pipeline training')
 
 # Utilities
 option('enable-nnstreamer-check', type: 'boolean', value: true)
index 2c7f4c5..70a5221 100644 (file)
@@ -342,7 +342,7 @@ if gtest_dep.found()
     test('unittest_filter_shared_model', unittest_filter_shared_model, timeout: 30, env: testenv)
   endif
 
-  if get_option('enable-datarepo')
+  if datarepo_support_is_available
     subdir('nnstreamer_datarepo')
   endif