From 7bb603a68e4ef63ab0834f2e5e07686618154ff6 Mon Sep 17 00:00:00 2001 From: MyungJoo Ham Date: Thu, 24 Nov 2022 15:27:18 +0900 Subject: [PATCH] Make parser optional with meson_option. For simpler distro or other OS, make parser support optional. Signed-off-by: MyungJoo Ham --- meson_options.txt | 1 + tools/development/parser/meson.build | 16 ++++++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/meson_options.txt b/meson_options.txt index b114ed2..524f86c 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -25,6 +25,7 @@ option('tvm-support', type: 'feature', value: 'auto') 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 # booleans & other options option('enable-test', type: 'boolean', value: true) diff --git a/tools/development/parser/meson.build b/tools/development/parser/meson.build index 647c8c0..dbbe537 100644 --- a/tools/development/parser/meson.build +++ b/tools/development/parser/meson.build @@ -1,6 +1,12 @@ # Find flex, configure lex generator flex_min_version='2.5.31' -flex = find_program('flex', 'win_flex', version: '>=' + flex_min_version) +flex = find_program('flex', 'win_flex', version: '>=' + flex_min_version, required : false) +if not flex.found() + if get_option('parser-support').enabled() + error('flex is required if parser-support is enabled') + endif + subdir_done() +endif flex_cdata = configuration_data() flex_cdata.set('FLEX', flex.path()) if cc.get_id() == 'msvc' @@ -15,7 +21,13 @@ gen_lex = configure_file(input : 'gen_lex.py.in', # Find bison, configure grammar generator bison_min_version='2.4' -bison = find_program('bison', 'win_bison', version: '>=' + bison_min_version) +bison = find_program('bison', 'win_bison', version: '>=' + bison_min_version, required : false) +if not bison.found() + if get_option('parser-support').enabled() + error('bison is required if parser-support is enabled') + endif + subdir_done() +endif bison_cdata = configuration_data() bison_cdata.set('BISON', bison.path()) bison_cdata.set('BISON_ARGS', '') -- 2.7.4