summaryrefslogtreecommitdiff
blob: 94f8440399a28c8ff885c91efda8c638a42eef8d (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
# Copyright 2022-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

PYTHON_COMPAT=( python3_{9..10} )
inherit cmake python-any-r1

CommitId=c07e3a0400713d546e0dea2d5466dd22ea389c73

DESCRIPTION="acceleration package for neural network computations"
HOMEPAGE="https://github.com/Maratyszcza/NNPACK/"
SRC_URI="https://github.com/Maratyszcza/${PN}/archive/${CommitId}.tar.gz
	-> ${P}.tar.gz"

LICENSE="BSD-2"
SLOT="0"
KEYWORDS="~amd64"
IUSE=test
RESTRICT="test" # consuming too much CPU

RDEPEND="
	dev-libs/pthreadpool
	dev-libs/cpuinfo
"
DEPEND="${RDEPEND}
	dev-libs/FP16
	dev-libs/FXdiv
	dev-libs/psimd
"
BDEPEND="
	${PYTHON_DEPS}
	test? ( dev-cpp/gtest )
	$(python_gen_any_dep '
		dev-python/PeachPy[${PYTHON_USEDEP}]
	')
"

S="${WORKDIR}"/${PN}-${CommitId}

PATCHES=( "${FILESDIR}"/${P}-gentoo.patch )

python_check_deps() {
	python_has_version "dev-python/PeachPy[${PYTHON_USEDEP}]"
}

src_prepare() {
	sed -i -e "/-O/d" CMakeLists.txt || die
	cmake_src_prepare
}

src_configure() {
	local mycmakeargs=(
		-DNNPACK_BUILD_TESTS=$(usex test ON OFF)
	)
	cmake_src_configure
}