Python.h hence the pybind header must be included first since pyconfig.h unconditionally overrides certain feature test macros[0]. This was mostly hidden by the fact that macro redefinitions with the same value do not trigger compiler warnings. However, glibc 43 has changed certain defaults[1], causing mismatches, leading to compiler warnings. So change the include order so that `<pybind11/...>` headers are included first and then the local `"py_..."` headers, and then everything else. Also remove some redundant includes. Adjust `.clang-format` and the documentation as well. [0]: https://docs.python.org/3/c-api/intro.html#include-files [1]: https://sourceware.org/git/?p=glibc.git;a=commit;h=a5cc3018f31a125f019685b239c6e5a0bf1a272b Link: https://github.com/python/cpython/issues/61322 Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
48 lines
1.2 KiB
C++
48 lines
1.2 KiB
C++
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
|
/*
|
|
* Copyright (C) 2022, Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
|
|
*
|
|
* Python bindings - Auto-generated {{mode}}
|
|
*
|
|
* This file is auto-generated. Do not edit.
|
|
*/
|
|
|
|
#include <pybind11/pybind11.h>
|
|
|
|
#include "py_main.h"
|
|
|
|
#include <libcamera/{{header}}>
|
|
|
|
namespace py = pybind11;
|
|
|
|
class Py{{mode|capitalize}}
|
|
{
|
|
};
|
|
|
|
{% for vendor in vendors -%}
|
|
class Py{{vendor|capitalize}}{{mode|capitalize}}
|
|
{
|
|
};
|
|
|
|
{% endfor -%}
|
|
|
|
void init_py_{{mode}}_generated(py::module& m)
|
|
{
|
|
auto {{mode}} = py::class_<Py{{mode|capitalize}}>(m, "{{mode}}");
|
|
{%- for vendor in vendors %}
|
|
auto {{vendor}} = py::class_<Py{{vendor|capitalize}}{{mode|capitalize}}>({{mode}}, "{{vendor}}");
|
|
{%- endfor %}
|
|
|
|
{% for ctrl in controls %}
|
|
{{ctrl.klass}}.def_readonly_static("{{ctrl.name}}", static_cast<const libcamera::ControlId *>(&libcamera::{{mode}}::{{ctrl.namespace}}{{ctrl.name}}));
|
|
{%- if ctrl.is_enum %}
|
|
|
|
py::enum_<libcamera::{{mode}}::{{ctrl.namespace}}{{ctrl.name}}Enum>({{ctrl.klass}}, "{{ctrl.name}}Enum")
|
|
{%- for enum in ctrl.enum_values %}
|
|
.value("{{enum.py_name}}", libcamera::{{mode}}::{{ctrl.namespace}}{{enum.name}})
|
|
{%- endfor %}
|
|
;
|
|
{%- endif %}
|
|
{% endfor -%}
|
|
}
|