-
Notifications
You must be signed in to change notification settings - Fork 599
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #139 from flynneva/cmake-cleanup
consolidate srcs, use ament_auto macros, closes #138
- Loading branch information
Showing
3 changed files
with
25 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,60 +1,43 @@ | ||
cmake_minimum_required(VERSION 3.5) | ||
project(usb_cam) | ||
|
||
## Find catkin macros and libraries | ||
## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz) | ||
## is used, also find other catkin packages | ||
|
||
# find_package(camera_info_manager REQUIRED) | ||
# find_package(image_transport REQUIRED) | ||
find_package(builtin_interfaces REQUIRED) | ||
find_package(rclcpp REQUIRED) | ||
find_package(std_msgs REQUIRED) | ||
find_package(std_srvs REQUIRED) | ||
find_package(sensor_msgs REQUIRED) | ||
# 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() | ||
|
||
find_package(ament_cmake_auto REQUIRED) | ||
ament_auto_find_build_dependencies() | ||
|
||
## pkg-config libraries | ||
find_package(PkgConfig REQUIRED) | ||
pkg_check_modules(avcodec libavcodec REQUIRED) | ||
pkg_check_modules(swscale libswscale REQUIRED) | ||
|
||
# idl stuff | ||
# msg/Format.msg | ||
|
||
include_directories(include | ||
${avcodec_INCLUDE_DIRS} | ||
${swscale_INCLUDE_DIRS} | ||
) | ||
|
||
## Build the USB camera library | ||
add_library(${PROJECT_NAME} src/usb_cam.cpp) | ||
target_link_libraries(${PROJECT_NAME} | ||
${avcodec_LIBRARIES} | ||
${swscale_LIBRARIES} | ||
ament_auto_add_library(${PROJECT_NAME} SHARED | ||
src/usb_cam.cpp | ||
) | ||
|
||
## Declare a cpp executable | ||
add_executable(${PROJECT_NAME}_node nodes/usb_cam_node.cpp) | ||
ament_auto_add_executable(${PROJECT_NAME}_node src/usb_cam_node.cpp) | ||
target_link_libraries(${PROJECT_NAME}_node | ||
${PROJECT_NAME} | ||
${avcodec_LIBRARIES} | ||
${swscale_LIBRARIES} | ||
# TODO(lucasw) should this have been in libavcodec? | ||
avutil | ||
) | ||
|
||
ament_target_dependencies(${PROJECT_NAME} | ||
"builtin_interfaces" | ||
"rclcpp" | ||
"sensor_msgs" | ||
"std_msgs" | ||
"std_srvs" | ||
#avutil | ||
) | ||
|
||
install(TARGETS ${PROJECT_NAME} ${PROJECT_NAME}_node DESTINATION lib/${PROJECT_NAME}) | ||
install(PROGRAMS scripts/show_image.py DESTINATION lib/${PROJECT_NAME}) | ||
|
||
install(DIRECTORY config DESTINATION share/${PROJECT_NAME}) | ||
install(DIRECTORY launch DESTINATION share/${PROJECT_NAME}) | ||
|
||
ament_package() | ||
ament_auto_package() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.