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" {
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 "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
;

9
gen/src/synth_shed/py_module.cc

@ -1,15 +1,14 @@
#include <string>
#include <iostream>
#include <pybind11/pybind11.h>
#include <pybind11/detail/common.h>
#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"
}

Loading…
Cancel
Save