forked from ethz-asl/maplab_rovio
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
164 lines (138 loc) · 5.26 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
161
162
163
164
cmake_minimum_required (VERSION 2.6)
project(rovio)
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/DetectSIMD.cmake)
set(ROVIO_NMAXFEATURE 25 CACHE STRING "Number of features for ROVIO")
set(ROVIO_NCAM 1 CACHE STRING "Number of enabled cameras")
set(ROVIO_NLEVELS 4 CACHE STRING "Number of image leavels for the features")
set(ROVIO_PATCHSIZE 6 CACHE STRING "Size of patch (edge length in pixel)")
set(ROVIO_NPOSE 0 CACHE STRING "Additional estimated poses for external pose measurements")
add_definitions(-DROVIO_NMAXFEATURE=${ROVIO_NMAXFEATURE})
add_definitions(-DROVIO_NCAM=${ROVIO_NCAM})
add_definitions(-DROVIO_NLEVELS=${ROVIO_NLEVELS})
add_definitions(-DROVIO_PATCHSIZE=${ROVIO_PATCHSIZE})
add_definitions(-DROVIO_NPOSE=${ROVIO_NPOSE})
add_definitions(-std=c++11)
add_subdirectory(lightweight_filtering)
##################### Find, include, and compile library #####################
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
if(0)
find_package(OpenMP REQUIRED)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
endif()
find_package(Eigen REQUIRED)
include_directories(${EIGEN_INCLUDE_DIR})
if(MAKE_SCENE)
message(STATUS "Building ROVIO with openGL Scene Visualization")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DMAKE_SCENE=1")
find_package(GLEW REQUIRED)
include_directories(${GLEW_INCLUDE_DIRS})
find_package(GLUT REQUIRED)
include_directories(${GLUT_INCLUDE_DIRS})
link_directories(${GLUT_LIBRARY_DIRS})
add_definitions(${GLUT_DEFINITIONS})
find_package(OpenGL REQUIRED)
include_directories(${OpenGL_INCLUDE_DIRS})
link_directories(${OpenGL_LIBRARY_DIRS})
add_definitions(${OpenGL_DEFINITIONS})
endif()
find_package(PkgConfig)
find_package(glog_catkin REQUIRED)
find_package(opencv3_catkin QUIET)
if(opencv3_catkin_FOUND)
message(STATUS "Found opencv3_catkin!")
set(OPENCV_PACKAGE "opencv3_catkin")
else()
message(STATUS "Use the systems opencv installation!")
set(OPENCV_PACKAGE "")
endif()
find_package(yaml_cpp_catkin QUIET)
if(${yaml_cpp_catkin_FOUND})
message(STATUS "Found yaml_cpp_catkin, using instead of system library.")
set(YamlCpp_LIBRARIES ${yaml_cpp_catkin_LIBRARIES})
set(YamlCpp_INCLUDE_DIRS ${yaml_cpp_catkin_INCLUDE_DIRS})
else()
message(STATUS "No yaml_cpp_catkin, using yaml-cpp system library instead.")
pkg_check_modules(YamlCpp REQUIRED yaml-cpp>=0.5)
endif()
##################### Install ROS stuff #####################
find_package(catkin REQUIRED COMPONENTS
${OPENCV_PACKAGE}
cv_bridge
geometry_msgs
kindr
lightweight_filtering
message_generation
nav_msgs
rosbag
roscpp
roslib
sensor_msgs
std_msgs
tf
)
add_service_files(
DIRECTORY srv
FILES SrvResetToPose.srv
)
generate_messages(DEPENDENCIES
std_msgs
geometry_msgs
)
catkin_package(
INCLUDE_DIRS include ${catkin_INCLUDE_DIRS}
LIBRARIES ${PROJECT_NAME}
CATKIN_DEPENDS
${OPENCV_PACKAGE}
cv_bridge
geometry_msgs
kindr
lightweight_filtering
message_runtime
nav_msgs
rosbag
roscpp
roslib
sensor_msgs
std_msgs
tf
yaml_cpp_catkin
)
include_directories(include ${catkin_INCLUDE_DIRS} ${YamlCpp_INCLUDE_DIRS} ${glog_catkin_INCLUDE_DIRS})
set(ROVIO_SRCS
src/Camera.cpp
src/CameraCalibration.cpp
src/FeatureCoordinates.cpp
src/FeatureDistance.cpp
src/RovioInterfaces.cpp
)
# Optionally also build the SCENE files.
if(MAKE_SCENE)
set(ROVIO_SRCS ${ROVIO_SRCS} src/Scene.cpp)
endif()
add_library(${PROJECT_NAME} ${ROVIO_SRCS})
target_link_libraries(${PROJECT_NAME} ${catkin_LIBRARIES} ${YamlCpp_LIBRARIES} ${OpenMP_EXE_LINKER_FLAGS} ${OPENGL_LIBRARIES} ${GLUT_LIBRARY} ${GLEW_LIBRARY} ${glog_catkin_LIBRARIES})
add_dependencies(${PROJECT_NAME} ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS} rovio_generate_messages_cpp)
add_executable(rovio_node src/rovio_node.cpp)
target_link_libraries(rovio_node ${PROJECT_NAME})
add_executable(rovio_rosbag_loader src/rovio_rosbag_loader.cpp)
target_link_libraries(rovio_rosbag_loader ${PROJECT_NAME})
add_dependencies(rovio_rosbag_loader ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
add_executable(feature_tracker_node src/feature_tracker_node.cpp)
target_link_libraries(feature_tracker_node ${PROJECT_NAME})
add_dependencies(feature_tracker_node ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
if(CATKIN_ENABLE_TESTING)
message(STATUS "Building GTests!")
option(BUILD_GTEST "build gtest" ON)
#add_subdirectory(gtest gtest)
enable_testing()
include_directories(${gtest_SOURCE_DIR}/include ${gtest_SOURCE_DIR})
add_executable(test_patch src/test_patch.cpp src/Camera.cpp src/FeatureCoordinates.cpp src/FeatureDistance.cpp)
target_link_libraries(test_patch gtest_main gtest pthread ${PROJECT_NAME} ${catkin_LIBRARIES} ${YamlCpp_LIBRARIES} ${glog_catkin_LIBRARIES} )
add_test(test_patch test_patch)
add_executable(test_mlp src/test_mlp.cpp src/Camera.cpp src/FeatureCoordinates.cpp src/FeatureDistance.cpp)
target_link_libraries(test_mlp gtest_main gtest pthread ${PROJECT_NAME} ${catkin_LIBRARIES} ${YamlCpp_LIBRARIES} ${glog_catkin_LIBRARIES})
add_test(test_mlp test_mlp)
add_executable(test_llu src/test_localization_landmark_update.cpp)
target_link_libraries(test_llu gtest_main gtest pthread ${PROJECT_NAME} ${catkin_LIBRARIES} ${YamlCpp_LIBRARIES} ${glog_catkin_LIBRARIES})
add_test(test_llu test_llu)
endif()