# Maintainer: Sertonix <sertonix@posteo.net>
pkgname=py3-nanobind
pkgver=2.4.0
pkgrel=0
pkgdesc="tiny and efficient C++/Python bindings"
url="https://pypi.org/project/nanobind/"
arch="noarch"
license="BSD-3-Clause"
depends="robin-map"
makedepends="
	cmake
	python3-dev
	py3-gpep517
	py3-scikit-build-core
	py3-wheel
	"
checkdepends="
	eigen-dev
	py3-numpy
	py3-pytest
	"
subpackages="$pkgname-pyc"
source="https://github.com/wjakob/nanobind/archive/refs/tags/v$pkgver/nanobind-$pkgver.tar.gz"
builddir="$srcdir/nanobind-$pkgver"

build() {
	CMAKE_ARGS="-DNB_USE_SUBMODULE_DEPS=OFF" \
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2

	if want_check; then
		cmake -B test-build -G Ninja \
			-DNB_USE_SUBMODULE_DEPS=OFF \
			-DNB_TEST=ON \
			-DNB_TEST_STABLE_ABI=ON \
			-DNB_TEST_SHARED_BUILD=ON
		cmake --build test-build
	fi
}

check() {
	cd test-build
	pytest
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl
}

sha512sums="
b018784f1ea07c6dd76b861a759e373ff78dbf78a278d19aed7bb2725b35fa9fe071ba34db264684ba697f2d8d4d6e64f16693590640ca2877783de981a952ab  nanobind-2.4.0.tar.gz
"
