forked from davidmball/ratslam
-
Notifications
You must be signed in to change notification settings - Fork 3
/
CMakeLists.txt
183 lines (149 loc) · 5.62 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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
cmake_minimum_required(VERSION 2.8.3)
project(ratslam_ros)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/cmake)
# Enable Cxx11 support
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
if(COMPILER_SUPPORTS_CXX11)
set(CMAKE_CXX_FLAGS "-std=c++11")
elseif(COMPILER_SUPPORTS_CXX0X)
set(CMAKE_CXX_FLAGS "-std=c++0x")
else()
message(FATAL_ERROR "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
endif()
## Find catkin macros and libraries
## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)
## is used, also find other catkin packages
find_package(catkin REQUIRED COMPONENTS message_generation std_msgs roscpp sensor_msgs nav_msgs tf visualization_msgs image_transport nav_msgs) ## actionlib_msgs)
find_package(OpenCV REQUIRED)
find_package(Boost REQUIRED COMPONENTS serialization)
find_package(Irrlicht REQUIRED)
find_package(OpenGL REQUIRED)
## Generate messages in the 'msg' folder
add_message_files(
FILES
TopologicalAction.msg
TopologicalEdge.msg
TopologicalMap.msg
TopologicalNode.msg
ViewTemplate.msg
)
## Generate actions in the 'msg' folder
#add_action_files(DIRECTORY action FILES DoDishes.action)
#generate_messages(DEPENDENCIES actionlib_msgs)
## Generate added messages and services with any dependencies listed here
generate_messages(
DEPENDENCIES
geometry_msgs std_msgs
)
###################################
## catkin specific configuration ##
###################################
## The catkin_package macro generates cmake config files for your package
## Declare things to be passed to dependent projects
## INCLUDE_DIRS: uncomment this if you package contains header files
## LIBRARIES: libraries you create in this project that dependent projects also need
## CATKIN_DEPENDS: catkin_packages dependent projects also need
## DEPENDS: system dependencies of this project that dependent projects also need
catkin_package(
CATKIN_DEPENDS message_runtime geometry_msgs std_msgs
)
###########
## Build ##
###########
## Specify additional locations of header files
## Your package locations should be listed before other locations
# include_directories(include)
include_directories(
src
${OpenCV_INCLUDE_DIRS}
${catkin_INCLUDE_DIRS}
)
#ratslam library
add_library(ratslam src/ratslam/experience_map.cpp src/ratslam/posecell_network.cpp src/ratslam/local_view_match.cpp src/ratslam/visual_odometry.cpp)
target_link_libraries(ratslam
${Boost_LIBRARIES}
${OpenCV_LIBRARIES}
)
# comment this out, if you don't have irrlicht installed
add_definitions("-DHAVE_IRRLICHT")
add_executable(ratslam_lv src/main_lv.cpp)
target_link_libraries(ratslam_lv
ratslam
${IRRLICHT_LIBRARIES}
${OPENGL_LIBRARIES}
${catkin_LIBRARIES}
)
add_executable(ratslam_pc src/main_pc.cpp)
target_link_libraries(ratslam_pc
ratslam
${IRRLICHT_LIBRARIES}
${OPENGL_LIBRARIES}
${catkin_LIBRARIES}
)
add_executable(ratslam_em src/main_em.cpp)
target_link_libraries(ratslam_em
ratslam
${IRRLICHT_LIBRARIES}
${OPENGL_LIBRARIES}
${catkin_LIBRARIES}
)
add_executable(ratslam_vo src/main_vo.cpp)
target_link_libraries(ratslam_vo
ratslam
${IRRLICHT_LIBRARIES}
${OPENGL_LIBRARIES}
${catkin_LIBRARIES}
)
#config files for devel
set(MEDIA_PATH ${CMAKE_CURRENT_SOURCE_DIR}/src/media) #devel use the files in the source dir
file(GLOB infiles "config/*.in")
foreach(infile ${infiles})
#MESSAGE(STATUS "Process file: ${infile}")
# Generate output file name
string(REGEX REPLACE ".in\$" "" outfile "${infile}")
get_filename_component(outfile "${outfile}" NAME)
set(outfile "${CATKIN_DEVEL_PREFIX}/${CATKIN_PACKAGE_SHARE_DESTINATION}/config/${outfile}")
#MESSAGE(STATUS "Output file: ${outfile}")
configure_file("${infile}" "${outfile}")
endforeach()
#config files for install
set(MEDIA_PATH ${CMAKE_INSTALL_PREFIX}/${CATKIN_PACKAGE_SHARE_DESTINATION}/media) #install use the installed media files
file(GLOB infiles "config/*.in")
foreach(infile ${infiles})
#MESSAGE(STATUS "Process file: ${infile}")
# Generate output file name
string(REGEX REPLACE ".in\$" "" outfile "${infile}")
get_filename_component(outfile "${outfile}" NAME)
set(outfile "${CMAKE_CURRENT_BINARY_DIR}/config/${outfile}")
#MESSAGE(STATUS "Output file: ${outfile}")
configure_file("${infile}" "${outfile}")
endforeach()
add_dependencies(ratslam_lv ratslam_ros_generate_messages_cpp)
add_dependencies(ratslam_pc ratslam_ros_generate_messages_cpp)
add_dependencies(ratslam_em ratslam_ros_generate_messages_cpp)
add_dependencies(ratslam_vo ratslam_ros_generate_messages_cpp)
install(TARGETS ratslam ratslam_lv ratslam_pc ratslam_em ratslam_vo
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION})
install(DIRECTORY launch/
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/launch)
install(DIRECTORY src/media/
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/media)
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/config/
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/config)
if (CATKIN_ENABLE_TESTING)
## setup test data download target
add_custom_target(
irat_aus_test.bag
COMMAND if [ ! -e ./tests ]\; then mkdir tests\; fi
COMMAND if [ ! -e ./tests/irat_aus_test.bag ]\; then wget https://www.dropbox.com/s/ukiob6h0reavhem/irat_aus_test.bag?dl=0 -O tests/irat_aus_test.bag\; fi
WORKING_DIRECTORY ${CATKIN_DEVEL_PREFIX}/${CATKIN_PACKAGE_SHARE_DESTINATION}
)
## add download target to test target dependencies
add_dependencies(tests irat_aus_test.bag)
## add rostests
find_package(rostest REQUIRED)
add_rostest(tests/irat_aus.test)
endif()