[vlc-commits] [Git][videolan/vlc][master] meson: refactor definition of flex and bison generators

Steve Lhomme (@robUx4) gitlab at videolan.org
Thu Aug 8 05:59:58 UTC 2024



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
e2051fd7 by Marvin Scholz at 2024-08-08T05:39:46+00:00
meson: refactor definition of flex and bison generators

This allows them to be used easily in other places than the CSS engine
by not tying them conditionally to that but the other way around.

- - - - -


2 changed files:

- meson.build
- modules/codec/meson.build


Changes:

=====================================
meson.build
=====================================
@@ -1032,6 +1032,23 @@ endif
 
 gcrypt_dep = dependency('libgcrypt', required: get_option('libgcrypt'))
 
+# Flex/Bison support
+# This defines the `bison_gen` and `flex_gen` generator variables to be used
+# to process Bison and Flex files respectively.
+
+flex = find_program('flex', required: false)
+bison = find_program('bison', required: false)
+
+if flex.found() and bison.found()
+    bison_gen = generator(bison,
+        output: ['@BASENAME at .c', '@BASENAME at .h'],
+        arguments: ['@INPUT@', '--defines=@OUTPUT1@', '--output=@OUTPUT0@'])
+
+    flex_gen = generator(flex,
+        output: '@PLAINNAME at .yy.c',
+        arguments: ['-o', '@OUTPUT@', '@INPUT@'])
+endif
+
 # Generate config.h
 configure_file(input: 'config.h.meson',
   output: 'config.h',


=====================================
modules/codec/meson.build
=====================================
@@ -399,22 +399,11 @@ if get_option('stream_outputs')
     )
 endif
 
-# WebVTT CSS engine requires Flex and Bison
-flex = find_program('flex', required: get_option('css_engine'))
-bison = find_program('bison', required: get_option('css_engine'))
-
-if flex.found() and bison.found() and not get_option('css_engine').disabled()
-
-    bison_gen = generator(bison,
-        output: ['@BASENAME at .c', '@BASENAME at .h'],
-        arguments: ['@INPUT@', '--defines=@OUTPUT1@', '--output=@OUTPUT0@'])
+# WebVTT CSS engine (requires Flex and Bison)
+if get_option('css_engine').require(flex.found() and bison.found(),
+        error_message: 'The CSS engine requires the Flex and Bison tools').allowed()
 
     webvtt_bison_files = bison_gen.process('webvtt/CSSGrammar.y')
-
-    flex_gen = generator(flex,
-        output: '@PLAINNAME at .yy.c',
-        arguments: ['-o', '@OUTPUT@', '@INPUT@'])
-
     webvtt_lex_files = flex_gen.process('webvtt/CSSLexer.l')
 
     webvtt_sources += [



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/e2051fd70f4d1aff33e42efa29ba39f79f7859d6

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/e2051fd70f4d1aff33e42efa29ba39f79f7859d6
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list