New port: math/flann: Library for fast nearest neighbor searches in high dimensional spaces

Submitted by:	myself
Approved by:	tcberner (mentor)
Differential Revision:	https://reviews.freebsd.org/D13692
This commit is contained in:
Yuri Victorovich 2017-12-30 19:45:33 +00:00
parent d4fe4df264
commit 936f63cf4a
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=457634
8 changed files with 178 additions and 0 deletions

View File

@ -183,6 +183,7 @@
SUBDIR += fftw3-long
SUBDIR += fftw3-quad
SUBDIR += fityk
SUBDIR += flann
SUBDIR += form
SUBDIR += fpc-fftw
SUBDIR += fpc-gmp

30
math/flann/Makefile Normal file
View File

@ -0,0 +1,30 @@
# $FreeBSD$
PORTNAME= flann
DISTVERSION= 1.8.4
DISTVERSIONSUFFIX= -src
CATEGORIES= math
MASTER_SITES= http://people.cs.ubc.ca/~mariusm/uploads/FLANN/
MAINTAINER= yuri@FreeBSD.org
COMMENT= Library for fast nearest neighbor searches in high dimensional spaces
LICENSE= BSD3CLAUSE
LICENSE_FILE= ${WRKSRC}/COPYING
LIB_DEPENDS= libhdf5.so:science/hdf5 \
libsz.so:science/szip
USES= cmake:outsource zip
CMAKE_ARGS= -DBUILD_PYTHON_BINDINGS:BOOL=OFF \
-DBUILD_MATLAB_BINDINGS:BOOL=OFF \
-DEXAMPLES_SUBDIR:STRING="share/examples/flann" \
-DUSE_OPENMP:BOOL=OFF # OpenMP search is broken in cmake: https://gitlab.kitware.com/cmake/cmake/issues/17474
USE_LDCONFIG= yes
OPTIONS_DEFINE= DOCS EXAMPLES
PLIST_SUB= SHL3=${DISTVERSION} SHL2=${DISTVERSION:R}
EXAMPLES_CMAKE_BOOL= BUILD_EXAMPLES
.include <bsd.port.mk>

3
math/flann/distinfo Normal file
View File

@ -0,0 +1,3 @@
TIMESTAMP = 1514618300
SHA256 (flann-1.8.4-src.zip) = dfbb9321b0d687626a644c70872a2c540b16200e7f4c7bd72f91ae032f445c08
SIZE (flann-1.8.4-src.zip) = 561057

View File

@ -0,0 +1,29 @@
--- examples/CMakeLists.txt.orig 2013-01-16 06:38:32 UTC
+++ examples/CMakeLists.txt
@@ -7,7 +7,7 @@ if (BUILD_C_BINDINGS)
set_target_properties(flann_example_c PROPERTIES COMPILE_FLAGS -std=c99)
add_dependencies(examples flann_example_c)
- install (TARGETS flann_example_c DESTINATION bin )
+ install (TARGETS flann_example_c DESTINATION ${EXAMPLES_SUBDIR})
endif()
if (HDF5_FOUND)
@@ -20,7 +20,7 @@ if (HDF5_FOUND)
endif()
add_dependencies(examples flann_example_cpp)
- install (TARGETS flann_example_cpp DESTINATION bin)
+ install (TARGETS flann_example_cpp DESTINATION ${EXAMPLES_SUBDIR})
if (USE_MPI AND HDF5_IS_PARALLEL)
@@ -28,7 +28,7 @@ if (HDF5_FOUND)
target_link_libraries(flann_example_mpi flann_cpp ${HDF5_LIBRARIES} ${MPI_LIBRARIES} ${Boost_LIBRARIES})
add_dependencies(examples flann_example_mpi)
- install (TARGETS flann_example_mpi DESTINATION bin)
+ install (TARGETS flann_example_mpi DESTINATION ${EXAMPLES_SUBDIR})
endif()
else()
message("hdf5 library not found, not compiling flann_example.cpp")

View File

@ -0,0 +1,29 @@
--- src/cpp/CMakeLists.txt.orig 2013-01-16 06:38:32 UTC
+++ src/cpp/CMakeLists.txt
@@ -8,7 +8,7 @@ file(GLOB_RECURSE C_SOURCES flann.cpp)
file(GLOB_RECURSE CPP_SOURCES flann_cpp.cpp)
file(GLOB_RECURSE CU_SOURCES *.cu)
-add_library(flann_cpp_s STATIC ${CPP_SOURCES})
+add_library(flann_cpp_s SHARED ${CPP_SOURCES})
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_CLANG)
set_target_properties(flann_cpp_s PROPERTIES COMPILE_FLAGS -fPIC)
endif()
@@ -24,7 +24,7 @@ if (BUILD_CUDA_LIB)
else()
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS};-arch=sm_13" )
endif()
- cuda_add_library(flann_cuda_s STATIC ${CU_SOURCES})
+ cuda_add_library(flann_cuda_s SHARED ${CU_SOURCES})
set_property(TARGET flann_cuda_s PROPERTY COMPILE_DEFINITIONS FLANN_STATIC)
endif()
@@ -76,7 +76,7 @@ endif()
if (BUILD_C_BINDINGS)
- add_library(flann_s STATIC ${C_SOURCES})
+ add_library(flann_s SHARED ${C_SOURCES})
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_CLANG)
set_target_properties(flann_s PROPERTIES COMPILE_FLAGS -fPIC)
endif()

View File

@ -0,0 +1,19 @@
--- src/cpp/flann/algorithms/kdtree_index.h.orig 2013-01-16 06:38:32 UTC
+++ src/cpp/flann/algorithms/kdtree_index.h
@@ -36,6 +36,7 @@
#include <cassert>
#include <cstring>
#include <stdarg.h>
+#include <math.h>
#include "flann/general.h"
#include "flann/algorithms/nn_index.h"
@@ -663,7 +664,7 @@ private:
ElementType max_span = 0;
size_t div_feat = 0;
for (size_t i=0;i<veclen_;++i) {
- ElementType span = abs(point[i]-leaf_point[i]);
+ ElementType span = fabs(point[i]-leaf_point[i]);
if (span > max_span) {
max_span = span;
div_feat = i;

9
math/flann/pkg-descr Normal file
View File

@ -0,0 +1,9 @@
FLANN is a library for performing fast approximate nearest neighbor searches in
high dimensional spaces. It contains a collection of algorithms we found to
work best for nearest neighbor search and a system for automatically choosing
the best algorithm and optimum parameters depending on the dataset.
FLANN is written in C++ and contains bindings for the following languages: C,
MATLAB and Python.
WWW: https://www.cs.ubc.ca/research/flann

58
math/flann/pkg-plist Normal file
View File

@ -0,0 +1,58 @@
include/flann/algorithms/all_indices.h
include/flann/algorithms/autotuned_index.h
include/flann/algorithms/center_chooser.h
include/flann/algorithms/composite_index.h
include/flann/algorithms/dist.h
include/flann/algorithms/hierarchical_clustering_index.h
include/flann/algorithms/kdtree_cuda_3d_index.h
include/flann/algorithms/kdtree_cuda_builder.h
include/flann/algorithms/kdtree_index.h
include/flann/algorithms/kdtree_single_index.h
include/flann/algorithms/kmeans_index.h
include/flann/algorithms/linear_index.h
include/flann/algorithms/lsh_index.h
include/flann/algorithms/nn_index.h
include/flann/config.h
include/flann/defines.h
include/flann/flann.h
include/flann/flann.hpp
include/flann/general.h
include/flann/io/hdf5.h
include/flann/mpi/client.h
include/flann/mpi/index.h
include/flann/mpi/matrix.h
include/flann/mpi/queries.h
include/flann/mpi/server.h
include/flann/nn/ground_truth.h
include/flann/nn/index_testing.h
include/flann/nn/simplex_downhill.h
include/flann/util/allocator.h
include/flann/util/any.h
include/flann/util/cuda/heap.h
include/flann/util/cuda/result_set.h
include/flann/util/cutil_math.h
include/flann/util/dynamic_bitset.h
include/flann/util/heap.h
include/flann/util/logger.h
include/flann/util/lsh_table.h
include/flann/util/matrix.h
include/flann/util/object_factory.h
include/flann/util/params.h
include/flann/util/random.h
include/flann/util/result_set.h
include/flann/util/sampling.h
include/flann/util/saving.h
include/flann/util/serialization.h
include/flann/util/timer.h
lib/libflann.so
lib/libflann.so.%%SHL2%%
lib/libflann.so.%%SHL3%%
lib/libflann_cpp.so
lib/libflann_cpp.so.%%SHL2%%
lib/libflann_cpp.so.%%SHL3%%
lib/libflann_cpp_s.so
lib/libflann_s.so
libdata/pkgconfig/flann.pc
%%PORTDOCS%%%%DOCSDIR%%/manual.pdf
%%PORTEXAMPLES%%%%EXAMPLESDIR%%/flann_example_c
%%PORTEXAMPLES%%%%EXAMPLESDIR%%/flann_example_cpp