-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
179 lines (156 loc) · 4.96 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
cmake_minimum_required(VERSION 3.19.2)
project(tloam)
set(CMAKE_CXX_STANDARD 14)
# set(CMAKE_BUILD_TYPE Debug)
# set(CMAKE_BUILD_TYPE "Release")
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -Wall -g")
set(CMAKE_CXX_FLAGS_DEBUG "$ENV{CXXFLAGS} -O0 -Wall -g2 -ggdb")
add_definitions(-msse -msse2 -msse3 -msse4 -msse4.1 -msse4.2)
set(CMAKE_C_FLAGS "-msse -msse2 -msse3 -msse4 -msse4.1 -msse4.2")
set(CMAKE_CXX_FLAGS "-msse -msse2 -msse3 -msse4 -msse4.1 -msse4.2")
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_LIST_DIR}/cmake")
include(cmake/work_space_path.cmake)
include(cmake/googletest.cmake)
find_package(catkin REQUIRED COMPONENTS
roscpp
rospy
nav_msgs
geometry_msgs
std_msgs
rosbag
sensor_msgs
tf
velodyne_msgs
image_transport
cv_bridge
nodelet
ecl_threads
jsk_recognition_msgs
roscpp rospy angles std_srvs geometry_msgs sensor_msgs nav_msgs urdf tf dynamic_reconfigure
)
## System dependencies are found with CMake's conventions
find_package(Boost REQUIRED COMPONENTS system filesystem thread serialization iostreams)
find_package(OpenCV REQUIRED QUIET)
find_package(Ceres REQUIRED QUIET)
set(Open3D_DIR /usr/local/Open3D/lib/cmake/Open3D)
find_package(Open3D REQUIRED QUIET)
message(STATUS "Open3D include dir: ${Open3D_INCLUDE_DIRS}")
message(STATUS "Open3D library dir: ${Open3D_LIBRARIES}")
find_package(Threads REQUIRED QUIET)
find_package(yaml-cpp REQUIRED QUIET)
# Find OpenMP
find_package(OpenMP)
if (OPENMP_FOUND)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")
endif ()
add_service_files(
FILES
saveMap.srv
saveOdometry.srv
)
catkin_package(
INCLUDE_DIRS include
CATKIN_DEPENDS geometry_msgs nav_msgs roscpp rospy std_msgs velodyne_msgs image_transport jsk_recognition_msgs
)
include_directories(
include
"/usr/include/eigen3"
${catkin_INCLUDE_DIRS}
${PROJECT_SOURCE_DIR}/src/
${OpenCV_INCLUDE_DIRS}
${CERES_INCLUDE_DIRS}
${Open3D_INCLUDE_DIRS}
)
link_libraries(
${catkin_LIBRARIES}
${Open3D_LIBRARIES}
${CERES_LIBRARIES}
${Boost_LIBRARIES}
${OpenCV_LIBRARIES}
${Sophus_LIBRARIES}
yaml-cpp
)
set(ALL_TARGET_LIBRARIES
${catkin_LIBRARIES}
${Open3D_LIBRARIES}
${CERES_LIBRARIES}
${Boost_LIBRARIES}
${OpenCV_LIBRARIES}
${Sophus_LIBRARIES}
yaml-cpp
)
add_library(${PROJECT_NAME}_open3d_conversions
SHARED
src/open3d/open3d_to_ros.cpp
src/open3d/PointCloud2.cpp
)
add_library(${PROJECT_NAME}_publisher
SHARED
src/publisher/boundingbox_publisher.cpp
src/publisher/cloud_publisher.cpp
src/publisher/image_publisher.cpp
src/publisher/key_frame_publisher.cpp
src/publisher/key_frames_publisher.cpp
src/publisher/odometry_publisher.cpp
src/publisher/tf_broadcaster.cpp
)
add_library(${PROJECT_NAME}_subscriber
SHARED
src/subscriber/cloud_subscriber.cpp
src/subscriber/key_frame_subscriber.cpp
src/subscriber/key_frames_subscriber.cpp
src/subscriber/odometry_subscriber.cpp
src/subscriber/tf_listener.cpp
)
list(APPEND ALL_TARGET_LIBRARIES ${PROJECT_NAME}_open3d_conversions)
list(APPEND ALL_TARGET_LIBRARIES ${PROJECT_NAME}_publisher)
list(APPEND ALL_TARGET_LIBRARIES ${PROJECT_NAME}_subscriber)
# add_library(
# kitti_reader_nodelet
# src/core_node/kitti_reader_nodelet.cpp
# src/models/io/kitti_reader.cpp
# )
add_executable(kitti_reader_node src/core_node/kitti_reader_nodelet.cpp src/models/io/kitti_reader.cpp)
add_dependencies(kitti_reader_node ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
target_link_libraries(kitti_reader_node ${catkin_LIBRARIES} ${ALL_TARGET_LIBRARIES})
# add_library(
# segmentation_nodelet
# src/core_node/segmentation_nodelet.cpp
# src/models/segmentation/segmentation.cpp
# )
add_executable(segmentation_node src/core_node/segmentation_nodelet.cpp src/models/segmentation/segmentation.cpp)
add_dependencies(segmentation_node ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
target_link_libraries(segmentation_node ${catkin_LIBRARIES} ${ALL_TARGET_LIBRARIES})
# add_library(
# lidar_odometry_nodelet
# src/core_node/lidar_odometry_nodelet.cpp
# src/models/registration/registration.cpp
# src/models/feature_extraction/feature_extract.cpp
# src/front_end/front_end.cpp
# )
add_executable(
lidar_odometry_node
src/core_node/lidar_odometry_nodelet.cpp
src/models/registration/registration.cpp
src/models/feature_extraction/feature_extract.cpp
src/front_end/front_end.cpp
)
add_dependencies(lidar_odometry_node ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
target_link_libraries(lidar_odometry_node ${catkin_LIBRARIES} ${ALL_TARGET_LIBRARIES})
#############
## Install ##
#############
install(FILES
launch/tloam_kitti.launch
rviz/car/ex1.jpeg
rviz/car/ex2.jpeg
rviz/car/model.dae
rviz/car/default.urdf
rviz/tloam.rviz
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/${PROJECT_NAME}
)