# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: Celeste <cielesti@protonmail.com>
maintainer="Celeste <cielesti@protonmail.com>"
pkgname=catch2-3
pkgver=3.8.1
pkgrel=0
arch="all"
url="https://github.com/catchorg/Catch2"
pkgdesc="Modern, C++-native, header-only, test framework for unit-tests (v3)"
license="BSL-1.0"
makedepends="
	cmake
	python3
	samurai
	"
source="https://github.com/catchorg/Catch2/archive/v$pkgver/catch2-v$pkgver.tar.gz"
subpackages="$pkgname-doc"
builddir="$srcdir/Catch2-$pkgver"

build() {
	# Set -DCATCH_DEVELOPMENT_BUILD to enable tests
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=MinSizeRel \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DCATCH_DEVELOPMENT_BUILD="$(want_check && echo ON || echo OFF)" \
		-DCATCH_BUILD_EXTRA_TESTS="$(want_check && echo ON || echo OFF)" \
		-DCATCH_ENABLE_WERROR=OFF
	cmake --build build
}

check() {
	# ApprovalTests is broken https://github.com/catchorg/Catch2/issues/1780
	ctest --test-dir build -E "ApprovalTests"
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
071f407dfefa84c3f766e32de48525dcaa50f5c5b0a2e2e9e615fdfff8d36476c7a28c9c27f4030fcf2f5f612043124efe61582bc2c174ddb62b4f307f74ffc5  catch2-v3.8.1.tar.gz
"
