1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
|
// pybind 11 related includes
#include <pybind11/pybind11.h>
#include <pybind11/stl.h>
namespace py = pybind11;
// user-defined pre
{% if include_pre %}
#include "{{ include_pre }}"
{% endif %}
// forward declaration of the register_* functions
{% for mod in module_names %}
void register_{{mod}}_enums(py::module&);
{% endfor %}
{% for mod in module_names %}
void register_{{mod}}(py::module&);
{% endfor %}
// main module definiiton
PYBIND11_MODULE({{name}}, m) {
// register submodules
{% for mod in sorted_modules %}
register_{{mod}}_enums(m);
{% endfor %}
{% for mod in sorted_modules %}
register_{{mod}}(m);
{% endfor %}
// Add attributes if present
{% for k,v in settings['Attributes'].items() %}
m.attr("{{k}}") = py::cast("{{v}}");
{% endfor %}
}
|