[v2] meson: Convert `v4l2` into a feature option
diff mbox series

Message ID 20241216175213.1106544-1-pobrn@protonmail.com
State New
Headers show
Series
  • [v2] meson: Convert `v4l2` into a feature option
Related show

Commit Message

Barnabás Pőcze Dec. 16, 2024, 5:52 p.m. UTC
The v4l2 compatibility layer does not have external dependencies,
the usual benefits of a feature option do not apply. The main
motivation behind this change is making use of the `auto_features`
meson option that can change all feature options set to "auto"
by default to the desired value.

This can be useful for two reasons: (1) using auto_features=disabled
and then building up the list of features that are desired in the
particular build; (2) using auto_features=enabled to achieve
(usually) more testing and compilation coverage.

Signed-off-by: Barnabás Pőcze <pobrn@protonmail.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
---
 meson_options.txt    | 7 ++++---
 src/v4l2/meson.build | 7 +++----
 2 files changed, 7 insertions(+), 7 deletions(-)

Patch
diff mbox series

diff --git a/meson_options.txt b/meson_options.txt
index c91cd241a..1f70da0f5 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -84,6 +84,7 @@  option('udev',
        description : 'Enable udev support for hotplug')
 
 option('v4l2',
-        type : 'boolean',
-        value : false,
-        description : 'Compile the V4L2 compatibility layer')
+        type : 'feature',
+        value : 'auto',
+        description : 'Compile the V4L2 compatibility layer',
+        deprecated : {'true': 'enabled', 'false': 'disabled'})
diff --git a/src/v4l2/meson.build b/src/v4l2/meson.build
index 58f53bf3d..2c0404147 100644
--- a/src/v4l2/meson.build
+++ b/src/v4l2/meson.build
@@ -1,12 +1,11 @@ 
 # SPDX-License-Identifier: CC0-1.0
 
-if not get_option('v4l2')
-    v4l2_enabled = false
+v4l2_enabled = get_option('v4l2').allowed()
+
+if not v4l2_enabled
     subdir_done()
 endif
 
-v4l2_enabled = true
-
 v4l2_compat_sources = files([
     'v4l2_camera.cpp',
     'v4l2_camera_file.cpp',