From 0a45b0e7e18b77dfe5d798432d4aea7c585677bb Mon Sep 17 00:00:00 2001 From: heck Date: Wed, 6 Jan 2021 02:08:57 +0100 Subject: [PATCH] just only generate methods, struct and enums, then import in main module cc file --- gen/gen_cid/gen_cc.ysl2 | 17 ++--------------- gen/src/synth_shed/py_module.cc | 9 ++++----- 2 files changed, 6 insertions(+), 20 deletions(-) diff --git a/gen/gen_cid/gen_cc.ysl2 b/gen/gen_cid/gen_cc.ysl2 index ccbaae6..9509b2c 100644 --- a/gen/gen_cid/gen_cc.ysl2 +++ b/gen/gen_cid/gen_cc.ysl2 @@ -4,24 +4,11 @@ tstylesheet { template "module" { document("py_module.cc", "text") { || - #include - #include - #include - #include - #include "synth_shed.h" - - using namespace std; - namespace py = pybind11; - - PYBIND11_MODULE(«@name», m) { - `` apply "method" `` apply "struct" `` apply "enum" - - } || } } @@ -34,7 +21,7 @@ tstylesheet { template "struct" { || - py::class_<«@name»>(m, "«@name»") + pybind11::class_<«@name»>(m, "«@name»") ``apply "field" ; @@ -49,7 +36,7 @@ tstylesheet { template "enum" { || - py::enum_<::«@name»>(m, "«@name»") + pybind11::enum_<::«@name»>(m, "«@name»") ``apply item ; diff --git a/gen/src/synth_shed/py_module.cc b/gen/src/synth_shed/py_module.cc index 6408855..fe1ee99 100644 --- a/gen/src/synth_shed/py_module.cc +++ b/gen/src/synth_shed/py_module.cc @@ -1,15 +1,14 @@ #include +#include #include #include - +#include "synth_shed.h" using namespace std; - -PYBIND11_MODULE(_pybind, m) { - m.doc() = "pybind11 example plugin"; // optional module docstring +PYBIND11_MODULE(synth_shed, m) { + #include "../../examples/synth_shed/py_module.cc" } -