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

[core] samples and tests moved to ecal folder #1419

Merged
merged 5 commits into from
Mar 5, 2024

Conversation

rex-schilasky
Copy link
Contributor

Description

All ecal-core sample and test c/c++ projects are now inside the ecal core subdirectory. This allow easy alignment with ecal-core project and may lead to an integration as submodule finally.

Cherry-pick to

  • none

@rex-schilasky rex-schilasky marked this pull request as ready for review March 4, 2024 17:44
Copy link
Contributor

@KerstinKeller KerstinKeller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should change the eCAL_SubCreate / eCAL_Pub_Create signatures, such that they are in line with the creation of an SDatatypeInformation object.

Also see my comment about the CMake option in ecal/CMakeLists.txt.

add_subdirectory(service)

if(BUILD_ECAL_TESTS)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in this file, we will use only options prefixed with ECAL_CORE -> we need option(ECAL_CORE_BUILD_TESTS ON "build ecal tests") or something similar. -> I am open for the naming, but it should be consitent for the subcomponents. In eCAL itself we have not been 100% consistent.

From Main CMakeLists.txt you will then do

if (BUILD_ECAL_TESTS)
  set(ECAL_CORE_BUILD_TESTS ON)
endif()

add_subdirectory(cpp/services/ping_client_dyn)
add_subdirectory(cpp/services/ping_server)
endif()
endif()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be honest, this is nuts. Too many options, too many combinations, too hard to maintain.
Maybe we can find another way for the samples to build them only if their specified component is available?
Doing all of that with CMake/preprocessor directives only is so error prone.
Maybe we can think more in the component direction. Just to keep thinking about it.

@@ -40,4 +40,4 @@ target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14)

ecal_install_sample(${PROJECT_NAME})

set_property(TARGET ${PROJECT_NAME} PROPERTY FOLDER samples/c/pubsub/string)
set_property(TARGET ${PROJECT_NAME} PROPERTY FOLDER core/samples/c/pubsub/string)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think CMake is actually able to automate this. However, I think for the user it might be more convenient to actually group by test first, and then the component?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could try using CMAKE_FOLDER and do string(APPEND CMAKE_FOLDER "/<scope>") at the top for every directory. Would be pretty tedious to go through and change everything over though. Upside being you don't need to call set_property(TARGET for every target however.

@@ -33,7 +33,7 @@ int main(int argc, char **argv)

// create subscriber "Hello"
sub = eCAL_Sub_New();
eCAL_Sub_Create(sub, "Hello", "std::string", "base", "", 0);
eCAL_Sub_Create(sub, "Hello", "base", "std::string", "", 0);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure about this? (apparently yes, but does it make sense for the API?) How do we construct the SDatatypeInformation Objects? SDatatypeInformation(name, encoding, descriptor).
So I think we should change the eCAL_Sub_Create signature to reflect that.


source_group(TREE "${CMAKE_CURRENT_SOURCE_DIR}" FILES
${${PROJECT_NAME}_src}
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the future, we may consider building different parts of eCAL (pub, sub, ...) as object or static libraries, so that we can test their interfaces better and don't have to list and build all sources again as done here.

@rex-schilasky rex-schilasky requested review from FlorianReimold and removed request for FlorianReimold March 5, 2024 14:50
Copy link
Contributor

@KerstinKeller KerstinKeller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good now

@rex-schilasky rex-schilasky merged commit cd37eca into master Mar 5, 2024
14 checks passed
@rex-schilasky rex-schilasky deleted the move-samples-and-tests-to-ecal branch March 5, 2024 14:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants