ceres-solver-1.11.0.ebuild 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. # Copyright 1999-2017 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=6
  4. PYTHON_COMPAT=( python2_7 python3_{4,5} )
  5. inherit cmake-multilib eutils python-any-r1 toolchain-funcs
  6. DESCRIPTION="Nonlinear least-squares minimizer"
  7. HOMEPAGE="http://ceres-solver.org/"
  8. SRC_URI="${HOMEPAGE}/${P}.tar.gz"
  9. LICENSE="sparse? ( BSD ) !sparse? ( LGPL-2.1 ) cxsparse? ( BSD )"
  10. SLOT="0/1"
  11. KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
  12. IUSE="cxsparse c++11 doc examples gflags lapack openmp +schur sparse test"
  13. REQUIRED_USE="test? ( gflags ) sparse? ( lapack ) abi_x86_32? ( !sparse !lapack )"
  14. RDEPEND="
  15. dev-cpp/glog[gflags?,${MULTILIB_USEDEP}]
  16. cxsparse? ( sci-libs/cxsparse:0= )
  17. lapack? ( virtual/lapack )
  18. sparse? (
  19. sci-libs/amd:0=
  20. sci-libs/camd:0=
  21. sci-libs/ccolamd:0=
  22. sci-libs/cholmod:0=
  23. sci-libs/colamd:0=
  24. sci-libs/spqr:0=
  25. )"
  26. DEPEND="${RDEPEND}
  27. dev-cpp/eigen:3
  28. doc? ( dev-python/sphinx dev-python/sphinx_rtd_theme )
  29. lapack? ( virtual/pkgconfig )"
  30. pkg_pretend() {
  31. if [[ ${MERGE_TYPE} != binary ]] && use openmp; then
  32. if [[ $(tc-getCXX) == *g++* ]] && ! tc-has-openmp; then
  33. ewarn "OpenMP is not available in your current selected gcc"
  34. die "need openmp capable gcc"
  35. fi
  36. fi
  37. }
  38. pkg_setup() {
  39. use doc && python-any-r1_pkg_setup
  40. }
  41. src_prepare() {
  42. # search paths work for prefix
  43. sed -e "s:/usr:${EPREFIX}/usr:g" \
  44. -i cmake/*.cmake || die
  45. # remove Werror
  46. sed -e 's/-Werror=(all|extra)//g' \
  47. -i CMakeLists.txt || die
  48. # respect gentoo doc install directory
  49. sed -e "s:share/doc/ceres:share/doc/${PF}:" \
  50. -i docs/source/CMakeLists.txt || die
  51. cmake-utils_src_prepare
  52. }
  53. src_configure() {
  54. # CUSTOM_BLAS=OFF EIGENSPARSE=OFF MINIGLOG=OFF CXX11=OFF
  55. local mycmakeargs=(
  56. -DBUILD_SHARED_LIBS=ON
  57. -DBUILD_EXAMPLES=OFF
  58. -DENABLE_TESTING="$(usex test)"
  59. -DCXX11="$(usex c++11)"
  60. -DBUILD_DOCUMENTATION="$(usex doc)"
  61. -DGFLAGS="$(usex gflags)"
  62. -DLAPACK="$(usex lapack)"
  63. -DOPENMP="$(usex openmp)"
  64. -DSCHUR_SPECIALIZATIONS="$(usex schur)"
  65. -DCXSPARSE="$(usex cxsparse)"
  66. -DSUITESPARSE="$(usex sparse)"
  67. )
  68. use sparse || use cxsparse || mycmakeargs+=( -DEIGENSPARSE=ON )
  69. cmake-multilib_src_configure
  70. }
  71. src_install() {
  72. cmake-multilib_src_install
  73. dodoc README.md VERSION
  74. if use examples; then
  75. insinto /usr/share/doc/${PF}
  76. docompress -x /usr/share/doc/${PF}/examples
  77. doins -r examples data
  78. fi
  79. }