Skip to content

Commit

Permalink
Merge pull request #139 from flynneva/cmake-cleanup
Browse files Browse the repository at this point in the history
consolidate srcs, use ament_auto macros, closes #138
  • Loading branch information
flynneva authored Mar 27, 2021
2 parents 66f04f7 + 94817b1 commit e54b0f4
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 49 deletions.
49 changes: 16 additions & 33 deletions CMakeLists.txt
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()
25 changes: 9 additions & 16 deletions package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,29 +17,22 @@

<buildtool_depend>ament_cmake</buildtool_depend>

<depend>rclcpp</depend>
<depend>std_msgs</depend>
<depend>std_srvs</depend>
<depend>sensor_msgs</depend>
<depend>camera_info_manager</depend>
<depend>builtin_interfaces</depend>
<depend>image_transport</depend>
<depend>v4l-utils</depend>

<depend>ffmpeg</depend>
<depend>libboost-dev</depend>
<depend>libboost-lexical-cast-dev</depend>

<test_depend>ament_lint_auto</test_depend>
<test_depend>ament_lint_common</test_depend>

<!--
<build_depend>std_msgs</build_depend>
<build_depend>std_srvs</build_depend>
<build_depend>sensor_msgs</build_depend>
<build_depend>ffmpeg</build_depend>
<build_depend>camera_info_manager</build_depend>
<run_depend>image_transport</run_depend>
<run_depend>roscpp</run_depend>
<run_depend>std_msgs</run_depend>
<run_depend>std_srvs</run_depend>
<run_depend>sensor_msgs</run_depend>
<run_depend>ffmpeg</run_depend>
<run_depend>camera_info_manager</run_depend>
<run_depend>v4l-utils</run_depend>
-->

<buildtool_depend>rosidl_default_generators</buildtool_depend>
<exec_depend>rosidl_default_runtime</exec_depend>
Expand Down
File renamed without changes.

0 comments on commit e54b0f4

Please sign in to comment.