Skip to content

Commit

Permalink
removed dependency to ros1_bridge package (#90)
Browse files Browse the repository at this point in the history
* removed dependency to ros1_bridge package:
 * checking if package is available
 * if not skipping (with warnings)
 * now rosbag2_tests builds on systems without ros1

* check ros1 deps correctly on all packages

* add ros1_bridge to test package

* silently try to find the bridge
  • Loading branch information
DensoADAS authored and Karsten1987 committed Mar 25, 2019
1 parent 1a3782d commit 05b9c4c
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 40 deletions.
15 changes: 15 additions & 0 deletions ros1_rosbag_storage_vendor/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,21 @@ if(WIN32)
return()
endif()

# include bridge first to not create package if ros1 packages cannot be found
find_package(ros1_bridge QUIET)
if(NOT ros1_bridge_FOUND)
message(STATUS "Failed to find ros1_bridge, skipping...")
# call ament_package() to avoid ament_tools treating this as a plain CMake pkg
ament_package()
return()
endif()
find_ros1_package(roscpp)
if(NOT ros1_roscpp_FOUND)
message(STATUS "Failed to find ROS 1 roscpp, skipping...")
ament_package()
return()
endif()

include(ExternalProject)
# We have to include a number of patches to the rosbag
# 1. rosbag1_encryption_patch includes https://github.com/ros/ros_comm/pull/1499, without it, pluginlib won't link
Expand Down
16 changes: 5 additions & 11 deletions rosbag2_bag_v2_plugins/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,17 @@ endif()

find_package(ament_cmake REQUIRED)

find_package(PkgConfig)
if(NOT PKG_CONFIG_FOUND)
message(WARNING "Failed to find PkgConfig, skipping...")
# include bridge first to not create package if ros1 packages cannot be found
find_package(ros1_bridge QUIET)
if (NOT ros1_bridge_FOUND)
message(STATUS "Failed to find ros1_bridge, skipping...")
# call ament_package() to avoid ament_tools treating this as a plain CMake pkg
ament_package()
return()
endif()

# include bridge first to not create package if ros1 packages cannot be found
find_package(ros1_bridge REQUIRED)
include(${ros1_bridge_DIR}/find_ros1_interface_packages.cmake)
include(${ros1_bridge_DIR}/find_ros1_package.cmake)

find_ros1_package(roscpp)
if(NOT ros1_roscpp_FOUND)
message(WARNING "Failed to find ROS 1 roscpp, skipping...")
# call ament_package() to avoid ament_tools treating this as a plain CMake pkg
message(STATUS "Failed to find ROS 1 roscpp, skipping...")
ament_package()
return()
endif()
Expand Down
15 changes: 0 additions & 15 deletions rosbag2_tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,6 @@ endif()
find_package(ament_cmake REQUIRED)
find_package(ament_index_cpp REQUIRED)

find_package(PkgConfig)
if(PKG_CONFIG_FOUND)
find_package(ros1_bridge REQUIRED)
include(${ros1_bridge_DIR}/find_ros1_interface_packages.cmake)
include(${ros1_bridge_DIR}/find_ros1_package.cmake)
find_ros1_package(roscpp)
if(NOT ros1_roscpp_FOUND)
set(SKIP_ROS1_TESTS "SKIP_TEST")
message(WARNING "Skipping build of tests for rosbag_v2 plugin. ROS 1 not found")
endif()
else()
set(SKIP_ROS1_TESTS "SKIP_TEST")
message(WARNING "Skipping build of tests for rosbag_v2 plugin. ROS 1 not found")
endif()

if(BUILD_TESTING)
include(cmake/skip_ros1_tests_if_necessary.cmake)
skip_ros1_tests_if_necessary()
Expand Down
23 changes: 9 additions & 14 deletions rosbag2_tests/cmake/skip_ros1_tests_if_necessary.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,15 @@
# plugin is not available

macro(skip_ros1_tests_if_necessary)
find_package(PkgConfig)
if(PKG_CONFIG_FOUND)
find_package(ros1_bridge REQUIRED)
include(${ros1_bridge_DIR}/find_ros1_interface_packages.cmake)
include(${ros1_bridge_DIR}/find_ros1_package.cmake)
find_package(ros1_bridge QUIET)
if(ros1_bridge_FOUND)
find_ros1_package(roscpp)
if(NOT ros1_roscpp_FOUND)
set(SKIP_ROS1_TESTS "SKIP_TEST")
message(WARNING
"Skipping build of tests for rosbag_v2 plugin. ROS 1 not found")
if(ros1_roscpp_FOUND)
return()
endif()
else()
set(SKIP_ROS1_TESTS "SKIP_TEST")
message(WARNING
"Skipping build of tests for rosbag_v2 plugin. ROS 1 not found")
endif()
endmacro()

set(SKIP_ROS1_TESTS "SKIP_TEST")
message(STATUS
"Skipping build of tests for rosbag_v2 plugin. ROS 1 not found")
endmacro()
1 change: 1 addition & 0 deletions rosbag2_tests/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
<test_depend>rosbag2_test_common</test_depend>
<test_depend>rosbag2_storage</test_depend>
<test_depend>rosbag2</test_depend>
<test_depend>ros1_bridge</test_depend>
<test_depend>ros2bag</test_depend>
<test_depend>rclcpp</test_depend>
<test_depend>std_msgs</test_depend>
Expand Down

0 comments on commit 05b9c4c

Please sign in to comment.