py: Move to mainline pybind11 version

We are using pybind11 'smart_holder' branch to solve the Camera
destructor issue (see the comment in this patch, or the commit
that originally added Python bindings support).

As it would be very nice to use the mainline pybind11 (which is packaged
in distributions), this patch adds a workaround allowing us to move to
the mainline pybind11 version.

The workaround is simply creating a custom holder class
(PyCameraSmartPtr), used only for the Camera, which wraps around the
shared_ptr. This makes the compiler happy.

Moving to mainline pybind11 is achieved with:

- Change the pybind11 wrap to point to the mainline pybdind11 version

- Tell pybind11 to always use shared_ptr<> as the holder for
  PyCameraManager, as we use the singleton pattern for the
  PyCameraManager, and using shared_ptr<> to manage it is a requirement

- Tell pybind11 to always use PyCameraSmartPtr<> as the holder for Camera

- Change the meson.build file to use a system-installed pybind11

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
Tomi Valkeinen 2023-05-30 15:01:33 +03:00 committed by Laurent Pinchart
parent 51dc505d63
commit ad4719c10c
13 changed files with 66 additions and 28 deletions

View file

@ -4,4 +4,4 @@
/libyaml
/libyuv
/packagecache
/pybind11
/pybind11-*

View file

@ -1,11 +0,0 @@
# SPDX-License-Identifier: CC0-1.0
[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