-
Notifications
You must be signed in to change notification settings - Fork 197
/
Copy pathCMakeLists.txt
132 lines (105 loc) · 3.57 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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
cmake_minimum_required(VERSION 3.10.2) # CMake version in Ubuntu 18.04 LTS
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
project(depthai_bridge VERSION 2.10.5 LANGUAGES CXX C)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# Update the policy setting to avoid an error when loading the ament_cmake package
# at the current cmake version level
if(POLICY CMP0057)
cmake_policy(SET CMP0057 NEW)
endif()
set(opencv_version 4)
find_package(OpenCV ${opencv_version} QUIET COMPONENTS imgproc highgui calib3d)
if(NOT OpenCV_FOUND)
message(STATUS "----------------Did not find OpenCV 4, trying OpenCV 3--------------")
set(opencv_version 3)
find_package(OpenCV ${opencv_version} REQUIRED COMPONENTS imgproc highgui calib3d)
endif()
message(STATUS "------------------------------------------")
message(STATUS "Depthai Bridge is being built using AMENT.")
message(STATUS "------------------------------------------")
set(BUILD_TOOL_INCLUDE_DIRS ${ament_INCLUDE_DIRS})
find_package(ament_index_cpp REQUIRED)
find_package(camera_info_manager REQUIRED)
find_package(cv_bridge REQUIRED)
find_package(depthai_ros_msgs REQUIRED)
find_package(depthai CONFIG REQUIRED)
find_package(image_transport REQUIRED)
find_package(rclcpp REQUIRED)
find_package(sensor_msgs REQUIRED)
find_package(stereo_msgs REQUIRED)
find_package(std_msgs REQUIRED)
find_package(vision_msgs REQUIRED)
find_package(tf2_ros REQUIRED)
find_package(tf2 REQUIRED)
find_package(tf2_geometry_msgs REQUIRED)
find_package(composition_interfaces REQUIRED)
find_package(ffmpeg_image_transport_msgs REQUIRED)
set(dependencies
ament_index_cpp
camera_info_manager
cv_bridge
depthai_ros_msgs
image_transport
rclcpp
sensor_msgs
stereo_msgs
std_msgs
vision_msgs
tf2_ros
tf2_geometry_msgs
tf2
composition_interfaces
ffmpeg_image_transport_msgs
)
include_directories(
include
${BUILD_TOOL_INCLUDE_DIRS}
)
file(GLOB LIB_SRC
"src/DisparityConverter.cpp"
"src/ImageConverter.cpp"
"src/ImgDetectionConverter.cpp"
"src/SpatialDetectionConverter.cpp"
"src/ImuConverter.cpp"
"src/TFPublisher.cpp"
"src/TrackedFeaturesConverter.cpp"
"src/TrackDetectionConverter.cpp"
"src/TrackSpatialDetectionConverter.cpp"
)
add_library(${PROJECT_NAME} SHARED ${LIB_SRC})
ament_target_dependencies(${PROJECT_NAME}
${dependencies})
target_compile_definitions(${PROJECT_NAME} PUBLIC IS_ROS2)
message(STATUS "--------------------------$ENV{ROS_DISTRO} ---")
message(STATUS $ENV{ROS_DISTRO})
if($ENV{ROS_DISTRO} STREQUAL "galactic" OR ($ENV{ROS_DISTRO} STREQUAL "rolling" AND "${ubuntu_version}" STREQUAL "20.04\n"))
target_compile_definitions(${PROJECT_NAME} PRIVATE IS_GALACTIC)
endif()
if($ENV{ROS_DISTRO} STREQUAL "humble")
target_compile_definitions(${PROJECT_NAME} PRIVATE IS_HUMBLE)
endif()
target_link_libraries(${PROJECT_NAME}
depthai::core
opencv_imgproc
opencv_highgui
opencv_calib3d)
ament_export_targets(depthai_bridgeTargets HAS_LIBRARY_TARGET)
install(DIRECTORY include/
DESTINATION include/
)
install(TARGETS depthai_bridge
EXPORT depthai_bridgeTargets
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin
INCLUDES DESTINATION include
)
install(EXPORT depthai_bridgeTargets
DESTINATION share/${PROJECT_NAME}/cmake)
install(DIRECTORY rviz DESTINATION share/${PROJECT_NAME})
ament_export_include_directories(include)
ament_export_libraries(depthai_bridge)
ament_export_dependencies(${dependencies})
ament_package()