Use rosdep (#32)

* Add Cyclone DDS build dependencies for rosdep

* Update README.md

Change apt install commands to rosdep install.

* build_depend -> buildtool_depend for maven and java

* Add vendor package to build cyclonedds from source

Remove maven and java dependency (thanks, @eboasson)

* remove --symlink-build flag

this obscures the intention of the code and sophisticated users can choose whether to use it or not.

* add rosdep to readme
This commit is contained in:
Dan Rose 2019-09-13 04:54:06 -05:00 committed by eboasson
parent 883ef01105
commit 3edf332573
6 changed files with 49 additions and 11 deletions

View file

@ -6,26 +6,25 @@ implementation.
## Getting, building and using it ## Getting, building and using it
All it takes to get Cyclone DDS support into ROS2 is to clone this repository and the Cyclone DDS All it takes to get Cyclone DDS support into ROS2 is to clone this repository into the ROS2 workspace
one in the ROS2 workspace source directory, and then run colcon build in the usual manner: source directory, and then run colcon build in the usual manner:
cd ros2_ws/src cd ros2_ws/src
git clone https://github.com/atolab/rmw_cyclonedds git clone https://github.com/atolab/rmw_cyclonedds
git clone https://github.com/eclipse-cyclonedds/cyclonedds
cd .. cd ..
colcon build --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=RelWithDebInfo rosdep install --from src -i
colcon build --cmake-args -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCYCLONEDDS_FROM_SOURCE=ON
export RMW_IMPLEMENTATION=rmw_cyclonedds_cpp export RMW_IMPLEMENTATION=rmw_cyclonedds_cpp
If you prefer to install CycloneDDS yourself, set `-DCYCLONEDDS_FROM_SOURCE=OFF`. CMake caches this
value, so you can omit it between builds
This seems to work fine on Linux with a binary ROS2 installation as well as when building ROS2 from This seems to work fine on Linux with a binary ROS2 installation as well as when building ROS2 from
source. On macOS it has only been tested in a source build on a machine in an "unsupported" source. On macOS it has only been tested in a source build on a machine in an "unsupported"
configuration (macOS 10.14 with SIP enabled, instead of 10.12 with SIP disabled), and apart from a configuration (macOS 10.14 with SIP enabled, instead of 10.12 with SIP disabled), and apart from a
few details that are caused by the machine configuration, that works fine, too. There is no reason few details that are caused by the machine configuration, that works fine, too. There is no reason
why it wouldn't work the same on Windows, but I haven't tried. why it wouldn't work the same on Windows, but I haven't tried.
That said, Cyclone DDS has some prerequisites because it currently relies on Java and Maven to build
its IDL preprocessor, and so it is probably advisable to check its README for details. On an Ubuntu
18.04 system, ``sudo apt-get install maven default-jdk`` will likely address that.
If you want to use a pre-existing installation of Cyclone DDS, you don't need to clone it, but you If you want to use a pre-existing installation of Cyclone DDS, you don't need to clone it, but you
may have to tell CMake where to look for it using the CycloneDDS\_DIR variable. That also appears may have to tell CMake where to look for it using the CycloneDDS\_DIR variable. That also appears
to be the case if there are other packages in the ROS2 workspace that you would like to use Cyclone to be the case if there are other packages in the ROS2 workspace that you would like to use Cyclone

View file

@ -0,0 +1,14 @@
cmake_minimum_required(VERSION 3.5)
project(cyclonedds_vendor)
find_package(ament_cmake REQUIRED)
include(ExternalProject)
ExternalProject_Add(cyclonedds
GIT_REPOSITORY "https://github.com/eclipse-cyclonedds/cyclonedds.git"
CMAKE_ARGS
-DBUILD_CONFTOOL:BOOL=OFF
-DBUILD_IDLC:BOOL=OFF
-DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}
)
ament_package()

View file

@ -0,0 +1,15 @@
<?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>cyclonedds_vendor</name>
<version>0.4.0</version>
<description>Wrapper package for Eclipse CycloneDDS.</description>
<maintainer email="erik.boasson@adlinktech.com">Erik Boasson</maintainer>
<license>Apache License 2.0</license>
<buildtool_depend>ament_cmake</buildtool_depend>
<export>
<build_type>ament_cmake</build_type>
</export>
</package>

View file

@ -16,6 +16,8 @@ cmake_minimum_required(VERSION 3.5)
project(rmw_cyclonedds_cpp) project(rmw_cyclonedds_cpp)
set(CYCLONEDDS_FROM_SOURCE CACHE BOOL "Should we download and build cycloneDDS from source?")
link_directories(/usr/local/lib) link_directories(/usr/local/lib)
# Default to C++14 # Default to C++14
@ -31,7 +33,13 @@ find_package(ament_cmake_ros REQUIRED)
find_package(rcutils REQUIRED) find_package(rcutils REQUIRED)
if (CYCLONEDDS_FROM_SOURCE)
message("Building CycloneDDS from source")
find_package(cyclonedds_vendor REQUIRED)
else()
find_package(cyclonedds_cmake_module REQUIRED) find_package(cyclonedds_cmake_module REQUIRED)
message("Using installed CycloneDDS")
endif()
find_package(CycloneDDS REQUIRED CONFIG) find_package(CycloneDDS REQUIRED CONFIG)
find_package(rmw REQUIRED) find_package(rmw REQUIRED)

View file

@ -14,6 +14,8 @@
<build_depend>cyclonedds</build_depend> <build_depend>cyclonedds</build_depend>
<build_depend>cyclonedds_cmake_module</build_depend> <build_depend>cyclonedds_cmake_module</build_depend>
<build_depend>cyclonedds_vendor</build_depend>
<build_depend>rcutils</build_depend> <build_depend>rcutils</build_depend>
<build_depend>rmw</build_depend> <build_depend>rmw</build_depend>
<build_depend>rosidl_generator_c</build_depend> <build_depend>rosidl_generator_c</build_depend>