-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathCMakeLists.txt
160 lines (117 loc) · 4.61 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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
#####
# WINDOWS USERS: The easiest way to make cmake find boost/Eigen/OpenCV is to provide
# all of the paths to library and include dirs here.
#
# If anyone knows how to make this work please let me know :)
#
#MESSAGE(STATUS "CMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME}")
IF(WIN32) # (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
MESSAGE(STATUS "The easiest way to make cmake find boost/Eigen/OpenCV is to provide all of the paths to library and include dirs here (NB use FORWARD SLASHES).")
set(Boost_INCLUDE_DIR "E:/lib/boost_1_59_0")
set(OpenCV_INCLUDE_DIR "E:/lib/opencv/build/include")
set(EIGEN3_INCLUDE_DIR "E:/lib/eigen")
set(Boost_LIBRARY_DIRS "E:/lib/boost_1_59_0/stage/lib")
set(Boost_FOUND TRUE)
set(OpenCV_LIBRARIES "E:/lib/opencv/build/x64/vc12/staticlib")
endif()
######################
cmake_minimum_required (VERSION 2.6)
project(tom-cv)
include_directories(util)
include_directories(timing)
include_directories(params)
include_directories(logging)
include_directories(cameraGeom)
include_directories(ransac)
include_directories(bagOfWords)
include_directories(bowSpeedometer)
include_directories(featureDescription)
include_directories(featureExtract)
include_directories(featureMatching)
include_directories(image)
include_directories(imageSource)
#################################################### check for boost, Eigen3, opencv
# Set a default build type if none was specified
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "Setting build type to 'RelWithDebInfo' as none was specified.")
set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose the type of build." FORCE)
# Set the possible values of build type for cmake-gui
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release"
"MinSizeRel" "RelWithDebInfo")
if(CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_CXX_FLAGS "-O3") ## Optimize
endif()
endif()
if (CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} " -fPIC -std=c++11 ")
message(STATUS "Building everything with -fPIC so it can be linked into dynamic libraries. CMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}")
endif()
set(LIBRARY_OUTPUT_PATH "../${CMAKE_BUILD_TYPE}")
IF(NOT Boost_FOUND)
find_package (Boost 1.54.0 REQUIRED COMPONENTS system filesystem thread)
ENDIF()
include_directories (SYSTEM ${Boost_INCLUDE_DIR})
message(STATUS "boost include dir= ${Boost_INCLUDE_DIR}")
#############
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ./cmake)
IF(NOT OpenCV_INCLUDE_DIR)
find_package(OpenCV 2.4 REQUIRED COMPONENTS opencv_core opencv_highgui opencv_imgproc opencv_legacy opencv_ml opencv_calib3d)
endif()
message(STATUS "opencv include dir= ${OpenCV_INCLUDE_DIR}")
message(STATUS "opencv root dir+include= ${OpenCV_ROOT_DIR}/include")
message(STATUS "opencv_found= ${OpenCV_FOUND}")
include_directories(SYSTEM ${OpenCV_INCLUDE_DIR})
include_directories(SYSTEM "${OpenCV_ROOT_DIR}/include")
#############
IF(NOT EIGEN3_INCLUDE_DIR)
FIND_PACKAGE(Eigen3 3.1 REQUIRED)
ENDIF()
message(STATUS "Eigen3 include dir= ${EIGEN3_INCLUDE_DIR}")
message(STATUS "Eigen3_found= ${EIGEN3_FOUND}")
include_directories(SYSTEM ${EIGEN3_INCLUDE_DIR})
#################################################### build all the tom-cv libraries
add_subdirectory(util)
add_subdirectory(timing)
add_subdirectory(params)
add_subdirectory(logging)
add_subdirectory(cameraGeom)
add_subdirectory(ransac)
add_subdirectory(bagOfWords)
add_subdirectory(bowSpeedometer)
add_subdirectory(featureDescription)
add_subdirectory(featureExtract)
add_subdirectory(featureMatching)
add_subdirectory(image)
add_subdirectory(imageSource)
################################################### set up libraries to link to
IF(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Windows")
link_libraries(featureExtract)
link_libraries(imageSource)
link_libraries(params)
link_libraries(logging)
link_libraries(ransac)
link_libraries(bagOfWords)
link_libraries(bowSpeedometer)
link_libraries(featureDescription)
link_libraries(featureMatching)
link_libraries(image)
link_libraries(${Boost_LIBRARIES})
link_libraries(opencv_core)
link_libraries(opencv_imgproc)
link_libraries(opencv_calib3d)
link_libraries(opencv_highgui)
link_libraries(opencv_features2d)
link_libraries(opencv_legacy)
link_libraries(cameraGeom)
link_libraries(timing)
link_libraries(util)
link_libraries(png)
link_libraries(jpeg)
################################################### build the example programs
add_subdirectory(ransacTest)
add_subdirectory(ransacAndRefine)
add_subdirectory(bowExample)
add_subdirectory(mosaicing)
add_subdirectory(BoWSLAM)
add_subdirectory(ShowIm) # needed for BoWSLAM
ENDIF()