Browse Source

just only generate methods, struct and enums, then import in main module cc file

master
heck 5 years ago
parent
commit
0a45b0e7e1
  1. 17
      gen/gen_cid/gen_cc.ysl2
  2. 9
      gen/src/synth_shed/py_module.cc

17
gen/gen_cid/gen_cc.ysl2

@ -4,24 +4,11 @@ tstylesheet {
template "module" { template "module" {
document("py_module.cc", "text") { document("py_module.cc", "text") {
|| ||
#include <string>
#include <iostream>
#include <pybind11/pybind11.h>
#include <pybind11/detail/common.h>
#include "synth_shed.h"
using namespace std;
namespace py = pybind11;
PYBIND11_MODULE(«@name», m) {
`` apply "method" `` apply "method"
`` apply "struct" `` apply "struct"
`` apply "enum" `` apply "enum"
}
|| ||
} }
} }
@ -34,7 +21,7 @@ tstylesheet {
template "struct" { template "struct" {
|| ||
py::class_<«@name»>(m, "«@name»") pybind11::class_<«@name»>(m, "«@name»")
``apply "field" ``apply "field"
; ;
@ -49,7 +36,7 @@ tstylesheet {
template "enum" { template "enum" {
|| ||
py::enum_<::«@name»>(m, "«@name»") pybind11::enum_<::«@name»>(m, "«@name»")
``apply item ``apply item
; ;

9
gen/src/synth_shed/py_module.cc

@ -1,15 +1,14 @@
#include <string> #include <string>
#include <iostream>
#include <pybind11/pybind11.h> #include <pybind11/pybind11.h>
#include <pybind11/detail/common.h> #include <pybind11/detail/common.h>
#include "synth_shed.h"
using namespace std; using namespace std;
PYBIND11_MODULE(synth_shed, m) {
PYBIND11_MODULE(_pybind, m) { #include "../../examples/synth_shed/py_module.cc"
m.doc() = "pybind11 example plugin"; // optional module docstring
} }

Loading…
Cancel
Save