-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
86 lines (61 loc) · 2.74 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# This Cmake file written by Michael Warren, CyPhy Lab, Queensland University of Technology, Australia
# https://wiki.qut.edu.au/display/cyphy/Michael+Warren
# Last updated 17/05/12
PROJECT(openFABMAP)
cmake_minimum_required(VERSION 2.6)
############ Cmake setup ##################
# tell cmake where the FindXXX.cmake functions are
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR})
# make a lib directory in the build directory
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib)
# tell cmake that the library goes in the library directory
set(LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/lib)
# make a binary directory in the build directory
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin)
# tell cmake that the binaries goes in the binary directory
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/bin)
# required packages
FIND_PACKAGE(OpenCV REQUIRED)
############ end CMake setup ##################
############ openFABMAP library ##################
# tell cmake about the library
AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/src OPENFABMAP_FILES)
# include the headers
file(GLOB OPENFABMAP_INCS "${CMAKE_CURRENT_SOURCE_DIR}/include/*.hpp")
# tell cmake about the library
ADD_LIBRARY(openFABMAP ${OPENFABMAP_FILES} ${OPENFABMAP_INCS})
############ end openFABMAP library ##################
# Tell CMake where the headers are
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include)
# Link against the required libraries in OpenCV >=2.2
IF(OPENCV2_FOUND)
SET( OPENCV2_INSTALLED 1)
message( STATUS "Using OpenCV >= 2.2" )
IF(WIN32)
IF(MINGW)
TARGET_LINK_LIBRARIES(openFABMAP ${OPENCV2_LIBS})
ELSE(MINGW)
FOREACH (LIB ${OPENCV2_DEBUG_LIBS})
TARGET_LINK_LIBRARIES(openFABMAP
debug ${LIB})
ENDFOREACH(LIB)
FOREACH (LIB ${OPENCV2_RELEASE_LIBS})
TARGET_LINK_LIBRARIES(openFABMAP
optimized ${LIB})
ENDFOREACH(LIB)
ENDIF(MINGW)
ELSE(WIN32)
TARGET_LINK_LIBRARIES(openFABMAP opencv_highgui opencv_core opencv_features2d opencv_imgproc)
ENDIF(WIN32)
ENDIF(OPENCV2_FOUND)
############ openFABMAPcli executable ##################
if(OPENCV2_FOUND)
# tell the project where the settings file is and copy it across when building (not used for now)
#file(GLOB SETTINGS_FILE "${CMAKE_CURRENT_SOURCE_DIR}/samples/settings.yml")
#FILE(COPY ${SETTINGS_FILE} DESTINATION ${CMAKE_BINARY_DIR}/bin)
# tell cmake about the binary
ADD_EXECUTABLE(openFABMAPcli ${CMAKE_SOURCE_DIR}/samples/openFABMAPcli.cpp ${SETTINGS_FILE})
# Tell openFABMAPcli to link against its required libs
TARGET_LINK_LIBRARIES(openFABMAPcli openFABMAP)
endif(OPENCV2_FOUND)
############ end openFABMAP executable ##################