2021-07-13 13:44:08 +00:00
|
|
|
{ lib
|
|
|
|
, cmake
|
|
|
|
, fetchFromGitHub
|
|
|
|
, fetchpatch
|
|
|
|
, lz4
|
|
|
|
, pkg-config
|
|
|
|
, python3
|
|
|
|
, stdenv
|
|
|
|
, unzip
|
|
|
|
, enablePython ? false
|
|
|
|
}:
|
2011-03-08 09:19:37 +00:00
|
|
|
|
2021-07-13 13:44:08 +00:00
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "flann";
|
|
|
|
version = "1.9.1";
|
2015-03-23 12:36:24 +00:00
|
|
|
|
2017-08-08 16:18:16 +00:00
|
|
|
src = fetchFromGitHub {
|
2021-07-13 13:44:08 +00:00
|
|
|
owner = "flann-lib";
|
2017-08-08 16:18:16 +00:00
|
|
|
repo = "flann";
|
2021-07-13 13:44:08 +00:00
|
|
|
rev = version;
|
2017-08-08 16:18:16 +00:00
|
|
|
sha256 = "13lg9nazj5s9a41j61vbijy04v6839i67lqd925xmxsbybf36gjc";
|
2011-03-08 09:19:37 +00:00
|
|
|
};
|
|
|
|
|
2018-05-30 16:11:41 +00:00
|
|
|
patches = [
|
2021-07-13 13:44:08 +00:00
|
|
|
# Patch HDF5_INCLUDE_DIR -> HDF_INCLUDE_DIRS.
|
2018-05-30 16:11:41 +00:00
|
|
|
(fetchpatch {
|
2021-07-13 13:44:08 +00:00
|
|
|
url = "https://salsa.debian.org/science-team/flann/-/raw/debian/1.9.1+dfsg-9/debian/patches/0001-Updated-fix-cmake-hdf5.patch";
|
|
|
|
sha256 = "yM1ONU4mu6lctttM5YcSTg8F344TNUJXwjxXLqzr5Pk=";
|
|
|
|
})
|
|
|
|
# Patch no-source library workaround that breaks on CMake > 3.11.
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://salsa.debian.org/science-team/flann/-/raw/debian/1.9.1+dfsg-9/debian/patches/0001-src-cpp-fix-cmake-3.11-build.patch";
|
|
|
|
sha256 = "REsBnbe6vlrZ+iCcw43kR5wy2o6q10RM73xjW5kBsr4=";
|
|
|
|
})
|
|
|
|
# Avoid the bundled version of LZ4 and instead use the system one.
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://salsa.debian.org/science-team/flann/-/raw/debian/1.9.1+dfsg-9/debian/patches/0003-Use-system-version-of-liblz4.patch";
|
|
|
|
sha256 = "xi+GyFn9PEjLgbJeAIEmsbp7ut9G9KIBkVulyT3nfsg=";
|
|
|
|
})
|
|
|
|
# Fix LZ4 string separator issue, see: https://github.com/flann-lib/flann/pull/480
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://github.com/flann-lib/flann/commit/25eb56ec78472bd419a121c6905095a793cf8992.patch";
|
|
|
|
sha256 = "qt8h576Gn8uR7+T9u9bEBIRz6e6AoTKpa1JfdZVvW9s=";
|
2018-05-30 16:11:41 +00:00
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2021-07-13 13:44:08 +00:00
|
|
|
cmakeFlags = [
|
|
|
|
"-DBUILD_EXAMPLES:BOOL=OFF"
|
|
|
|
"-DBUILD_TESTS:BOOL=OFF"
|
|
|
|
"-DBUILD_MATLAB_BINDINGS:BOOL=OFF"
|
|
|
|
"-DBUILD_PYTHON_BINDINGS:BOOL=${if enablePython then "ON" else "OFF"}"
|
|
|
|
];
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
cmake
|
|
|
|
pkg-config
|
|
|
|
unzip
|
|
|
|
];
|
|
|
|
|
|
|
|
propagatedBuildInputs = [ lz4 ];
|
|
|
|
|
|
|
|
buildInputs = lib.optionals enablePython [ python3 ];
|
2011-03-08 09:19:37 +00:00
|
|
|
|
|
|
|
meta = {
|
2022-02-06 10:42:01 +00:00
|
|
|
homepage = "https://github.com/flann-lib/flann";
|
2021-01-21 17:00:13 +00:00
|
|
|
license = lib.licenses.bsd3;
|
2011-03-08 09:19:37 +00:00
|
|
|
description = "Fast approximate nearest neighbor searches in high dimensional spaces";
|
2021-01-21 17:00:13 +00:00
|
|
|
maintainers = with lib.maintainers; [viric];
|
|
|
|
platforms = with lib.platforms; linux ++ darwin;
|
2011-03-08 09:19:37 +00:00
|
|
|
};
|
|
|
|
}
|