From f223ce6c779fa42b8eeeeff4cd661448d20dca71 Mon Sep 17 00:00:00 2001
From: Lars Bilke <lars.bilke@ufz.de>
Date: Mon, 5 Sep 2022 11:52:31 +0200
Subject: [PATCH] [py] Added scikit-build.

Build with:

```
pip install .
```
---
 .gitignore                         |  4 ++++
 pyproject.toml                     |  8 ++++++++
 scripts/cmake/packaging/Pack.cmake |  4 +++-
 setup.py                           | 14 ++++++++++++++
 4 files changed, 29 insertions(+), 1 deletion(-)
 create mode 100644 pyproject.toml
 create mode 100644 setup.py

diff --git a/.gitignore b/.gitignore
index 1c8d2d8653f..a023a253f49 100644
--- a/.gitignore
+++ b/.gitignore
@@ -38,4 +38,8 @@ CMakeUserPresets.json
 nohup.out
 
 /Documentation/.vale
+
+# Python build
+/_skbuild
+*.egg-info/
 .ipynb_checkpoints
diff --git a/pyproject.toml b/pyproject.toml
new file mode 100644
index 00000000000..5c7d0579bbd
--- /dev/null
+++ b/pyproject.toml
@@ -0,0 +1,8 @@
+[build-system]
+requires = [
+  "setuptools>=42",
+  "scikit-build>=0.15.0",
+  "cmake>=3.22",
+  "ninja; platform_system!='Windows'",
+]
+build-backend = "setuptools.build_meta"
diff --git a/scripts/cmake/packaging/Pack.cmake b/scripts/cmake/packaging/Pack.cmake
index 8c1daaf61bc..33b91a33fc6 100644
--- a/scripts/cmake/packaging/Pack.cmake
+++ b/scripts/cmake/packaging/Pack.cmake
@@ -76,7 +76,9 @@ if(OGS_USE_PYTHON)
         install(FILES ${PYTHON_RUNTIME_LIBS} DESTINATION bin)
         file(COPY ${PYTHON_RUNTIME_LIBS} DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
     else()
-        install(FILES ${Python_LIBRARIES} DESTINATION bin)
+        file(INSTALL ${Python_LIBRARIES} DESTINATION ${CMAKE_INSTALL_LIBDIR}
+             FOLLOW_SYMLINK_CHAIN
+        )
     endif()
 endif()
 
diff --git a/setup.py b/setup.py
new file mode 100644
index 00000000000..58e18d9ad73
--- /dev/null
+++ b/setup.py
@@ -0,0 +1,14 @@
+from skbuild import setup
+from setuptools import find_packages
+
+setup(
+    name="ogs",
+    version="6.4.2",
+    description="OpenGeoSys",
+    author="OpenGeoSys Community",
+    license="BSD-3-Clause",
+    packages=find_packages(where="."),
+    package_dir={"": "."},
+    cmake_args=["-DOGS_BUILD_PROCESSES=SteadyStateDiffusion", "-DOGS_BUILD_UTILS=OFF"],
+    python_requires=">=3.6",
+)
-- 
GitLab