summaryrefslogtreecommitdiff
blob: 62595e32d0d3f14be1e4bc0113d7fbe8322ca481 (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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

EAPI=6

FORTRAN_NEEDED="test"

inherit cmake-utils cuda fortran-2

DESCRIPTION="C++ template library for linear algebra"
HOMEPAGE="http://eigen.tuxfamily.org/"
SRC_URI="https://bitbucket.org/eigen/eigen/get/${PV}.tar.bz2 -> ${P}.tar.bz2"

LICENSE="LGPL-2 GPL-3"
SLOT="3"
KEYWORDS="~alpha ~amd64 ~arm ~ia64 ~ppc ~ppc64 ~sparc ~x86 ~amd64-linux ~x86-linux"
IUSE="altivec c++11 cuda debug doc neon openmp test" #zvector vsx

IUSE_CPU_FLAGS=" avx avx2 f16c fma3 sse2 sse3 sse4_1 sse4_2 ssse3" #x87
IUSE+=" ${IUSE_CPU_FLAGS// / cpu_flags_x86_}"

RDEPEND="!dev-cpp/eigen:0"
DEPEND="
	doc? ( app-doc/doxygen[dot,latex] )
	test? (
		dev-libs/gmp:0
		dev-libs/mpfr:0
		media-libs/freeglut
		media-libs/glew
		sci-libs/adolc
		sci-libs/cholmod
		sci-libs/fftw:3.0
		sci-libs/pastix
		sci-libs/umfpack
		sci-libs/scotch
		sci-libs/spqr
		sci-libs/superlu
		dev-qt/qtcore:4
		virtual/opengl
		virtual/pkgconfig
		cuda? ( dev-util/nvidia-cuda-toolkit )
	)
"
# Missing:
# METIS-5
# GOOGLEHASH

src_unpack() {
	default
	mv ${PN}* ${P} || die
}

src_prepare() {
	sed \
		-e 's:-g2::g' \
		-i cmake/EigenConfigureTesting.cmake || die

	sed -i CMakeLists.txt \
		-e "/add_subdirectory(demos/d" \
		|| die "sed disable unused bundles failed"

	if ! use test; then
		sed -i CMakeLists.txt \
			-e "/add_subdirectory(test/d" \
			|| die "sed disable tests failed"

		sed -i CMakeLists.txt \
			-e "/add_subdirectory(blas/d" \
			-e "/add_subdirectory(lapack/d" \
			|| die "sed disable unused bundles failed"
	fi

	sed -i -e "/Unknown build type/d" CMakeLists.txt || die

	use cuda && cuda_src_prepare

	cmake-utils_src_prepare
}

src_compile() {
	cmake-utils_src_compile
	use doc && cmake-utils_src_compile doc
}

src_test() {
	local mycmakeargs=(
		-DEIGEN_TEST_ALTIVEC="$(usex altivec)"
		-DEIGEN_TEST_CXX11="$(usex c++11)"
		-DEIGEN_TEST_CUDA="$(usex cuda)"
		-DEIGEN_TEST_OPENMP="$(usex openmp)"
		-DEIGEN_TEST_AVX="$(usex cpu_flags_x86_avx)"
		-DEIGEN_TEST_AVX512="$(usex cpu_flags_x86_avx2)"
		-DEIGEN_TEST_F16C="$(usex cpu_flags_x86_f16c)"
		-DEIGEN_TEST_FMA="$(usex cpu_flags_x86_fma3)"
		-DEIGEN_TEST_SSE3="$(usex cpu_flags_x86_sse3)"
		-DEIGEN_TEST_SSE4_1="$(usex cpu_flags_x86_sse4_1)"
		-DEIGEN_TEST_SSE4_2="$(usex cpu_flags_x86_sse4_2)"
		-DEIGEN_TEST_SSSE3="$(usex cpu_flags_x86_ssse3)"
		-DEIGEN_TEST_NEON64="$(usex neon)"
#		-DEIGEN_TEST_X87="$(usex cpu_flags_x86_x87)"
	)
	cmake-utils_src_configure
	cmake-utils_src_compile blas
	cmake-utils_src_compile buildtests
	cmake-utils_src_test
}

src_install() {
	cmake-utils_src_install
	use doc && dodoc -r "${BUILD_DIR}"/doc/html

	# Debian installs it and some projects started using it.
	insinto /usr/share/cmake/Modules/
	doins "${S}/cmake/FindEigen3.cmake"
}