Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Usability improvements for connextdds_add_application #116

Open
alexcamposruiz opened this issue May 2, 2024 · 0 comments
Open

Usability improvements for connextdds_add_application #116

alexcamposruiz opened this issue May 2, 2024 · 0 comments
Assignees
Labels
find-package FindRTIConnextDDS.cmake related issues unconfirmed The issue is not yet confirmed

Comments

@alexcamposruiz
Copy link
Collaborator

alexcamposruiz commented May 2, 2024

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.

@alexcamposruiz alexcamposruiz added find-package FindRTIConnextDDS.cmake related issues unconfirmed The issue is not yet confirmed labels May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
find-package FindRTIConnextDDS.cmake related issues unconfirmed The issue is not yet confirmed
Projects
None yet
Development

No branches or pull requests

2 participants