[libcamera-devel] [PATCH] meson: detect kernel version

Stéphane Cerveau scerveau at collabora.com
Wed Jun 10 17:39:36 CEST 2020


Add kernel version detection to warn user
that only >= 5.0.0 V4L API are supported in
libcamera.

Signed-off-by: Stéphane Cerveau <scerveau at collabora.com>
---
 meson.build | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/meson.build b/meson.build
index e898782..5063edb 100644
--- a/meson.build
+++ b/meson.build
@@ -105,6 +105,12 @@ if get_option('test')
     subdir('test')
 endif
 
+kernel_version_req = '>= 5.0.0'
+kernel_version = run_command('uname', '-r').stdout()
+if not kernel_version.version_compare(kernel_version_req)
+  warning('V4L2 API version @0@ is too old, @1@ is required, consider to upgrade your kernel version to use libcamera'.format(kernel_version, kernel_version_req))
+endif
+
 # Create a symlink from the build root to the source root. This is used when
 # running libcamera from the build directory to locate resources in the source
 # directory (such as IPA configuration files).
-- 
2.17.1



More information about the libcamera-devel mailing list