From bfde547c041dc23532152a405772b44bcc4adc80 Mon Sep 17 00:00:00 2001
From: Andre Sailer <andre.philippe.sailer@cern.ch>
Date: Mon, 23 Sep 2024 08:50:45 +0200
Subject: [PATCH] SPI-2654: add nanobind

---
 cmake/toolchain/heptools-dev-base.cmake |  1 +
 pyexternals/CMakeLists.txt              | 16 ++++++++++++++++
 2 files changed, 17 insertions(+)

diff --git a/cmake/toolchain/heptools-dev-base.cmake b/cmake/toolchain/heptools-dev-base.cmake
index d645e297cc..5298ad0db9 100644
--- a/cmake/toolchain/heptools-dev-base.cmake
+++ b/cmake/toolchain/heptools-dev-base.cmake
@@ -483,6 +483,7 @@ LCG_external_package(mypy_extensions   1.0.0
 LCG_external_package(mysql             10.5.20                                  )
 LCG_external_package(mysql_connector_python 8.0.18                            )
 LCG_external_package(namex             0.0.8                                    )
+LCG_external_package(nanobind          2.1.0                                    )
 LCG_external_package(nanomsg           1.1.5                                    )
 LCG_external_package(nbclassic         0.3.1                                    )
 LCG_external_package(nbclient          0.5.3                                    )
diff --git a/pyexternals/CMakeLists.txt b/pyexternals/CMakeLists.txt
index 282e99ebfb..1abfecf89f 100644
--- a/pyexternals/CMakeLists.txt
+++ b/pyexternals/CMakeLists.txt
@@ -17,6 +17,22 @@ endif()
 #=================================================================================================================
 LCGPackage_set_home(pytools)
 
+# to get the nanobind tarball
+# export NB_VERSION=2.1.0
+# git clone --recursive --branch v${NB_VERSION} https://github.com/wjakob/nanobind.git
+# tar czf nanobind-${NB_VERSION}.tar.gz --exclude=".git" nanobind
+LCGPackage_Add(
+  nanobind
+  URL ${GenURL}/nanobind-<VERSION>.tar.gz
+  CONFIGURE_COMMAND <VOID>
+  BUILD_COMMAND <VOID>
+  INSTALL_COMMAND ${MakeSitePackagesDir}
+          COMMAND ${PYTHON} -m pip install ${PySetupOptions} --no-deps .
+          COMMAND ${CMAKE_SOURCE_DIR}/pyexternals/Python_postinstall.sh <INSTALL_DIR>
+  BUILD_IN_SOURCE 1
+  DEPENDS Python pip CMake
+)
+
 #---tzdata--------------------------------------------------------------------
 LCGPackage_Add(
   tzdata
-- 
GitLab