summaryrefslogtreecommitdiff
path: root/sci-mathematics/manifold/manifold-3.5.2.ebuild
blob: aa78a743a9b84bf34329ca346b3504addce4a61b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# Copyright 1999-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

PYTHON_COMPAT=( python3_{13..14} )
inherit cmake python-single-r1

DESCRIPTION="Geometry library for topological robustness"
HOMEPAGE="https://github.com/elalish/manifold"

if [[ ${PV} == *9999* ]] ; then
	inherit git-r3
	EGIT_REPO_URI="https://github.com/elalish/manifold.git"
else
	if [[ ${PV} = *pre* ]] ; then
		COMMIT="e7e0780114881dcf6e5ad934323f2595966865f9"
		SRC_URI="https://github.com/elalish/manifold/archive/${COMMIT}.tar.gz -> ${P}.tar.gz"
		S="${WORKDIR}/${PN}-${COMMIT}"
	else
		SRC_URI="https://github.com/elalish/manifold/releases/download/v${PV}/${P}.tar.gz"
	fi

	KEYWORDS="~amd64 ~arm64 ~x86"
fi

LICENSE="Apache-2.0"
# SONAME
SLOT="0/3"

IUSE="assimp debug python +tbb test"
REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"

RESTRICT="!test? ( test )"

RDEPEND="
	sci-mathematics/clipper2:=
	assimp? ( media-libs/assimp:= )
	tbb? ( dev-cpp/tbb:= )
	python? ( ${PYTHON_DEPS}
		$(python_gen_cond_dep '
			dev-python/numpy[${PYTHON_USEDEP}]
		')
	)
"
DEPEND="
	python? (
		$(python_gen_cond_dep '
			>=dev-python/nanobind-2.1.0[${PYTHON_USEDEP}]
		')
	)
	test? ( dev-cpp/gtest )
	${RDEPEND}
"

pkg_setup() {
	use python && python-single-r1_pkg_setup
}

src_configure() {
	local mycmakeargs=(
		-DMANIFOLD_CROSS_SECTION="yes"
		-DMANIFOLD_CROSS_SECTION_BACKEND="clipper2" # boolean2
		-DMANIFOLD_DEBUG="$(usex debug)"
		-DMANIFOLD_DOWNLOADS="no"
		-DASSIMP_ENABLE="$(usex assimp)"
		-DMANIFOLD_JSBIND="no"
		-DMANIFOLD_PAR="$(usex tbb ON OFF)"
		-DMANIFOLD_STRICT="no" # adds -Werror
		-DMANIFOLD_PYBIND="$(usex python)"
		-DMANIFOLD_TEST="$(usex test)"
	)

	cmake_src_configure
}

src_test() {
	if use x86; then
		local -x GTEST_FILTER="-Properties.ToleranceSphere:Boolean.AlmostCoplanar:Smooth.RefineQuads:Smooth.ToLength:Smooth.Torus"
	fi

	cmake_src_test
}