From 8aa02271fd716ed046970a0b1f89176963303f50 Mon Sep 17 00:00:00 2001 From: Tomi Valkeinen Date: Mon, 9 May 2022 13:10:20 +0300 Subject: Add Python bindings Add libcamera Python bindings. pybind11 is used to generate the C++ <-> Python layer. We use pybind11 'smart_holder' version to avoid issues with private destructors and shared_ptr. There is also an alternative solution here: https://github.com/pybind/pybind11/pull/2067 Only a subset of libcamera classes are exposed. Implementing and testing the wrapper classes is challenging, and as such only classes that I have needed have been added so far. Signed-off-by: Tomi Valkeinen Reviewed-by: Laurent Pinchart Signed-off-by: Laurent Pinchart Signed-off-by: Kieran Bingham --- subprojects/.gitignore | 3 ++- subprojects/packagefiles/pybind11/meson.build | 7 +++++++ subprojects/pybind11.wrap | 9 +++++++++ 3 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 subprojects/packagefiles/pybind11/meson.build create mode 100644 subprojects/pybind11.wrap (limited to 'subprojects') diff --git a/subprojects/.gitignore b/subprojects/.gitignore index 391fde2c..0e194289 100644 --- a/subprojects/.gitignore +++ b/subprojects/.gitignore @@ -1,3 +1,4 @@ /googletest-release* /libyuv -/packagecache \ No newline at end of file +/packagecache +/pybind11 diff --git a/subprojects/packagefiles/pybind11/meson.build b/subprojects/packagefiles/pybind11/meson.build new file mode 100644 index 00000000..1be47ca4 --- /dev/null +++ b/subprojects/packagefiles/pybind11/meson.build @@ -0,0 +1,7 @@ +project('pybind11', 'cpp', + version : '2.9.1', + license : 'BSD-3-Clause') + +pybind11_incdir = include_directories('include') + +pybind11_dep = declare_dependency(include_directories : pybind11_incdir) diff --git a/subprojects/pybind11.wrap b/subprojects/pybind11.wrap new file mode 100644 index 00000000..e8037a5d --- /dev/null +++ b/subprojects/pybind11.wrap @@ -0,0 +1,9 @@ +[wrap-git] +url = https://github.com/pybind/pybind11.git +# This is the head of 'smart_holder' branch +revision = aebdf00cd060b871c5a1e0c2cf4a333503dd0431 +depth = 1 +patch_directory = pybind11 + +[provide] +pybind11 = pybind11_dep -- cgit v1.2.1