-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathCMakeLists.txt
108 lines (97 loc) · 3 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
cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
project(liodom)
# Setting build type to Release
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()
message(STATUS "Build type: " ${CMAKE_BUILD_TYPE})
# Setting the flags for profiling information or not
if(CMAKE_BUILD_TYPE MATCHES Release)
message(STATUS "Setting Release options")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} -Wall -O3 -g")
elseif(CMAKE_BUILD_TYPE MATCHES Debug)
message(STATUS "Setting Debug options")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} -Wall -O1 -pg")
endif()
# Check C++ support
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-std=c++17" COMPILER_SUPPORTS_CXX17)
CHECK_CXX_COMPILER_FLAG("-std=c++14" COMPILER_SUPPORTS_CXX14)
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
if(COMPILER_SUPPORTS_CXX17)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17")
message(STATUS "Using flag -std=c++17")
elseif(COMPILER_SUPPORTS_CXX14)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
message(STATUS "Using flag -std=c++14")
elseif(COMPILER_SUPPORTS_CXX11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
message(STATUS "Using flag -std=c++11")
else()
message(FATAL_ERROR "The compiler ${CMAKE_CXX_COMPILER} has no C++14/11/0x support.
Please use a different C++ compiler.")
endif()
# Catkin dependencies
find_package(catkin REQUIRED COMPONENTS
roscpp
rospy
std_msgs
geometry_msgs
nav_msgs
sensor_msgs
tf
eigen_conversions
tf_conversions
pcl_conversions
)
# Other packages
find_package(Eigen3)
find_package(PCL REQUIRED)
find_package(Ceres REQUIRED)
find_package(OpenMP REQUIRED)
if (OPENMP_FOUND)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
endif()
# Printing the compiling flags
message(STATUS "Compiler flags: ${CMAKE_CXX_FLAGS}")
catkin_package(
INCLUDE_DIRS include
LIBRARIES
CATKIN_DEPENDS roscpp rospy std_msgs geometry_msgs nav_msgs sensor_msgs tf eigen_conversions tf_conversions pcl_conversions
DEPENDS EIGEN3 PCL CERES
)
include_directories(
include
${catkin_INCLUDE_DIRS}
${EIGEN3_INCLUDE_DIRS}
${PCL_INCLUDE_DIRS}
${CERES_INCLUDE_DIRS}
)
#### Laser Odometry
add_library(liodom
src/shared_data.cc
src/stats.cc
src/params.cc
src/feature_extractor.cc
src/laser_odometry.cc)
target_link_libraries(liodom
${catkin_LIBRARIES}
${PCL_LIBRARIES}
${CERES_LIBRARIES}
)
add_executable(liodom_node
src/liodom_node.cc)
target_link_libraries(liodom_node
liodom
${catkin_LIBRARIES}
${PCL_LIBRARIES}
${CERES_LIBRARIES}
)
#### Laser Mapping
add_executable(liodom_mapping
src/map.cc
src/liodom_mapping_node.cc)
target_link_libraries(liodom_mapping
${PCL_LIBRARIES}
${catkin_LIBRARIES}
)