feat(python-eos-interface): began work on python eos interface
This commit is contained in:
23
src/python/eos/bindings.cpp
Normal file
23
src/python/eos/bindings.cpp
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
#include <pybind11/pybind11.h>
|
||||||
|
#include <pybind11/stl.h> // Needed for vectors, maps, sets, strings
|
||||||
|
#include <pybind11/stl_bind.h> // Needed for binding std::vector, std::map etc if needed directly
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include "helm.h"
|
||||||
|
#include "resourceManager.h"
|
||||||
|
#include "bindings.h"
|
||||||
|
|
||||||
|
namespace py = pybind11;
|
||||||
|
|
||||||
|
|
||||||
|
void register_eos_bindings(pybind11::module &eos_submodule) {
|
||||||
|
py::class_<EOSio>(const_submodule, "EOSio")
|
||||||
|
.def(py::init<std::string>(), py::arg("filename"))
|
||||||
|
.def("load", &EOSio::load)
|
||||||
|
.def_readonly("getFormat", &EOSio::getFormat)
|
||||||
|
.def_readonly("getTable", &EOSio::getTable)
|
||||||
|
|
||||||
|
.def("__repr__", [](const EOSio &eos) {)
|
||||||
|
return "<EOSio(filename='" + eos.getFilename() + "', format='" + eos.getFormat() + "')>";
|
||||||
|
});
|
||||||
|
}
|
||||||
5
src/python/eos/bindings.h
Normal file
5
src/python/eos/bindings.h
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <pybind11/pybind11.h>
|
||||||
|
|
||||||
|
void register_eos_bindings(pybind11::module &eos_submodule);
|
||||||
17
src/python/eos/meson.build
Normal file
17
src/python/eos/meson.build
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
# Define the library
|
||||||
|
bindings_sources = files('bindings.cpp')
|
||||||
|
bindings_headers = files('bindings.h')
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
const_dep,
|
||||||
|
python3_dep,
|
||||||
|
pybind11_dep,
|
||||||
|
]
|
||||||
|
|
||||||
|
shared_module('py_const',
|
||||||
|
bindings_sources,
|
||||||
|
include_directories: include_directories('.'),
|
||||||
|
cpp_args: ['-fvisibility=default'],
|
||||||
|
install : true,
|
||||||
|
dependencies: dependencies,
|
||||||
|
)
|
||||||
Reference in New Issue
Block a user