From 2125afb2f46faceb4d653ca0da545faf3b43f894 Mon Sep 17 00:00:00 2001 From: Bruce Collie Date: Thu, 1 Sep 2022 16:17:35 +0100 Subject: [PATCH] Install KLLVM python package (#553) * Rename module to _kllvm * Install kllvm as a package * Stand in toml * Package structure * README * Don't build? * Python evrsion * Fix ignored build * Update authors --- bindings/python/CMakeLists.txt | 11 +++++++---- bindings/python/ast.cpp | 2 +- bindings/python/package/README.md | 0 bindings/python/package/kllvm/__init__.py | 1 + bindings/python/package/pyproject.toml | 17 +++++++++++++++++ 5 files changed, 26 insertions(+), 5 deletions(-) create mode 100644 bindings/python/package/README.md create mode 100644 bindings/python/package/kllvm/__init__.py create mode 100644 bindings/python/package/pyproject.toml 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"