1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
6 PYTHON_COMPAT=( python2_7 )
8 inherit cmake-multilib eutils python-any-r1 toolchain-funcs
10 DESCRIPTION="Nonlinear least-squares minimizer"
11 HOMEPAGE="http://ceres-solver.org/"
12 SRC_URI="${HOMEPAGE}/${P}.tar.gz"
14 LICENSE="sparse? ( BSD ) !sparse? ( LGPL-2.1 ) cxsparse? ( BSD )"
16 KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
17 IUSE="cxsparse c++11 doc examples gflags lapack openmp +schur sparse test"
18 RESTRICT="!test? ( test )"
20 REQUIRED_USE="test? ( gflags ) sparse? ( lapack ) abi_x86_32? ( !sparse !lapack )"
23 dev-cpp/glog[gflags?,${MULTILIB_USEDEP}]
24 cxsparse? ( sci-libs/cxsparse:0= )
25 lapack? ( virtual/lapack )
37 doc? ( dev-python/sphinx dev-python/sphinx_rtd_theme )
38 lapack? ( virtual/pkgconfig )
42 if [[ ${MERGE_TYPE} != binary ]] && use openmp; then
43 if [[ $(tc-getCXX) == *g++* ]] && ! tc-has-openmp; then
44 ewarn "OpenMP is not available in your current selected gcc"
45 die "need openmp capable gcc"
51 use doc && python-any-r1_pkg_setup
55 # search paths work for prefix
56 sed -e "s:/usr:${EPREFIX}/usr:g" \
57 -i cmake/*.cmake || die
60 sed -e 's/-Werror=(all|extra)//g' \
61 -i CMakeLists.txt || die
63 # respect gentoo doc install directory
64 sed -e "s:share/doc/ceres:share/doc/${PF}:" \
65 -i docs/source/CMakeLists.txt || die
66 cmake-utils_src_prepare
70 # CUSTOM_BLAS=OFF EIGENSPARSE=OFF MINIGLOG=OFF CXX11=OFF
72 -DBUILD_SHARED_LIBS=ON
74 -DENABLE_TESTING="$(usex test)"
75 -DCXX11="$(usex c++11)"
76 -DBUILD_DOCUMENTATION="$(usex doc)"
77 -DGFLAGS="$(usex gflags)"
78 -DLAPACK="$(usex lapack)"
79 -DOPENMP="$(usex openmp)"
80 -DSCHUR_SPECIALIZATIONS="$(usex schur)"
81 -DCXSPARSE="$(usex cxsparse)"
82 -DSUITESPARSE="$(usex sparse)"
84 use sparse || use cxsparse || mycmakeargs+=( -DEIGENSPARSE=ON )
85 cmake-multilib_src_configure
89 cmake-multilib_src_install
90 dodoc README.md VERSION
93 insinto /usr/share/doc/${PF}
94 docompress -x /usr/share/doc/${PF}/examples
95 doins -r examples data