Giter Club home page Giter Club logo

idlpp-cxx's Introduction

CXX Idl compiler for CycloneDDS

This project provides an idl compiler to compile datatypes that can be used in the CXX API for CycloneDDS

This compiler will be replaced with our new idl compiler which is currently under development here

Requirements for the CXX Idl compiler

In order to build the Idl compiler you need a Linux, Mac or Windows 10 machine with the following installed on your host:

  • Git
  • CMake, version 3.7 or later. (Version 3.6 should work but you will have to edit the cmake_minimum_required version.)
  • Java JDK, version 8 or later, e.g., OpenJDK 11.
  • Apache Maven, version 3.5 or later.

Building

Building the Idl compiler, requires only 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:

$ git clone https://github.com/ADLINK-IST/idlpp-cxx.git
$ cd idlpp-cxx
$ mkdir build
$ cd build
$ cmake <cmake-config_options> ..
$ cmake --build .

and for Windows:

$ git clone https://github.com/ADLINK-IST/idlpp-cxx.git
$ cd idlpp-cxx
$ mkdir build
$ cd build
$ cmake -G "<generator-name>" <cmake-config_options> ..
$ cmake --build .

where you replace <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.

The <cmake-config_options> can be ignored or replaced. A few of the most common options are: -DCMAKE_INSTALL_PREFIX=<install-location> -DCMAKE_BUILD_TYPE=Debug

$ cmake -DCMAKE_BUILD_TYPE=Debug ..

Packaging

If you want to package the product, the config step and build step are slightly different compared to how it is normally build.

The -DCMAKE_INSTALL_PREFIX=<install-location> option should be added to the configuration, where the <install-location> is replaced by the directory under which you would like to install the Idl compiler.

During the build step, you have to specify that you want to build the install target as well.

This would make the build look like

$ mkdir build
$ cd build
$ cmake -DCMAKE_INSTALL_PREFIX=<install-location>  ..
$ cmake --build . --target install

Don't forget the generator when building on Windows.

After the build, required files are copied to:

  • <install-location>/lib
  • <install-location>/share

The <install-location> directory is will be used to create the package(s).

$ cpack

Depending on the target, you now have packages.

idlpp-cxx's People

Contributors

e-hndrks avatar eboasson avatar thijssassen avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar

idlpp-cxx's Issues

[Bug] Linker Error on Clang 13 Compiler

Hi,
while compiling idlpp-cxx with the latest clang stable release i encountered the following linker errors:

/usr/bin/ld: CMakeFiles/cppgen.dir/__/ppresources/ospli/src/cpp/code/set.c.o:(.bss+0xc): multiple definition of `expr_sharp'; CMakeFiles/cppgen.dir/__/ppresources/ospli/src/cpp/code/eval.c.o:(.bss+0xc): first defined here
/usr/bin/ld: CMakeFiles/cppgen.dir/__/ppresources/ospli/src/cpp/code/sharp.c.o:(.bss+0x0): multiple definition of `ifstack'; CMakeFiles/cppgen.dir/__/ppresources/ospli/src/cpp/code/at.c.o:(.bss+0x0): first defined here
/usr/bin/ld: CMakeFiles/cppgen.dir/__/ppresources/ospli/src/cpp/code/sharp.c.o:(.bss+0x8): multiple definition of `n_skipped_ifs'; CMakeFiles/cppgen.dir/__/ppresources/ospli/src/cpp/code/at.c.o:(.bss+0x8): first defined here
/usr/bin/ld: CMakeFiles/cppgen.dir/__/ppresources/ospli/src/cpp/code/undef.c.o:(.bss+0x0): multiple definition of `ifstack'; CMakeFiles/cppgen.dir/__/ppresources/ospli/src/cpp/code/at.c.o:(.bss+0x0): first defined here
/usr/bin/ld: CMakeFiles/cppgen.dir/__/ppresources/ospli/src/cpp/code/undef.c.o:(.bss+0x8): multiple definition of `n_skipped_ifs'; CMakeFiles/cppgen.dir/__/ppresources/ospli/src/cpp/code/at.c.o:(.bss+0x8): first defined here
/usr/bin/ld: CMakeFiles/cppgen.dir/__/ppresources/ospli/src/cpp/code/while.c.o:(.bss+0x0): multiple definition of `ifstack'; CMakeFiles/cppgen.dir/__/ppresources/ospli/src/cpp/code/at.c.o:(.bss+0x0): first defined here
/usr/bin/ld: CMakeFiles/cppgen.dir/__/ppresources/ospli/src/cpp/code/while.c.o:(.bss+0x8): multiple definition of `n_skipped_ifs'; CMakeFiles/cppgen.dir/__/ppresources/ospli/src/cpp/code/at.c.o:(.bss+0x8): first defined here

Happens on idlpp-cxx-1.0.0 and master branch. With clang-10 everything compiles. I guess this happens due some global declarations in header files.

Affected global declarations in the following files:
idlpp/ppresources/ospli/src/cpp/code/expr.h - int expr_sharp;
idlpp/ppresources/ospli/src/cpp/code/if.h - IF *ifstack;
idlpp/ppresources/ospli/src/cpp/code/if.h - int n_skipped_ifs;
idlpp/ppresources/ospli/src/tools/idlpp/code/idl_genIdlHelper.h - os_iter idl_idlScopeKeyList;
idlpp/ppresources/ospli/src/tools/idlpp/code/idl_genIdlHelper.h - os_iter idl_idlScopeStreamsList;

I guess these variables need to be declared, but i'm not sure about the implications in the overall system.

Vector of string is not handled correctly

Hello everyone,
I am having troubles working with a vector of strings. I have the following IDL file:

module Msg
{
struct StringSeq {
	long id;
	sequence<string<10>, 5> names;
};
#pragma keylist StringSeq id
};

which should allow me to work with a vector with at most 5 strings of maximal 10 characters.
Now, I would like to write a message using cyclonedds-cxx. To this end, I just took the helloworld example, I changed the IDL file with mine above and replaced the content of the file publisher.cpp with:

#include <iostream>
#include "dds/dds.hpp"
#include "StringSeq_DCPS.hpp"
using namespace org::eclipse::cyclonedds;
int main() {
    dds::domain::DomainParticipant participant(domain::default_id());
    dds::topic::Topic<Msg::StringSeq> topic(participant, "StringSeq");
    dds::pub::Publisher publisher(participant);
    dds::pub::DataWriter<Msg::StringSeq> writer(publisher, topic);
    std::vector<std::string> stringVector{"Name1", "Name2", "Name3"};
    Msg::StringSeq msg(18, stringVector);
    writer.write(msg);
    std::cout << "Messagge written." << std::endl;
    return EXIT_SUCCESS;
}

However, the execution results in an error when the function __Msg_StringSeq__copyIn in the file StringSeqSplDcps.cpp tries to "strncpy" the first entry of stringVector in an invalid location, since the components of dest0 have not been initialized properly in the previous line of code:

dest0 = (length0 == 0) ? 0 : (char * *)dds_alloc(length0 * sizeof(char *));

Is this problem caused because a corresponding for-loop is missing in the function idl_seqAllocBuffer in the file idl_genLiteISOCxxCopyin.c?

Thank you in advance, any help would be appreciated.
Best regards,
Ettore Vidotto

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.