forked from dorian3d/DBoW2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
75 lines (60 loc) · 2.73 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
cmake_minimum_required(VERSION 2.8)
project(DBoW2)
include(ExternalProject)
option(BUILD_DBoW2 "Build DBoW2" ON)
option(BUILD_Demo "Build demo application" ON)
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE)
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release"
"MinSizeRel" "RelWithDebInfo")
endif()
if(MSVC)
if(CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
string(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4")
endif()
elseif(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic")
endif()
set(HDRS
include/DBoW2/BowVector.h include/DBoW2/FBrief.h include/DBoW2/FSurf64.h
include/DBoW2/QueryResults.h include/DBoW2/TemplatedDatabase.h include/DBoW2/FORB.h
include/DBoW2/DBoW2.h include/DBoW2/FClass.h include/DBoW2/FeatureVector.h
include/DBoW2/ScoringObject.h include/DBoW2/TemplatedVocabulary.h)
set(SRCS
src/BowVector.cpp src/FBrief.cpp src/FORB.cpp src/FSurf64.cpp
src/FeatureVector.cpp src/QueryResults.cpp src/ScoringObject.cpp)
set(DEPENDENCY_DIR ${CMAKE_CURRENT_BINARY_DIR}/dependencies)
set(DEPENDENCY_INSTALL_DIR ${DEPENDENCY_DIR}/install)
find_package(OpenCV REQUIRED)
include_directories(${OpenCV_INCLUDE_DIRS})
if(BUILD_DBoW2)
set(LIB_SHARED "SHARED")
if(WIN32)
set(LIB_SHARED "STATIC")
endif(WIN32)
add_library(${PROJECT_NAME} ${LIB_SHARED} ${SRCS})
include_directories(include/DBoW2/)
target_link_libraries(${PROJECT_NAME} ${OpenCV_LIBS})
endif(BUILD_DBoW2)
if(BUILD_Demo)
add_executable(demo demo/demo.cpp)
target_link_libraries(demo ${PROJECT_NAME} ${OpenCV_LIBS})
file(COPY demo/images DESTINATION ${CMAKE_BINARY_DIR}/)
endif(BUILD_Demo)
# Create a DBoW2Config.cmake file for other projects to use.
configure_file(src/DBoW2.cmake.in
"${PROJECT_BINARY_DIR}/DBoW2Config.cmake" @ONLY)
install(TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
if(BUILD_DBoW2)
install(DIRECTORY include/DBoW2 DESTINATION ${CMAKE_INSTALL_PREFIX}/include)
endif()
# Install the DBoW2Config.cmake file.
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/DBoW2Config.cmake"
DESTINATION ${CMAKE_INSTALL_PREFIX}/include/${PROJECT_NAME})
install(FILES "${PROJECT_BINARY_DIR}/DBoW2Config.cmake"
DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/cmake/DBoW2/)
install(DIRECTORY ${DEPENDENCY_INSTALL_DIR}/ DESTINATION ${CMAKE_INSTALL_PREFIX} OPTIONAL)
# # Need to add DBoW2Config.cmake to the CMAKE_MODULE_PATH.
# set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" "${CMAKE_INSTALL_PREFIX}/lib/cmake/DBoW2/")