From dc03440cb56b17a677f7ac00279db2ede364b3a0 Mon Sep 17 00:00:00 2001 From: Tomi Valkeinen Date: Wed, 18 May 2022 16:13:27 +0300 Subject: py: Clean up control enums generation Try to be more consistent with the names, and include "control" in all the names. Also drop a useless "using namespace libcamera" and only include "control_ids.h". Signed-off-by: Tomi Valkeinen Reviewed-by: Laurent Pinchart Reviewed-by: Kieran Bingham Signed-off-by: Laurent Pinchart --- src/py/libcamera/meson.build | 12 +++++------- src/py/libcamera/py_control_enums_generated.cpp.in | 19 +++++++++++++++++++ src/py/libcamera/py_enums_generated.cpp.in | 21 --------------------- src/py/libcamera/py_main.cpp | 4 ++-- 4 files changed, 26 insertions(+), 30 deletions(-) create mode 100644 src/py/libcamera/py_control_enums_generated.cpp.in delete mode 100644 src/py/libcamera/py_enums_generated.cpp.in (limited to 'src') diff --git a/src/py/libcamera/meson.build b/src/py/libcamera/meson.build index 55957252..a3388c63 100644 --- a/src/py/libcamera/meson.build +++ b/src/py/libcamera/meson.build @@ -18,20 +18,18 @@ pycamera_sources = files([ 'py_main.cpp', ]) -gen_input_files = files([ +gen_py_control_enums_input_files = files([ '../../libcamera/control_ids.yaml', - 'py_enums_generated.cpp.in', + 'py_control_enums_generated.cpp.in', ]) gen_py_control_enums = files('gen-py-control-enums.py') -generated_sources = custom_target('py_gen_controls', - input : gen_input_files, - output : ['py_enums_generated.cpp'], +pycamera_sources += custom_target('py_gen_controls', + input : gen_py_control_enums_input_files, + output : ['py_control_enums_generated.cpp'], command : [gen_py_control_enums, '-o', '@OUTPUT@', '@INPUT@']) -pycamera_sources += generated_sources - pycamera_deps = [ libcamera_public, py3_dep, diff --git a/src/py/libcamera/py_control_enums_generated.cpp.in b/src/py/libcamera/py_control_enums_generated.cpp.in new file mode 100644 index 00000000..ed81fbe7 --- /dev/null +++ b/src/py/libcamera/py_control_enums_generated.cpp.in @@ -0,0 +1,19 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ +/* + * Copyright (C) 2022, Tomi Valkeinen + * + * Python bindings - Auto-generated control enums + * + * This file is auto-generated. Do not edit. + */ + +#include + +#include + +namespace py = pybind11; + +void init_py_control_enums_generated(py::module& m) +{ +${enums} +} diff --git a/src/py/libcamera/py_enums_generated.cpp.in b/src/py/libcamera/py_enums_generated.cpp.in deleted file mode 100644 index 20e07528..00000000 --- a/src/py/libcamera/py_enums_generated.cpp.in +++ /dev/null @@ -1,21 +0,0 @@ -/* SPDX-License-Identifier: LGPL-2.1-or-later */ -/* - * Copyright (C) 2022, Tomi Valkeinen - * - * Python bindings - Auto-generated enums - * - * This file is auto-generated. Do not edit. - */ - -#include - -#include - -namespace py = pybind11; - -using namespace libcamera; - -void init_py_enums_generated(py::module& m) -{ -${enums} -} diff --git a/src/py/libcamera/py_main.cpp b/src/py/libcamera/py_main.cpp index b05bbb22..1d941160 100644 --- a/src/py/libcamera/py_main.cpp +++ b/src/py/libcamera/py_main.cpp @@ -131,13 +131,13 @@ static void handleRequestCompleted(Request *req) } void init_py_enums(py::module &m); -void init_py_enums_generated(py::module &m); +void init_py_control_enums_generated(py::module &m); void init_py_geometry(py::module &m); PYBIND11_MODULE(_libcamera, m) { init_py_enums(m); - init_py_enums_generated(m); + init_py_control_enums_generated(m); init_py_geometry(m); /* Forward declarations */ -- cgit v1.2.1