/cyclonedds-cxx

Primary LanguageC++OtherNOASSERTION

C++ binding for Eclipse Cyclone DDS

An implementation of the ISO/IEC C++ PSM, or simply put, a C++ binding for Eclipse Cyclone DDS. Cyclone DDS is developed completely in the open as an Eclipse IoT project (see eclipse-cyclone-dds) with a growing list of adopters (if you're one of them, please add your logo). It is a tier-1 middleware for the Robot Operating System ROS 2.

Build Status Coverity Status

Getting Started

Building the Eclipse Cyclone DDS C++ binding

In order to build the C++ binding for Cyclone DDS you need a Linux, Mac or Windows 10 machine (or, with some caveats, a *BSD, OpenIndiana one) with the following installed on your host:

Eclipse Cyclone DDS and the CXX Idl compiler have dependencies of their own, most notably Java and Apache Maven. To build and install the respective projects, please consult their build instructions. Ensure both projects are installed into locations convenient for you by specifying CMAKE_INSTALL_PREFIX.

The CXX Idl compiler is a temporary dependency, a new IDL compiler for both Eclipse Cyclone DDS and Eclipse Cyclone DDS CXX is in the works.

To obtain the C++ binding for Cyclone DDS, do

$ git clone https://github.com/eclipse-cyclonedds/cyclonedds-cxx.git
$ cd cyclonedds-cxx
$ mkdir build

Depending on whether you want to develop applications using the C++ binding for Cyclone DDS or contribute to it you can follow different procedures.

For application developers

To build and install the required libraries needed to develop your own applications using the C++ binding for Cyclone DDS requires a few simple steps. There are some small differences between Linux and macOS on the one hand, and Windows on the other. For Linux or macOS:

$ cd build
$ cmake -DCMAKE_INSTALL_PREFIX=<install-location> \
        -DCMAKE_PREFIX_PATH="<idlpp-cxx-install-location>;<cyclonedds-install-location>" \
        ..
$ cmake --build .

and for Windows:

$ cd build
$ cmake -G "<generator-name>" \
        -DCMAKE_INSTALL_PREFIX=<install-location> \
        -DCMAKE_PREFIX_PATH="<idlpp-cxx-install-location>;<cyclonedds-install-location>" \
        ..
$ cmake --build .

where you should replace <install-location> by the directory under which you would like to install the C++ binding for Cyclone DDS and <generator-name> by one of the ways CMake generators offer for generating build files. For example, "Visual Studio 15 2017 Win64" would target a 64-bit build using Visual Studio 2017.

To install it after a successful build, do:

$ cmake --build . --target install

Which will copy everything to:

  • <install-location>/lib
  • <install-location>/bin
  • <install-location>/include/ddsc
  • <install-location>/share/CycloneDDS-CXX

Depending on the installation location you may need administrator privileges.

At this point you are ready to use Eclipse Cyclone DDS in your own projects.

Note that the default build type is a release build with debug information included (RelWithDebInfo), which is generally the most convenient type of build to use from applications because of a good mix between performance and still being able to debug things. If you'd rather have a Debug or pure Release build, set CMAKE_BUILD_TYPE accordingly.

Contributing to Eclipse Cyclone DDS

We very much welcome all contributions to the project, whether that is questions, examples, bug fixes, enhancements or improvements to the documentation, or anything else really. When considering contributing code, it might be good to know that build configurations for Travis CI and AppVeyor are present in the repository and that there is a test suite using CTest and Google Test that can be built locally if desired. To build it, set the cmake variable BUILD_TESTING to on when configuring, e.g.:

$ cd build
$ cmake -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTING=ON ..
$ cmake --build .
$ ctest

Such a build requires the presence of Google Test. You can install this yourself, or you can choose to instead rely on the Conan package manager that the CI build infrastructure also uses. In that case, install Conan and do:

$ conan install .. --build missing

in the build directory prior to running cmake. This will automatically download and/or build Google Test.

The Google Test Conan package is hosted in the Bincrafters Bintray repository. In case this repository was not added to your Conan remotes list yet (and the above mentioned install command failed because it could not find the Google Test package), you can add the Bintray repository by:

$ conan remote add <REMOTE> https://api.bintray.com/conan/bincrafters/public-conan

Replace <REMOTE> with a name that identifies the repository (e.g. bincrafters).

For Windows, depending on the generator, you might also need to add switches to select the architecture and build type, e.g.,

$ conan install -s arch=x86_64 -s build_type=Debug ..

Documentation

The documentation is still rather limited, and at the moment only available in the sources (in the form of restructured text files in docs and Doxygen comments in the header files). The intent is to automate the process of building the documentation and have them available in more convenient formats and in the usual locations.

Building and Running the HelloWorld Example

We will show you how to build and run an example program that illustrates the necessary steps to setup DCPS entities. The examples are built automatically when you build the C++ language binding for Cyclone DDS, so you don't need to follow these steps to be able to run the program, it is merely to illustrate the process.

$ mkdir helloworld
$ cd helloworld
$ cmake <install-location>/share/CycloneDDS-CXX/examples/helloworld
$ cmake --build .

On one terminal start the application that will be responding to messages:

$ ./ddscxxHelloWorldSubscriber

On another terminal, start the application that will be sending the messages:

$ ./ddscxxHelloWorldPublisher

Trademarks

  • "Eclipse Cyclone DDS" and "Cyclone DDS" are trademarks of the Eclipse Foundation.
  • "DDS" is a trademark of the Object Management Group, Inc.
  • "ROS" is a trademark of Open Source Robotics Foundation, Inc.

License

This project contains 2 types of license: Apache2 and Eclipse Public License / Eclipse Distribution License

  • The Apache2 license located in src/ddscxx/include/dds is for all files under src/ddscxx/include/dds except the details directories
  • Eclipse Public License / Eclipse Distribution License is valid for all other files.