[RFC PATCH v1] meson: Convert `v4l2` into a feature option

Barnabás Pőcze pobrn at protonmail.com
Sun Dec 15 20:23:57 CET 2024


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 at protonmail.com>
---
 meson_options.txt    | 4 ++--
 src/v4l2/meson.build | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/meson_options.txt b/meson_options.txt
index c91cd241a..08e224561 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -84,6 +84,6 @@ option('udev',
        description : 'Enable udev support for hotplug')
 
 option('v4l2',
-        type : 'boolean',
-        value : false,
+        type : 'feature',
+        value : 'auto',
         description : 'Compile the V4L2 compatibility layer')
diff --git a/src/v4l2/meson.build b/src/v4l2/meson.build
index 58f53bf3d..e4daf8ae7 100644
--- a/src/v4l2/meson.build
+++ b/src/v4l2/meson.build
@@ -1,6 +1,6 @@
 # SPDX-License-Identifier: CC0-1.0
 
-if not get_option('v4l2')
+if not get_option('v4l2').allowed()
     v4l2_enabled = false
     subdir_done()
 endif
-- 
2.47.1




More information about the libcamera-devel mailing list