-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
103 lines (86 loc) · 2.66 KB
/
Copy pathCMakeLists.txt
File metadata and controls
103 lines (86 loc) · 2.66 KB
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
cmake_minimum_required(VERSION 3.16)
project(imu_pose3_fuser)
## Compile as C++17, supported in ROS Noetic and newer
add_compile_options(-std=c++17)
# Find Dependencies ---------------------------------------------------------------------------------------------------
find_package(Eigen3 REQUIRED)
message("Eigen Version:" ${EIGEN3_VERSION_STRING})
message("Eigen Path:" ${Eigen3_DIR})
# Color
if(NOT WIN32)
string(ASCII 27 Esc)
set(ColourReset "${Esc}[m")
set(BoldMagenta "${Esc}[1;35m")
set(Magenta "${Esc}[35m")
endif()
# March native check
#include(CheckCXXCompilerFlag)
#CHECK_CXX_COMPILER_FLAG("-march=native" COMPILER_SUPPORTS_MARCH_NATIVE)
#if(COMPILER_SUPPORTS_MARCH_NATIVE)
# add_compile_options("-march=native")
# message("${BoldMagenta}INFO: Using -march=native${ColourReset}")
#endif()
# Catkin dependencies -------------------------------------------------------------------------------------------------
set(CATKIN_PACKAGE_DEPENDENCIES
graph_msf_ros
nav_msgs
sensor_msgs
roscpp
std_msgs
tf
)
find_package(catkin REQUIRED COMPONENTS
${CATKIN_PACKAGE_DEPENDENCIES}
)
catkin_package(
INCLUDE_DIRS include
LIBRARIES ${PROJECT_NAME}
CATKIN_DEPENDS ${CATKIN_PACKAGE_DEPENDENCIES}
)
###########
## Build ##
###########
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
include_directories(
include
${catkin_INCLUDE_DIRS}
${EIGEN3_INCLUDE_DIR}
)
# Library
add_library(${PROJECT_NAME}
src/lib/ImuPose3Fuser.cpp
src/lib/readParams.cpp
include/imu_pose3_fuser/constants.h)
target_link_libraries(${PROJECT_NAME}
${catkin_LIBRARIES})
# Executable
add_executable(${PROJECT_NAME}_node src/imu_pose3_fuser_node.cpp)
target_link_libraries(${PROJECT_NAME}_node ${PROJECT_NAME})
add_dependencies(${PROJECT_NAME}
${catkin_EXPORTED_TARGETS})
# Add clang tooling
find_package(cmake_clang_tools QUIET)
if(cmake_clang_tools_FOUND AND NOT DEFINED NO_CLANG_TOOLING)
add_clang_tooling(
TARGET ${PROJECT_NAME}
SOURCE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/src ${CMAKE_CURRENT_SOURCE_DIR}/include
CT_HEADER_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include
CF_FIX
)
endif(cmake_clang_tools_FOUND AND NOT DEFINED NO_CLANG_TOOLING)
#############
## Install ##
#############
install(TARGETS ${PROJECT_NAME}
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)
install(DIRECTORY include/${PROJECT_NAME}/
DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
)
## Mark cpp header files for installation
install(DIRECTORY config launch rviz
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
)