| 1 |
|
# Copyright 1999-2023 Gentoo Authors
|
|
1 |
# Copyright 1999-2024 Gentoo Authors
|
| 2 |
2 |
# Distributed under the terms of the GNU General Public License v2
|
| 3 |
3 |
|
| 4 |
4 |
EAPI=8
|
| 5 |
5 |
|
| 6 |
|
PYTHON_COMPAT=( python3_{9..11} )
|
|
6 |
PYTHON_COMPAT=( python3_{10..12} )
|
| 7 |
7 |
DOCS_BUILDER="sphinx"
|
| 8 |
8 |
DOCS_DEPEND="dev-python/sphinx-rtd-theme"
|
| 9 |
9 |
DOCS_DIR="docs/source"
|
| 10 |
|
inherit cmake-multilib python-any-r1 docs toolchain-funcs
|
|
10 |
inherit cmake-multilib cuda flag-o-matic python-any-r1 docs
|
| 11 |
11 |
|
| 12 |
12 |
DESCRIPTION="Nonlinear least-squares minimizer"
|
| 13 |
13 |
HOMEPAGE="http://ceres-solver.org/"
|
| 14 |
14 |
SRC_URI="http://ceres-solver.org/${P}.tar.gz"
|
| 15 |
15 |
|
| 16 |
|
LICENSE="sparse? ( BSD ) !sparse? ( LGPL-2.1 ) cxsparse? ( BSD )"
|
|
16 |
LICENSE="sparse? ( BSD ) !sparse? ( LGPL-2.1 )"
|
| 17 |
17 |
SLOT="0/1"
|
| 18 |
18 |
KEYWORDS="amd64 ~x86 ~amd64-linux ~x86-linux"
|
| 19 |
|
IUSE="cxsparse examples gflags lapack openmp +schur sparse test"
|
|
19 |
IUSE="examples cuda gflags lapack +schur sparse test"
|
| 20 |
20 |
|
| 21 |
21 |
REQUIRED_USE="test? ( gflags ) sparse? ( lapack ) abi_x86_32? ( !sparse !lapack )"
|
| 22 |
22 |
RESTRICT="!test? ( test )"
|
| ... | ... | |
| 28 |
28 |
"
|
| 29 |
29 |
RDEPEND="
|
| 30 |
30 |
dev-cpp/glog[gflags?,${MULTILIB_USEDEP}]
|
| 31 |
|
cxsparse? ( sci-libs/cxsparse )
|
|
31 |
cuda? ( dev-util/nvidia-cuda-toolkit:= )
|
| 32 |
32 |
lapack? ( virtual/lapack )
|
| 33 |
33 |
sparse? (
|
| 34 |
34 |
sci-libs/amd
|
| ... | ... | |
| 45 |
45 |
|
| 46 |
46 |
PATCHES=(
|
| 47 |
47 |
"${FILESDIR}/${PN}-2.0.0-system-mathjax.patch"
|
|
48 |
"${FILESDIR}/${PN}-2.2.0-include-algorithm.patch"
|
| 48 |
49 |
)
|
| 49 |
50 |
|
| 50 |
|
pkg_pretend() {
|
| 51 |
|
[[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp
|
| 52 |
|
}
|
| 53 |
|
|
| 54 |
|
pkg_setup() {
|
| 55 |
|
[[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp
|
| 56 |
|
use doc && python-any-r1_pkg_setup
|
| 57 |
|
}
|
| 58 |
|
|
| 59 |
51 |
src_prepare() {
|
| 60 |
52 |
cmake_src_prepare
|
| 61 |
53 |
|
|
54 |
filter-lto
|
|
55 |
|
| 62 |
56 |
# search paths work for prefix
|
| 63 |
57 |
sed -e "s:/usr:${EPREFIX}/usr:g" \
|
| 64 |
58 |
-i cmake/*.cmake || die
|
| ... | ... | |
| 69 |
63 |
}
|
| 70 |
64 |
|
| 71 |
65 |
src_configure() {
|
| 72 |
|
# CUSTOM_BLAS=OFF EIGENSPARSE=OFF MINIGLOG=OFF CXX11=OFF
|
|
66 |
# CUSTOM_BLAS=OFF EIGENSPARSE=OFF MINIGLOG=OFF
|
| 73 |
67 |
local mycmakeargs=(
|
| 74 |
68 |
-DBUILD_BENCHMARKS=OFF
|
| 75 |
69 |
-DBUILD_EXAMPLES=$(usex examples)
|
| ... | ... | |
| 78 |
72 |
-DGFLAGS=$(usex gflags)
|
| 79 |
73 |
-DLAPACK=$(usex lapack)
|
| 80 |
74 |
-DSCHUR_SPECIALIZATIONS=$(usex schur)
|
| 81 |
|
-DCXSPARSE=$(usex cxsparse)
|
| 82 |
75 |
-DSUITESPARSE=$(usex sparse)
|
| 83 |
76 |
-DEigen3_DIR=/usr/$(get_libdir)/cmake/eigen3
|
| 84 |
|
-DCERES_THREADING_MODEL=$(usex openmp OPENMP CXX_THREADS)
|
| 85 |
|
)
|
| 86 |
77 |
|
| 87 |
|
use doc && mycmakeargs+=(
|
| 88 |
|
-DCERES_DOCS_INSTALL_DIR="${EPREFIX}"/usr/share/doc/${PF}
|
|
78 |
-DBUILD_SHARED_LIBS="yes"
|
|
79 |
-DEIGENMETIS="yes"
|
|
80 |
-DEIGENSPARSE="yes"
|
|
81 |
-DMINIGLOG="no"
|
|
82 |
-DCUSTOM_BLAS="yes"
|
|
83 |
-DUSE_CUDA="$(usex cuda)"
|
| 89 |
84 |
)
|
| 90 |
|
use sparse || use cxsparse || mycmakeargs+=( -DEIGENSPARSE=ON )
|
|
85 |
|
|
86 |
if use cuda; then
|
|
87 |
: "${CUDAHOSTCXX:=$(cuda_gccdir)}"
|
|
88 |
: "${CUDAARCHS:=all}"
|
|
89 |
export CUDAHOSTCXX
|
|
90 |
export CUDAARCHS
|
|
91 |
fi
|
|
92 |
|
|
93 |
use sparse || mycmakeargs+=( -DEIGENSPARSE=ON )
|
| 91 |
94 |
|
| 92 |
95 |
cmake-multilib_src_configure
|
| 93 |
96 |
}
|
| 94 |
97 |
|
|
98 |
src_test() {
|
|
99 |
use cuda && cuda_add_sandbox -w
|
|
100 |
cmake_src_test
|
|
101 |
}
|
|
102 |
|
| 95 |
103 |
src_install() {
|
| 96 |
104 |
cmake-multilib_src_install
|
| 97 |
105 |
|