CMakeLists.txt 3.1 KB
Newer Older
M
Marius Muja 已提交
1
cmake_minimum_required(VERSION 2.4)
2 3 4 5 6 7

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

project(flann)
M
Marius Muja 已提交
8
string(TOLOWER ${PROJECT_NAME} PROJECT_NAME_LOWER)
9

M
Marius Muja 已提交
10
include(${PROJECT_SOURCE_DIR}/cmake/flann_utils.cmake)
M
Marius Muja 已提交
11
set(FLANN_VERSION 1.6.2)
M
Marius Muja 已提交
12 13 14 15 16 17 18 19
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")
20

M
Marius Muja 已提交
21
if (NOT DEFINED CMAKE_INSTALL_PREFIX)
M
Marius Muja 已提交
22 23 24 25 26 27 28 29 30
    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

M
Marius Muja 已提交
31
if (NOT DEFINED CMAKE_BUILD_TYPE)
M
Marius Muja 已提交
32 33 34 35 36 37 38 39
    #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}")

40

41 42 43 44 45 46 47 48
#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)


M
Marius Muja 已提交
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
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}")


M
Marius Muja 已提交
71
message("USE_MPI: ${USE_MPI}")
72

M
Marius Muja 已提交
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101
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)
M
Marius Muja 已提交
102

103
# require proper c++
104 105 106
#add_definitions( "-Wall -ansi -pedantic" )
# HDF5 uses long long which is not ansi
add_definitions( "-Wall" )
107

M
Marius Muja 已提交
108
add_subdirectory( cmake )
109
add_subdirectory( src )
M
Marius Muja 已提交
110
add_subdirectory( examples )
111
add_subdirectory( test )
112
add_subdirectory( doc )