forked from SignalImageCV/scancontext
-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
76 lines (64 loc) · 2.16 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
project(scancontext_ros2)
cmake_minimum_required(VERSION 3.5) # ROS2 minimum version
# Find required non ROS2 packages
find_package(PCL REQUIRED)
include_directories(${PCL_INCLUDE_DIRS})
link_directories(${PCL_LIBRARY_DIRS})
add_definitions(${PCL_DEFINITIONS})
message(STATUS "PCL_INCLUDE_DIRS:" ${PCL_INCLUDE_DIRS})
message(STATUS "PCL_LIBRARY_DIRS:" ${PCL_LIBRARY_DIRS})
message(STATUS "PCL_DEFINITIONS:" ${PCL_DEFINITIONS})
# ROS 2 integration, enable c++14
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Use -std=c++14 instead of -std=gnu++14
set(CMAKE_CXX_EXTENSIONS OFF)
# Enable compile optimizations
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -fsee -fomit-frame-pointer -fno-signed-zeros -fno-math-errno -funroll-loops")
# Enable debug flags (use if you want to debug in gdb)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3 -Wall -Wuninitialized -fno-omit-frame-pointer")
# Find necessary ROS2 packages
find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)
find_package(pcl_conversions REQUIRED)
# Include local hdl_graph_slam headers
include_directories(include)
include_directories(
${PCL_INCLUDE_DIRS}
)
# Make this package usable as a library in other packages according to
# https://docs.ros.org/en/rolling/How-To-Guides/Ament-CMake-Documentation.html#adding-resources
add_library(${PROJECT_NAME} SHARED
src/scancontext_ros2/Scancontext.cpp
)
target_include_directories(${PROJECT_NAME}
PUBLIC
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
"$<INSTALL_INTERFACE:include/${PROJECT_NAME}>"
${PCL_INCLUDE_DIRS}
${EIGEN3_INCLUDE_DIR}
)
# Link non ROS2 libraries
target_link_libraries(${PROJECT_NAME}
${PCL_LIBRARIES}
)
# Link ROS2 libraries
ament_target_dependencies(${PROJECT_NAME}
rclcpp
pcl_conversions
)
# Install include directory
install(DIRECTORY include/
DESTINATION include/${PROJECT_NAME}
)
install(TARGETS ${PROJECT_NAME}
EXPORT export_${PROJECT_NAME}
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
RUNTIME DESTINATION bin
)
# ament export
ament_export_targets(export_${PROJECT_NAME} HAS_LIBRARY_TARGET)
ament_export_include_directories(include)
ament_export_libraries(${PROJECT_NAME})
ament_package()