forked from dorian3d/DBoW2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
71 lines (62 loc) · 2.5 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
cmake_minimum_required(VERSION 3.0)
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)
add_compile_options(/W4)
else()
add_compile_options(-Wall -Wextra -Wpedantic)
endif()
set(HDRS
include/DBoW2/BowVector.h include/DBoW2/FBrief.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/FeatureVector.cpp src/QueryResults.cpp src/ScoringObject.cpp)
find_package(OpenCV REQUIRED)
if(BUILD_DBoW2)
set(LIB_SHARED "SHARED")
if(WIN32)
set(LIB_SHARED "STATIC")
endif(WIN32)
add_library(${PROJECT_NAME} ${LIB_SHARED} ${SRCS})
target_include_directories(${PROJECT_NAME} PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/DBoW2>
$<INSTALL_INTERFACE:include/DBoW2>
$<INSTALL_INTERFACE:include/DBoW2/DBoW2>)
target_link_libraries(${PROJECT_NAME} PUBLIC ${OpenCV_LIBRARIES})
set_target_properties(${PROJECT_NAME} PROPERTIES
CXX_STANDARD 11
POSITION_INDEPENDENT_CODE ON
DEBUG_POSTFIX _d
)
add_library(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME})
endif(BUILD_DBoW2)
if(BUILD_Demo)
add_executable(demo demo/demo.cpp)
target_link_libraries(demo ${PROJECT_NAME} ${OpenCV_LIBRARIES})
set_target_properties(demo PROPERTIES CXX_STANDARD 11)
file(COPY demo/images DESTINATION ${CMAKE_BINARY_DIR}/)
endif(BUILD_Demo)
configure_file(src/DBoW2.cmake.in
"${PROJECT_BINARY_DIR}/DBoW2Config.cmake" @ONLY)
install(TARGETS ${PROJECT_NAME} EXPORT ${PROJECT_NAME}-targets
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin)
if(BUILD_DBoW2)
install(DIRECTORY include/DBoW2 DESTINATION ${CMAKE_INSTALL_PREFIX}/include/DBoW2)
endif()
install(FILES "${PROJECT_BINARY_DIR}/DBoW2Config.cmake"
DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/cmake/DBoW2/)
install(EXPORT ${PROJECT_NAME}-targets DESTINATION lib/cmake/${PROJECT_NAME}
NAMESPACE ${PROJECT_NAME}::)