forked from Slamtec/rplidar_ros
-
Notifications
You must be signed in to change notification settings - Fork 44
/
CMakeLists.txt
83 lines (69 loc) · 1.83 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
cmake_minimum_required(VERSION 3.9.5)
project(rplidar_ros)
# Default to C++14
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 17)
endif()
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -pedantic)
endif()
set(RPLIDAR_SDK_PATH "./sdk/")
if(APPLE)
add_compile_definitions(_MACOS)
FILE(GLOB RPLIDAR_SDK_SRC
"${RPLIDAR_SDK_PATH}/src/arch/macOS/*.cpp"
"${RPLIDAR_SDK_PATH}/src/hal/*.cpp"
"${RPLIDAR_SDK_PATH}/src/*.cpp"
)
else()
FILE(GLOB RPLIDAR_SDK_SRC
"${RPLIDAR_SDK_PATH}/src/arch/linux/*.cpp"
"${RPLIDAR_SDK_PATH}/src/hal/*.cpp"
"${RPLIDAR_SDK_PATH}/src/*.cpp"
)
endif()
set(req_deps
"rclcpp"
"sensor_msgs"
"std_srvs"
"rclcpp_components"
)
find_package(ament_cmake_auto REQUIRED)
find_package(ament_cmake_ros REQUIRED)
ament_auto_find_build_dependencies(REQUIRED ${req_deps})
include_directories(
${RPLIDAR_SDK_PATH}/include
${RPLIDAR_SDK_PATH}/src
include
)
# build composition node
add_library(rplidar_composition_node SHARED
src/rplidar_node.cpp
${RPLIDAR_SDK_SRC}
)
ament_target_dependencies(rplidar_composition_node ${req_deps})
rclcpp_components_register_nodes(rplidar_composition_node "rplidar_ros::rplidar_node")
# build composition node
ament_auto_add_executable(rplidar_composition src/standalone_rplidar.cpp)
target_link_libraries(rplidar_composition rplidar_composition_node)
ament_target_dependencies(rplidar_composition ${req_deps})
install(
TARGETS rplidar_composition
DESTINATION lib/${PROJECT_NAME}
)
install(
DIRECTORY launch rviz
DESTINATION share/${PROJECT_NAME}
)
# Install the shared library composition node
install(
TARGETS rplidar_composition_node
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin
)
# TODO(hallen): port this
# install(DIRECTORY sdk
# USE_SOURCE_PERMISSIONS
# )
ament_auto_package()