py: libcamera: Move function declarations to common header

The init_py_*() functions are called by the top-level entry point of the
libcamera Python module to initialize different parts of the bindings.
They are declared in py_main.cpp where they are called, and defined in
separate compilation units. This results in functions being defined
without a corresponding declaration, and will generate warnings when we
enable -Wmissing-declarations.

Fix this by moving the function declarations from py_main.c to
py_main.h, and including py_main.h in the various compilation units that
need it.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
Laurent Pinchart 2024-06-24 16:26:57 +03:00
parent 885c48028f
commit a2e27f4f2b
9 changed files with 24 additions and 8 deletions

View file

@ -12,6 +12,8 @@
#include <pybind11/pybind11.h> #include <pybind11/pybind11.h>
#include <pybind11/stl.h> #include <pybind11/stl.h>
#include "py_main.h"
namespace py = pybind11; namespace py = pybind11;
using namespace libcamera; using namespace libcamera;

View file

@ -11,6 +11,8 @@
#include <pybind11/pybind11.h> #include <pybind11/pybind11.h>
#include "py_main.h"
namespace py = pybind11; namespace py = pybind11;
class PyControls class PyControls

View file

@ -9,6 +9,8 @@
#include <pybind11/pybind11.h> #include <pybind11/pybind11.h>
#include "py_main.h"
namespace py = pybind11; namespace py = pybind11;
using namespace libcamera; using namespace libcamera;

View file

@ -11,6 +11,8 @@
#include <pybind11/pybind11.h> #include <pybind11/pybind11.h>
#include "py_main.h"
namespace py = pybind11; namespace py = pybind11;
class PyFormats class PyFormats

View file

@ -14,6 +14,8 @@
#include <pybind11/pybind11.h> #include <pybind11/pybind11.h>
#include <pybind11/stl.h> #include <pybind11/stl.h>
#include "py_main.h"
namespace py = pybind11; namespace py = pybind11;
using namespace libcamera; using namespace libcamera;

View file

@ -85,14 +85,6 @@ PYBIND11_DECLARE_HOLDER_TYPE(T, PyCameraSmartPtr<T>)
*/ */
static std::weak_ptr<PyCameraManager> gCameraManager; static std::weak_ptr<PyCameraManager> gCameraManager;
void init_py_color_space(py::module &m);
void init_py_controls_generated(py::module &m);
void init_py_enums(py::module &m);
void init_py_formats_generated(py::module &m);
void init_py_geometry(py::module &m);
void init_py_properties_generated(py::module &m);
void init_py_transform(py::module &m);
PYBIND11_MODULE(_libcamera, m) PYBIND11_MODULE(_libcamera, m)
{ {
init_py_enums(m); init_py_enums(m);

View file

@ -7,8 +7,18 @@
#include <libcamera/base/log.h> #include <libcamera/base/log.h>
#include <pybind11/pybind11.h>
namespace libcamera { namespace libcamera {
LOG_DECLARE_CATEGORY(Python) LOG_DECLARE_CATEGORY(Python)
} }
void init_py_color_space(pybind11::module &m);
void init_py_controls_generated(pybind11::module &m);
void init_py_enums(pybind11::module &m);
void init_py_formats_generated(pybind11::module &m);
void init_py_geometry(pybind11::module &m);
void init_py_properties_generated(pybind11::module &m);
void init_py_transform(pybind11::module &m);

View file

@ -11,6 +11,8 @@
#include <pybind11/pybind11.h> #include <pybind11/pybind11.h>
#include "py_main.h"
namespace py = pybind11; namespace py = pybind11;
class PyProperties class PyProperties

View file

@ -12,6 +12,8 @@
#include <pybind11/pybind11.h> #include <pybind11/pybind11.h>
#include <pybind11/stl.h> #include <pybind11/stl.h>
#include "py_main.h"
namespace py = pybind11; namespace py = pybind11;
using namespace libcamera; using namespace libcamera;