diff --git a/bindings/python/CMakeLists.txt b/bindings/python/CMakeLists.txt index b4f01a3ad..184cb1853 100644 --- a/bindings/python/CMakeLists.txt +++ b/bindings/python/CMakeLists.txt @@ -14,11 +14,11 @@ pybind11_add_module(kllvm-static STATIC NO_EXTRAS runtime.cpp ) -pybind11_add_module(kllvm SHARED +pybind11_add_module(_kllvm SHARED ast.cpp ) -target_link_libraries(kllvm PUBLIC +target_link_libraries(_kllvm PUBLIC AST Parser ) @@ -36,6 +36,9 @@ install(FILES $ DESTINATION lib/kllvm RENAME libkllvm.a) -install(TARGETS kllvm - DESTINATION lib/kllvm +install(DIRECTORY package/ + DESTINATION lib/python) + +install(TARGETS _kllvm + DESTINATION lib/python/kllvm LIBRARY) diff --git a/bindings/python/ast.cpp b/bindings/python/ast.cpp index 29236145b..eff9330ac 100644 --- a/bindings/python/ast.cpp +++ b/bindings/python/ast.cpp @@ -77,7 +77,7 @@ void bind_ast(py::module_ &m) { .def_property_readonly("name", &KORECompositeSort::getName); } -PYBIND11_MODULE(kllvm, m) { +PYBIND11_MODULE(_kllvm, m) { #ifdef KLLVM_BUILD_RUNTIME bind_runtime(m); #endif diff --git a/bindings/python/package/README.md b/bindings/python/package/README.md new file mode 100644 index 000000000..e69de29bb diff --git a/bindings/python/package/kllvm/__init__.py b/bindings/python/package/kllvm/__init__.py new file mode 100644 index 000000000..b1d764259 --- /dev/null +++ b/bindings/python/package/kllvm/__init__.py @@ -0,0 +1 @@ +from ._kllvm import * diff --git a/bindings/python/package/pyproject.toml b/bindings/python/package/pyproject.toml new file mode 100644 index 000000000..39009b460 --- /dev/null +++ b/bindings/python/package/pyproject.toml @@ -0,0 +1,17 @@ +[tool.poetry] +name = "kllvm" +version = "0.1.0" +description = "Python bindings for the K LLVM backend" +authors = [ + "Runtime Verification, Inc. ", +] +readme = "README.md" +include = ["kllvm/*"] + +[tool.poetry.dependencies] +python = ">=3.8" + + +[build-system] +requires = ["poetry-core"] +build-backend = "poetry.core.masonry.api"