flann-1.9.1-r3.ebuild 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. # Copyright 2022 Gentoo Authors
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=8
  4. inherit cmake cuda flag-o-matic toolchain-funcs
  5. DESCRIPTION="Fast approximate nearest neighbor searches in high dimensional spaces"
  6. HOMEPAGE="https://github.com/flann-lib/flann"
  7. SRC_URI="https://github.com/flann-lib/${PN}/archive/${PV}.tar.gz -> ${P}.tar.gz"
  8. LICENSE="BSD"
  9. SLOT="0"
  10. KEYWORDS="amd64 ~arm arm64 ~ppc x86 ~amd64-linux ~x86-linux"
  11. IUSE="cuda doc examples mpi octave openmp static-libs"
  12. BDEPEND="
  13. app-arch/unzip
  14. doc? ( dev-tex/latex2html )
  15. "
  16. DEPEND="
  17. app-arch/lz4:=
  18. cuda? ( >=dev-util/nvidia-cuda-toolkit-5.5 )
  19. mpi? (
  20. dev-libs/boost:=[mpi]
  21. sci-libs/hdf5[mpi]
  22. )
  23. !mpi? ( !sci-libs/hdf5[mpi] )
  24. octave? ( >=sci-mathematics/octave-3.6.4-r1 )
  25. "
  26. RDEPEND="${DEPEND}"
  27. # TODO:
  28. # readd dependencies for test suite,
  29. # requires multiple ruby dependencies
  30. PATCHES=(
  31. "${FILESDIR}"/${P}-cmake-3.11{,-1}.patch # bug 678030
  32. "${FILESDIR}"/${P}-cuda-9.patch
  33. "${FILESDIR}"/${P}-system-lz4.patch # bug 681898
  34. )
  35. pkg_pretend() {
  36. [[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp
  37. }
  38. pkg_setup() {
  39. [[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp
  40. }
  41. src_prepare() {
  42. # bug #302621
  43. use mpi && export CXX=mpicxx
  44. # produce pure octave files
  45. # octave gentoo installation for .m files respected
  46. sed -i \
  47. -e 's/--mex//' \
  48. -e 's/\.mex/\.oct/' \
  49. -e '/FILES/s/${MEX_FILE}//' \
  50. -e 's:share/flann/octave:share/octave/site/m:' \
  51. -e "/CUSTOM_TARGET/a\INSTALL(FILES \${MEX_FILE} DESTINATION libexec/octave/site/oct/${CHOST})" \
  52. src/matlab/CMakeLists.txt || die
  53. use cuda && cuda_src_prepare
  54. cmake_src_prepare
  55. }
  56. src_configure() {
  57. append-cxxflags -std=c++14
  58. # python bindings are split off into dev-python/pyflann
  59. local mycmakeargs=(
  60. -DBUILD_C_BINDINGS=ON
  61. -DBUILD_PYTHON_BINDINGS=OFF
  62. -DPYTHON_EXECUTABLE=
  63. -DBUILD_CUDA_LIB=$(usex cuda)
  64. -DBUILD_EXAMPLES=$(usex examples)
  65. -DBUILD_DOC=$(usex doc)
  66. -DBUILD_TESTS=OFF
  67. -DBUILD_MATLAB_BINDINGS=$(usex octave)
  68. -DUSE_MPI=$(usex mpi)
  69. -DUSE_OPENMP=$(usex openmp)
  70. )
  71. use cuda && mycmakeargs+=(
  72. -DCUDA_NVCC_FLAGS="${NVCCFLAGS} --linker-options \"-arsch\""
  73. )
  74. use doc && mycmakeargs+=( -DDOCDIR=share/doc/${PF} )
  75. cmake_src_configure
  76. }
  77. src_install() {
  78. cmake_src_install
  79. use !static-libs && ( find "${D}" -name '*.a' -delete || die )
  80. }