-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
106 lines (87 loc) · 2.15 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
cmake_minimum_required(VERSION 3.5)
project(decklink_ros)
# Default to C++14
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 14)
endif()
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
endif()
# Default release build
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type" FORCE)
endif()
# Options
SET(DECKLINK_SDK_DIR CACHE PATH "Path to Blackmagic SDK.")
# Find third party libraries
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)
find_package(image_transport REQUIRED)
find_package(std_msgs REQUIRED)
find_package(sensor_msgs REQUIRED)
find_package(camera_info_manager REQUIRED)
find_package(cv_bridge REQUIRED)
find_package(DeckLinkAPI REQUIRED)
# Decklink ROS library
add_library(${PROJECT_NAME}
src/decklink_capture.cpp
src/decklink_ros_pub_thread.cpp
)
target_link_libraries(${PROJECT_NAME}
${DeckLinkAPI_LIBRARIES}
)
target_include_directories(${PROJECT_NAME}
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
PRIVATE
${DeckLinkAPI_INCLUDE_DIRS}
src
)
ament_target_dependencies(${PROJECT_NAME}
rclcpp
image_transport
std_msgs
sensor_msgs
camera_info_manager
cv_bridge
)
# Executable spinning Decklink ROS node
add_executable(${PROJECT_NAME}_node
src/${PROJECT_NAME}_node.cpp
)
target_link_libraries(${PROJECT_NAME}_node
${PROJECT_NAME}
)
ament_target_dependencies(${PROJECT_NAME}_node
rclcpp
)
target_include_directories(${PROJECT_NAME}_node
PRIVATE
${DeckLinkAPI_INCLUDE_DIRS}
src
)
# Export and install
ament_export_targets(${PROJECT_NAME}Targets HAS_LIBRARY_TARGET)
ament_export_dependencies(
rclcpp
image_transport
std_msgs
sensor_msgs
camera_info_manager
cv_bridge
)
install(DIRECTORY include/
DESTINATION include
)
install(TARGETS ${PROJECT_NAME} ${PROJECT_NAME}_node
EXPORT ${PROJECT_NAME}Targets
LIBRARY DESTINATION lib
RUNTIME DESTINATION lib/${PROJECT_NAME}
INCLUDES DESTINATION include
)
install(DIRECTORY launch
DESTINATION share/${PROJECT_NAME}
)
ament_package()