forked from koide3/livox_to_pointcloud2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
71 lines (62 loc) · 1.88 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
cmake_minimum_required(VERSION 3.5.2)
project(livox_to_pointcloud2)
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "Choose the type of build." FORCE)
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
endif()
###########
## Build ##
###########
if($ENV{ROS_VERSION} EQUAL 1)
###########################
## catkin-related (ROS1) ##
###########################
find_package(catkin REQUIRED COMPONENTS
roscpp
sensor_msgs
livox_ros_driver
)
catkin_package()
add_executable(livox_to_pointcloud2_node
src/livox_to_pointcloud2_ros1.cpp
)
target_include_directories(livox_to_pointcloud2_node PUBLIC
include
${catkin_INCLUDE_DIRS}
)
target_link_libraries(livox_to_pointcloud2_node
${catkin_LIBRARIES}
)
add_dependencies(livox_to_pointcloud2_node
${catkin_EXPORTED_TARGETS}
)
elseif($ENV{ROS_VERSION} EQUAL 2)
##########################
## ament-related (ROS2) ##
##########################
find_package(ament_cmake_auto REQUIRED)
ament_auto_find_build_dependencies()
if(livox_ros_driver2_FOUND)
message(STATUS "Found livox_ros_driver2")
add_compile_definitions(LIVOX_ROS_DRIVER2)
elseif(livox_ros2_driver_FOUND)
message(STATUS "Found livox_ros2_driver")
add_compile_definitions(LIVOX_ROS2_DRIVER)
endif()
# Component
ament_auto_add_library(livox_to_pointcloud2 SHARED
src/livox_to_pointcloud2_ros2.cpp
)
rclcpp_components_register_nodes(livox_to_pointcloud2 "livox_to_pointcloud2::LivoxToPointCloud2")
# Node
ament_auto_add_executable(livox_to_pointcloud2_node
src/livox_to_pointcloud2_ros2_node.cpp
)
target_include_directories(livox_to_pointcloud2_node PUBLIC
include
)
target_link_libraries(livox_to_pointcloud2_node
livox_to_pointcloud2
)
ament_auto_package()
endif()