Skip to content

Usability improvements for connextdds_add_application #116

Open
@alexcamposruiz

Description

@alexcamposruiz

Description

connextdds_add_application in combination with connextdds_call_codegen can be a useful and flexible utility for users to integrate Connext code into their build systems. It's more flexible than connextdds_add_example, and easier to use than lower-level primitives (as in this example CMakeLists.txt).

In order to expose this way of building Connext applications I think there're a few usability improvements to consider.

This is how you can write a CMakeLists.txt today:

connextdds_call_codegen(
    IDL "foo"
    LANG "C++11"
    PREFIX "foo" # Is this really needed? Can we reuse the IDL name?
)

connextdds_add_application(
    TARGET "publisher"
    LANG "C++11" # support more C++ standard versions (see #115)
    OUTPUT_NAME "foo_publisher"
    SOURCES
        $<TARGET_OBJECTS:foo_CXX11_obj> # how can we make this a variable that doen't need to be guessed?
        "${CMAKE_CURRENT_SOURCE_DIR}/foo_publisher.cxx"
    DEPENDENCIES
        ${_CONNEXT_DEPENDENCIES}
    NO_REQUIRE_QOS # Make this the default, and specify which files to copy with a REQUIRED_FILES variable instead
)

The improvements would:

  • Provide a more general default behavior (copying files)
  • Remove unnecessary required variables (PREFIX)
  • Remove implementation details from the interface (foo_CXX11_obj)

Suggested solutions

An improved version could be:

connextdds_call_codegen(
    IDL "foo"
    LANG "C++11"
)

connextdds_add_application(
    TARGET "publisher"
    LANG "C++17"
    OUTPUT_NAME "foo_publisher"
    SOURCES
        $<TARGET_OBJECTS:foo_obj> # use just the prefix (or the IDL if PREFIX is not specified)
        "${CMAKE_CURRENT_SOURCE_DIR}/foo_publisher.cxx"
    DEPENDENCIES
        ${_CONNEXT_DEPENDENCIES}
    REQUIRED_FILES
         "USER_QOS_PROFILES.xml" 
         "app.xml"
)

Or:

connextdds_call_codegen(
    IDL "foo"
    LANG "C++11"
    PREFIX "foo_cpp"
)

connextdds_add_application(
    TARGET "publisher"
    LANG "C++17"
    OUTPUT_NAME "foo_publisher"
    SOURCES
        $<TARGET_OBJECTS:foo_cpp_obj> # use PREFIX directly
        "${CMAKE_CURRENT_SOURCE_DIR}/foo_publisher.cxx"
    DEPENDENCIES
        ${_CONNEXT_DEPENDENCIES}
)

In that example USER_QOS_PROFILES.xml wouldn't be copied. The variable NO_REQUIRE_QOS wouldn't be required.

Metadata

Metadata

Assignees

Labels

find-packageFindRTIConnextDDS.cmake related issuesunconfirmedThe issue is not yet confirmed

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions