Skip to contentSkip to conversation

python3-scikit-build-core: Use cmake from PATH

PATCH Superseded Zoltán Böszörményi 1 participant 2 messages Nov 12, 2025

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 python3-scikit-build-core: Use cmake from PATH

Added a patch to remove using CMAKE_BIN_DIR. Instead, use the fallback to find cmake from PATH.

It's a pre-requisite for building python3-nanobind correctly.

---
 ...e-from-PATH-instead-of-CMAKE_BIN_DIR.patch | 47 +++++++++++++++++++
 .../python3-scikit-build-core_0.11.6.bb       |  5 +-
 2 files changed, 51 insertions(+), 1 deletion(-)
 create mode 100644 meta-python/recipes-devtools/python/python3-scikit-build-core/0001-Find-cmake-from-PATH-instead-of-CMAKE_BIN_DIR.patch
meta-python/recipes-devtools/python/python3-scikit-build-core/0001-Find-cmake-from-PATH-instead-of-CMAKE_BIN_DIR.patch new file +47 -0
new file mode 100644
index 0000000000..71319c0245
@@ -0,0 +1,47 @@
+From deb225d2aaeb44f6a4c01eab25624193351f7f58 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Zolt=C3=A1n=20B=C3=B6sz=C3=B6rm=C3=A9nyi?=
+ <[email protected]>
+Date: Wed, 12 Nov 2025 09:56:59 +0100
+Subject: [PATCH] Find cmake from PATH instead of CMAKE_BIN_DIR
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+python3-cmake is patched to run cmake from PATH.
+
+Another detail called CMAKE_BIN_DIR is not patched out, but
+scikit-build-core prefers using it in its program_search.py.
+It also has a fallback to find cmake from PATH.
+
+Remove using CMAKE_BIN_DIR and keep the fallback.
+
+Signed-off-by: Zoltán Böszörményi <[email protected]>
+Upstream-Status: Inappropriate [oe specific]
+---
+ src/scikit_build_core/program_search.py | 10 ----------
+ 1 file changed, 10 deletions(-)
+
+diff --git a/src/scikit_build_core/program_search.py b/src/scikit_build_core/program_search.py
+index 7995c14..f82cad3 100644
+--- a/src/scikit_build_core/program_search.py
++++ b/src/scikit_build_core/program_search.py
+@@ -90,16 +90,6 @@ class Program(NamedTuple):
+ 
+ 
+ def _get_cmake_path(*, module: bool = True) -> Generator[Path, None, None]:
+-    """
+-    Get the path to CMake.
+-    """
+-    if module:
+-        with contextlib.suppress(ImportError):
+-            # If a "cmake" directory exists, this will also ImportError
+-            from cmake import CMAKE_BIN_DIR
+-
+-            yield Path(CMAKE_BIN_DIR) / "cmake"
+-
+     candidates = ("cmake3", "cmake")
+     for candidate in candidates:
+         cmake_path = shutil.which(candidate)
+-- 
+2.51.1
+
meta-python/recipes-devtools/python/python3-scikit-build-core_0.11.6.bb +4 -1
index 73cbf2a3f9..93a83ead65 100644
@@ -9,7 +9,10 @@ DEPENDS = "python3-hatch-vcs-native"
 
 inherit pypi python_hatchling
 
-SRC_URI += "file://0001-builder.py-Check-PYTHON_INCLUDE_DIR.patch"
+SRC_URI += " \
+	file://0001-builder.py-Check-PYTHON_INCLUDE_DIR.patch \
+	file://0001-Find-cmake-from-PATH-instead-of-CMAKE_BIN_DIR.patch \
+"
 SRC_URI[sha256sum] = "5982ccd839735be99cfd3b92a8847c6c196692f476c215da84b79d2ad12f9f1b"
 
 BBCLASSEXTEND = "native nativesdk"
Signature · 1 line
2.51.1
#1 lore raw

PATCH 2/2 python3-nanobind: Fix build

Fix the order of inherited classes, so the nanobuild python module actually gets built.

Also, put the cmake files into the correct location, i.e.
${libdir}/cmake/nanobind
instead of
${base_libdir}/cmake/python3-nanobind

onnx 1.20.0rc1 uses nanobind and during its build it detects the presence of the python module, and wants to use the nanobind cmake module, both of which fail.

---
 .../recipes-devtools/python/python3-nanobind_2.9.2.bb     | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
meta-python/recipes-devtools/python/python3-nanobind_2.9.2.bb +5 -3
index 85105fd196..a70ad2ae18 100644
@@ -6,7 +6,9 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=7646f9ee25e49eaf53f89a10665c568c"
 
 SRC_URI[sha256sum] = "e7608472de99d375759814cab3e2c94aba3f9ec80e62cfef8ced495ca5c27d6e"
 
-inherit pypi python_setuptools_build_meta cmake lib_package
+DEPENDS = "python3-cmake-native"
+
+inherit pypi cmake python_setuptools_build_meta
 
 EXTRA_OECMAKE += "-DNB_TEST=OFF"
 
@@ -17,8 +19,8 @@ DEPENDS += "\
 "
 
 do_install:append() {
-    install -d ${D}${base_libdir}/cmake/${PN}
-    install -m 0644 ${S}/cmake/* ${D}${base_libdir}/cmake/${PN}/
+    install -d ${D}${libdir}/cmake/${PYPI_PACKAGE}
+    install -m 0644 ${S}/cmake/* ${D}${libdir}/cmake/${PYPI_PACKAGE}/
 }
 
 FILES:${PN} += "${prefix_native}/* ${prefix_native}/${PN}/* ${base_libdir}/cmake/*"
Signature · 1 line
2.51.1