Commit 3a037043 authored by rdiankov's avatar rdiankov
Browse files

forgot flann-1.6.6

parent 7bd2ab44
Loading
Loading
Loading
Loading
+112 −0
Original line number Diff line number Diff line
cmake_minimum_required(VERSION 2.6)

if(COMMAND cmake_policy)
    cmake_policy(SET CMP0003 NEW)
endif(COMMAND cmake_policy)

project(flann)
string(TOLOWER ${PROJECT_NAME} PROJECT_NAME_LOWER)

include(${PROJECT_SOURCE_DIR}/cmake/flann_utils.cmake)
set(FLANN_VERSION 1.6.6)
DISSECT_VERSION()
GET_OS_INFO()

# Add an "uninstall" target
#CONFIGURE_FILE ("${PROJECT_SOURCE_DIR}/cmake/uninstall_target.cmake.in"
#    "${PROJECT_BINARY_DIR}/uninstall_target.cmake" IMMEDIATE @ONLY)
#ADD_CUSTOM_TARGET (uninstall "${CMAKE_COMMAND}" -P
#    "${PROJECT_BINARY_DIR}/uninstall_target.cmake")

if (NOT DEFINED CMAKE_INSTALL_PREFIX)
    set(CMAKE_INSTALL_PREFIX /usr/local)
endif()

# Set the build type.  Options are:
#  Debug          : w/ debug symbols, w/o optimization
#  Release        : w/o debug symbols, w/ optimization
#  RelWithDebInfo : w/ debug symbols, w/ optimization
#  MinSizeRel     : w/o debug symbols, w/ optimization, stripped binaries

if (NOT DEFINED CMAKE_BUILD_TYPE)
    #set(CMAKE_BUILD_TYPE Release)
    set(CMAKE_BUILD_TYPE RelWithDebInfo)
    #set(CMAKE_BUILD_TYPE Debug)
endif()

message("Install prefix: ${CMAKE_INSTALL_PREFIX}")
message("Build type: ${CMAKE_BUILD_TYPE}")


#set the default path for built executables to the "bin" directory
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
#set the default path for built libraries to the "lib" directory
set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)
# set output path for tests
set(TEST_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/test)


if (NOT DEFINED BUILD_C_BINDINGS)
    set(BUILD_C_BINDINGS true)
endif()

if (NOT DEFINED BUILD_PYTHON_BINDINGS)
    set(BUILD_PYTHON_BINDINGS true)
endif()

if (NOT DEFINED BUILD_MATLAB_BINDINGS)
    set(BUILD_MATLAB_BINDINGS true)
endif()

if (NOT BUILD_C_BINDINGS)
    set(BUILD_PYTHON_BINDINGS false)
    set(BUILD_MATLAB_BINDINGS false)
endif()

message("Building C bindings: ${BUILD_C_BINDINGS}")
message("Building python bindings: ${BUILD_PYTHON_BINDINGS}")
message("Building matlab bindings: ${BUILD_MATLAB_BINDINGS}")


message("USE_MPI: ${USE_MPI}")

find_hdf5()
if (USE_MPI OR HDF5_IS_PARALLEL)
    find_package(MPI)
endif()

if (HDF5_IS_PARALLEL)
    if (NOT MPI_FOUND)
        message(ERROR "Found the parallel HDF5 library, but could not find the MPI library. Define the MPI_COMPILER variable to the path of your MPI compiler.")
    endif()
    # Parallel HDF5 needs to find the "mpi.h" header file
    include_directories(${MPI_INCLUDE_PATH})
endif()


if (USE_MPI)
    if (NOT MPI_FOUND)
        message(ERROR "Could not find an MPI library. Define the MPI_COMPILER variable to the path of your MPI compiler.")
    endif()

    if (NOT HDF5_IS_PARALLEL)
        message(ERROR "For MPI support the Parallel HDF5 library is required.")
    endif()

endif(USE_MPI)



#set the C/C++ include path to the "include" directory
include_directories(${PROJECT_SOURCE_DIR}/src/cpp)

# require proper c++
#add_definitions( "-Wall -ansi -pedantic" )
# HDF5 uses long long which is not ansi
add_definitions( "-Wall" )

add_subdirectory( cmake )
add_subdirectory( src )
#add_subdirectory( examples )
#add_subdirectory( test )
#add_subdirectory( doc )
+48 −0
Original line number Diff line number Diff line
.PHONY: tests test libs doc all clean examples

BUILD_TYPE?='Release'
INSTALL_PREFIX?=/usr/local
BUILD_C_BINDINGS?=true
BUILD_MATLAB_BINDINGS?=true
BUILD_PYTHON_BINDINGS?=true
USE_MPI?=false

PARAMS=-DCMAKE_BUILD_TYPE=${BUILD_TYPE}\
		-DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX}\
		-DBUILD_C_BINDINGS=${BUILD_C_BINDINGS}\
		-DBUILD_MATLAB_BINDINGS=${BUILD_MATLAB_BINDINGS}\
		-DBUILD_PYTHON_BINDINGS=${BUILD_PYTHON_BINDINGS}\
		-DUSE_MPI=${USE_MPI}\

all:
	@-mkdir -p build
	cd build && cmake ${PARAMS} .. && make $@

test:
	@-mkdir -p build
	cd build && cmake ${PARAMS} .. && make $@

tests:
	@-mkdir -p build
	cd build && cmake ${PARAMS} .. && make $@

doc:
	@-mkdir -p build
	cd build && cmake ${PARAMS} .. && make $@

examples:
	@-mkdir -p build
	cd build && cmake ${PARAMS} .. && make $@

install:
	@-mkdir -p build
	cd build && cmake ${PARAMS} .. && make $@

clean:
	-cd build && make clean
	-rm -rf build

%:
	@-mkdir -p build
	cd build && cmake ${PARAMS} .. && make $@
+5 −0
Original line number Diff line number Diff line
FLANN - Fast Library for Approximate Nearest neighbors
======================================================

This is a library for fast approximate nearest neighbor matching. 
See the doc/manual.pdf file for information on how to use the library.
+69 −0
Original line number Diff line number Diff line
#!/usr/bin/env python

import urllib, hashlib, sys, os
from optparse import OptionParser

class AppURLopener(urllib.FancyURLopener):
    version ="Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.0.7) Gecko/20060909 Firefox/1.5.0.7"

    def prompt_user_passwd(self, host, realm):
        raise Exception()
urllib._urlopener = AppURLopener()

def file_md5(file):
    m = hashlib.md5()
    m.update(open(dest).read())
    return m.hexdigest()


def main():
    parser = OptionParser(usage="usage: %prog URI dest [md5sum]", prog=sys.argv[0])
    options, args = parser.parse_args()
    md5sum = None
    
    if len(args)==2:
        uri, dest = args
    elif len(args)==3:
        uri, dest, md5 = args
    else:
        parser.error("Wrong arguments")
    
    fresh = False
    if not os.path.exists(dest):
        print "Downloading from %s to %s..."%(uri, dest),
        sys.stdout.flush()
        urllib.urlretrieve(uri, dest)
        print "done"
        fresh = True
        
    if md5sum:
        print "Computing md5sum on downloaded file",
        sys.stdout.flush()
        checksum = md5_file(dest)
        print "done"
        
        if checksum!=md5sum:
            if not fresh:
                print "Checksum mismatch (%s != %s), re-downloading file %s"%(checksum, md5sum, dest),
                sys.stdout.flush()
                os.remove(dest)
                urllib.urlretrieve(uri, dest)
                print "done"
    
                print "Computing md5sum on downloaded file",
                sys.stdout.flush()
                checksum = md5_file(dest)
                print "done"
                
                if checksum!=md5sum:
                    print "ERROR, checksum mismatch (%s != %s) on %d",(checksum, md5sum, dest)
                    return 1
    return 0


if __name__ == '__main__':
    try:
        sys.exit(main())
    except Exception as e:
        print "ERROR, ",e
        sys.exit(1)
 No newline at end of file
+18 −0
Original line number Diff line number Diff line
#!/usr/bin/env python


import sys
import os.path as op
import unittest

if __name__ == "__main__":
    if len(sys.argv)==1:
        print "Usage: %s file"%sys.argv[0]
        sys.exit(1)

    python_path = op.abspath(op.join( op.dirname(__file__),"..","src","python"))
    sys.path.append(python_path)

    test_file = sys.argv[1]
    sys.argv = sys.argv[1:]
    execfile(test_file)
Loading