From 239f288a0efc6a20f7132eefa5f6570fb0c23567 Mon Sep 17 00:00:00 2001 From: MyungJoo Ham Date: Mon, 14 Aug 2023 11:03:49 +0900 Subject: [PATCH] datarepo: clean up meson scripts 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 --- gst/meson.build | 4 +--- meson.build | 14 +++++++++++++- meson_options.txt | 2 +- tests/meson.build | 2 +- 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/gst/meson.build b/gst/meson.build index 1188cd9..6e4edc8 100644 --- a/gst/meson.build +++ b/gst/meson.build @@ -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 diff --git a/meson.build b/meson.build index cbf9b2c..96a66c8 100644 --- a/meson.build +++ b/meson.build @@ -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 = {} diff --git a/meson_options.txt b/meson_options.txt index bcee95f..6ed00b3 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -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) diff --git a/tests/meson.build b/tests/meson.build index 2c7f4c5..70a5221 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -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 -- 2.7.4