From 3d971b4024680bb345c7cfc147119bd6e2362049 Mon Sep 17 00:00:00 2001 From: Dmitry Sharshakov Date: Wed, 9 Nov 2022 08:41:38 +0300 Subject: [PATCH] meson: allow building libcamera from source as a subproject Many distributions provide outdated libcamera versions. This change should also help making changes to libcamera itself. System libcamera is kept a default to avoid breaking existing build processes relying to packaged libcamera. --- .gitignore | 5 +++++ meson_options.txt | 2 ++ spa/meson.build | 7 ++++++- subprojects/libcamera.wrap | 3 +++ 4 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 subprojects/libcamera.wrap diff --git a/.gitignore b/.gitignore index 57213aa84..2ee6896bb 100644 --- a/.gitignore +++ b/.gitignore @@ -15,6 +15,11 @@ subprojects/lua* subprojects/wireplumber subprojects/media-session subprojects/packagecache +subprojects/googletest* +subprojects/gtest.wrap +subprojects/libyaml.wrap +subprojects/libyaml +subprojects/libcamera # Created by https://www.gitignore.io/api/vim diff --git a/meson_options.txt b/meson_options.txt index 99b057c52..179d019c8 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -168,6 +168,8 @@ option('libcamera', description: 'Enable libcamera spa plugin integration', type: 'feature', value: 'auto') +option('system-libcamera', type : 'boolean', value : 'true', + description : 'Use libcamera from the system instead of building from source') option('videoconvert', description: 'Enable videoconvert spa plugin integration', type: 'feature', diff --git a/spa/meson.build b/spa/meson.build index f88b5f9a3..2dbff49a8 100644 --- a/spa/meson.build +++ b/spa/meson.build @@ -89,7 +89,12 @@ if get_option('spa-plugins').allowed() vulkan_headers = cc.has_header('vulkan/vulkan.h', dependencies : vulkan_dep) #summary({'Vulkan': vulkan_headers}, bool_yn: true, section: 'Misc dependencies') - libcamera_dep = dependency('libcamera', required: get_option('libcamera')) + if get_option('system-libcamera') + libcamera_dep = dependency('libcamera', required: get_option('libcamera')) + else + libcamera_proj = subproject('libcamera') + libcamera_dep = libcamera_proj.get_variable('libcamera_public') + endif summary({'libcamera': libcamera_dep.found()}, bool_yn: true, section: 'Backend') tinycompress_dep = cc.find_library('tinycompress', has_headers: ['tinycompress/tinycompress.h' ], required: get_option('compress-offload')) diff --git a/subprojects/libcamera.wrap b/subprojects/libcamera.wrap new file mode 100644 index 000000000..3db743f86 --- /dev/null +++ b/subprojects/libcamera.wrap @@ -0,0 +1,3 @@ +[wrap-git] +url = https://git.libcamera.org/libcamera/libcamera.git +revision = head