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

Add support for FastDDS versions earlier than 2.13 #82

Merged
merged 7 commits into from
Jan 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions ddspipe_core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,7 @@ compile_library(
# Test
###############################################################################
# Compile tests if CMake options requires it
compile_test_library(
"${PROJECT_SOURCE_DIR}/test" # Test directory
)
compile_test_library("${PROJECT_SOURCE_DIR}/test/")

###############################################################################
# Packaging
Expand Down
2 changes: 1 addition & 1 deletion ddspipe_core/project_settings.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ set(MODULE_FIND_PACKAGES
cpp_utils
)

set(fastrtps_MINIMUM_VERSION "2.8")
set(fastrtps_MINIMUM_VERSION "2.10")

set(MODULE_DEPENDENCIES
$<$<BOOL:${WIN32}>:iphlpapi$<SEMICOLON>Shlwapi>
Expand Down
15 changes: 11 additions & 4 deletions ddspipe_core/test/unittest/types/dynamic_types/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,15 @@

set(TEST_NAME dtypes_idl_tests)

# Determine Fast DDS version
if ("${fastrtps_VERSION}" VERSION_LESS 2.13)
set(DDS_TYPES_VERSION "v1")
else()
set(DDS_TYPES_VERSION "v2")
endif()

# Add to test sources every FastDDSGen file generated
file(GLOB DATATYPE_SOURCES_CXX "types/**/*.cxx")
file(GLOB DATATYPE_SOURCES_CXX "types/${DDS_TYPES_VERSION}/**/*.cxx")
set(TEST_SOURCES
dtypes_idl_tests.cpp
${PROJECT_SOURCE_DIR}/src/cpp/types/dynamic_types/schema_idl.cpp
Expand All @@ -42,7 +49,7 @@ file(
RESULT_SOURCES_IDL
RELATIVE
"${CMAKE_CURRENT_SOURCE_DIR}"
"types/idls/*.idl")
"types/${DDS_TYPES_VERSION}/idls/*.idl")

set(TEST_NEEDED_SOURCES
${RESULT_SOURCES_IDL}
Expand All @@ -63,7 +70,7 @@ add_unittest_executable(
set(TEST_NAME dtypes_msg_tests)

# Add to test sources every FastDDSGen file generated
file(GLOB DATATYPE_SOURCES_CXX "types/**/*.cxx")
file(GLOB DATATYPE_SOURCES_CXX "types/${DDS_TYPES_VERSION}/**/*.cxx")
set(TEST_SOURCES
dtypes_msg_tests.cpp
${PROJECT_SOURCE_DIR}/src/cpp/types/dynamic_types/schema_msg.cpp
Expand All @@ -86,7 +93,7 @@ file(
RESULT_SOURCES_MSG
RELATIVE
"${CMAKE_CURRENT_SOURCE_DIR}"
"types/msgs/*.msg")
"types/${DDS_TYPES_VERSION}/msgs/*.msg")

set(TEST_NEEDED_SOURCES
${RESULT_SOURCES_MSG}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@

#include <ddspipe_core/types/dynamic_types/schema.hpp>

#include "types/all_types.hpp"
#if FASTRTPS_VERSION_MAJOR <= 2 && FASTRTPS_VERSION_MINOR < 13
#include "types/v1/all_types.hpp"
#else
#include "types/v2/all_types.hpp"
#endif // if FASTRTPS_VERSION_MAJOR <= 2 && FASTRTPS_VERSION_MINOR < 13

using namespace eprosima;

Expand All @@ -39,7 +43,11 @@ std::string read_idl_from_file_(
std::string file_name_by_type(
SupportedType type)
{
return std::string("types/idls/") + to_string(type) + ".idl";
#if FASTRTPS_VERSION_MAJOR <= 2 && FASTRTPS_VERSION_MINOR < 13
return std::string("types/v1/idls/") + to_string(type) + ".idl";
#else
return std::string("types/v2/idls/") + to_string(type) + ".idl";
#endif // if FASTRTPS_VERSION_MAJOR <= 2 && FASTRTPS_VERSION_MINOR < 13
}

void compare_schemas(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@
#include <cpp_utils/file/file_utils.hpp>
#include <fastrtps/types/DynamicTypePtr.h>
#include <ddspipe_core/types/dynamic_types/schema.hpp>
#include "types/all_types.hpp"
#if FASTRTPS_VERSION_MAJOR <= 2 && FASTRTPS_VERSION_MINOR < 13
#include "types/v1/all_types.hpp"
#else
#include "types/v2/all_types.hpp"
#endif // if FASTRTPS_VERSION_MAJOR <= 2 && FASTRTPS_VERSION_MINOR < 13

using namespace eprosima;

Expand All @@ -34,7 +38,11 @@ std::string read_msg_from_file_(
std::string file_name_by_type(
SupportedType type)
{
return std::string("types/msgs/") + to_string(type) + ".msg";
#if FASTRTPS_VERSION_MAJOR <= 2 && FASTRTPS_VERSION_MINOR < 13
return std::string("types/v1/msgs/") + to_string(type) + ".msg";
#else
return std::string("types/v2/msgs/") + to_string(type) + ".msg";
#endif // if FASTRTPS_VERSION_MAJOR <= 2 && FASTRTPS_VERSION_MINOR < 13
}

void compare_schemas(
Expand Down
Loading
Loading