Search code examples
cmakepublish-subscribedata-distribution-servicerti-dds

How to get CMake to generate TypeSupport files such as <idl_file>Support.[cxx,h]?


I am using CMake to generate files from an IDL and placing them in a library on RedHat. Problem is, the <idl_file>Support[c,h] files are not being generated so I can't register type support. In CMake, I have the following line which generates the <idl_file>Plugin.[c,h] and <idl_file>.[cxx,h] files. The problem is, it's not generating any <idl_file>Support.[cxx,h] files.

connextdds_rtiddsgen_run(IDL_FILE myFile.idl LANG "C++11")

As far as I know, I'm not using these as standalone by creating a library with them inside, am I? I did not use NDDS_STANDALONE_TYPE, nor add ndds_standalone_type.cxx.

If I use the following command-line, the <idl_file>Support[c,h] files will show up.

rtiddsgen -namespace myFile.idl

However, if I manually add the *Plugin.[c,h], *Support.[c,h], and *.[c.h] files and compile into a lib, then link against it w/ my program, there are a lot of undefined references such as:

myns::myTypePlugin_serialize_to_cdr_buffer(char*, unsigned int*, myns::myType const*) myns::myTypeSeq::length() const
myns::myTypePluginSupport_create_data_w_params(myns::myType*, DDS_TYPEDeallocationParams_t const*)
myns::myTypePluginSupport_create_data_w_params(DDS_TypeAllocationParams_t const*)

And so I'm trying to get CMake to do this work for me hoping for a better outcome. How would I make CMake generate these TypeSupport files?


Solution

  • According to the script ConnextDdsCodegen.cmake, which defines connextdds_rtiddsgen_run function, it is expected that files *Support.cxx and *Support.h will be generated for C++ language:

    list(APPEND sources "${path_base}Plugin.cxx" "${path_base}Support.cxx")
    list(APPEND headers "${path_base}Plugin.h" "${path_base}Support.h")
    

    but I see no addition of these files in case of C++11 language.

    Probably this means that given files (*Support.cxx and *Support.h) won't be generated for C++11 (and for C++03 too).