Skip to content

Commit

Permalink
Replace type_discovery option with typelib
Browse files Browse the repository at this point in the history
This replaces the enable_type_discovery build option with enable_typelib,
which reflects a similar change in Cyclone C. Additionally a missing
include directive for ddsi_typelib.h is added.

Signed-off-by: Dennis Potman <[email protected]>
  • Loading branch information
dpotman authored and eboasson committed Aug 1, 2023
1 parent becf6e8 commit f16956e
Show file tree
Hide file tree
Showing 10 changed files with 29 additions and 25 deletions.
2 changes: 1 addition & 1 deletion .azure/templates/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ steps:
-DCMAKE_PREFIX_PATH="${BUILD_SOURCESDIRECTORY}/iceoryx/build/install" \
-DSANITIZER=${SANITIZER:-none} \
-DENABLE_SHM=${ICEORYX:-off} \
-DENABLE_TYPE_DISCOVERY=${TYPE_DISCOVERY:-on} \
-DENABLE_TYPELIB=${TYPELIB:-on} \
-DENABLE_TOPIC_DISCOVERY=${TOPIC_DISCOVERY:-on} \
${GENERATOR:+-G} "${GENERATOR}" -A "${PLATFORM}" -T "${TOOLSET}" ..
cmake --build . --config ${BUILD_TYPE} --target install -- ${BUILD_TOOL_OPTIONS}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/misra-regressions-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ jobs:
- name: Build Cyclone DDS CXX
run: |
mkdir build
cmake -DCMAKE_INSTALL_PREFIX=install -DCMAKE_PREFIX_PATH="$CYCLONEDDS_HOME" -DENABLE_TOPIC_DISCOVERY=TRUE -DENABLE_TYPE_DISCOVERY=TRUE -B build
cmake -DCMAKE_INSTALL_PREFIX=install -DCMAKE_PREFIX_PATH="$CYCLONEDDS_HOME" -DENABLE_TOPIC_DISCOVERY=TRUE -DENABLE_TYPELIB=TRUE -B build
cmake --build build
- name: Perform CodeQL Analysis
Expand Down
20 changes: 10 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -244,15 +244,15 @@ elseif(cyclonedds_has_shm)
message(FATAL_ERROR "Cyclone DDS is compiled with support for shared memory")
endif()

get_target_property(cyclonedds_has_type_discovery CycloneDDS::ddsc TYPE_DISCOVERY_IS_AVAILABLE)
mark_as_advanced(cyclonedds_has_type_discovery)
option(ENABLE_TYPE_DISCOVERY "Enable Type Discovery support" ${cyclonedds_has_type_discovery})
if(ENABLE_TYPE_DISCOVERY)
if (NOT cyclonedds_has_type_discovery)
message(FATAL_ERROR "Cyclone DDS is not compiled with type discovery enabled")
get_target_property(cyclonedds_has_typelib CycloneDDS::ddsc TYPELIB_IS_AVAILABLE)
mark_as_advanced(cyclonedds_has_typelib)
option(ENABLE_TYPELIB "Enable Type Library support" ${cyclonedds_has_typelib})
if(ENABLE_TYPELIB)
if (NOT cyclonedds_has_typelib)
message(FATAL_ERROR "Cyclone DDS is not compiled with type library enabled")
endif()
message(STATUS "Compiling with type discovery support")
set(DDSCXX_HAS_TYPE_DISCOVERY "1")
message(STATUS "Compiling with type library support")
set(DDSCXX_HAS_TYPELIB "1")
endif()

get_target_property(cyclonedds_has_topic_discovery CycloneDDS::ddsc TOPIC_DISCOVERY_IS_AVAILABLE)
Expand All @@ -262,8 +262,8 @@ if(ENABLE_TOPIC_DISCOVERY)
if (NOT cyclonedds_has_topic_discovery)
message(FATAL_ERROR "Cyclone DDS is not compiled with topic discovery enabled")
endif()
if(NOT ENABLE_TYPE_DISCOVERY)
message(FATAL_ERROR "ENABLE_TOPIC_DISCOVERY requires ENABLE_TYPE_DISCOVERY to be enabled")
if(NOT ENABLE_TYPELIB)
message(FATAL_ERROR "ENABLE_TOPIC_DISCOVERY requires ENABLE_TYPELIB to be enabled")
endif()
message(STATUS "Compiling with topic discovery support")
set(DDSCXX_HAS_TOPIC_DISCOVERY "1")
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ There are some configuration options specified using CMake defines in addition t
* `-DBUILD_EXAMPLES=ON`: to build examples
* `-DENABLE_LEGACY=YES`: to enable legacy c++11 mode, adds boost as dependency (otherwise it uses c++17)
* `-DENABLE_SHM=YES`: to enable shared memory support
* `-DENABLE_TYPE_DISCOVERY=YES`: to enable type discovery support
* `-DENABLE_TOPIC_DISCOVERY=YES`: to enable topic discovery support
* `-DENABLE_TYPELIB=YES`: to enable type library support
* `-DENABLE_TOPIC_DISCOVERY=YES`: to enable topic discovery support
* `-DENABLE_COVERAGE=YES`: to enable coverage build

### For application developers
Expand Down
4 changes: 2 additions & 2 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,12 @@ strategy:
cc: clang-12
cxx: clang++-12
legacy: on
'Ubuntu 22.04 LTS with GCC 12 (Debug, x86_64, no type discovery)':
'Ubuntu 22.04 LTS with GCC 12 (Debug, x86_64, no type lib)':
image: ubuntu-22.04
sanitizer: address
cc: gcc-12
cxx: g++-12
type_discovery: off
type_lib: off
topic_discovery: off
'macOS 11 with Clang 12 (Debug, x86_64)':
image: macOS-11
Expand Down
2 changes: 1 addition & 1 deletion features.hpp.in
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#cmakedefine DDSCXX_HAS_SHM @DDSCXX_HAS_SHM@

/* Whether or not support for type discovery is included */
#cmakedefine DDSCXX_HAS_TYPE_DISCOVERY @DDSCXX_HAS_TYPE_DISCOVERY@
#cmakedefine DDSCXX_HAS_TYPELIB @DDSCXX_HAS_TYPELIB@

/* Whether or not support for topic discovery is included */
#cmakedefine DDSCXX_HAS_TOPIC_DISCOVERY @DDSCXX_HAS_TOPIC_DISCOVERY@
Expand Down
10 changes: 7 additions & 3 deletions src/ddscxx/include/org/eclipse/cyclonedds/topic/TopicTraits.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// http://www.eclipse.org/org/documents/edl-v10.php.
//
// SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause

/**
* @file
*/
Expand All @@ -20,6 +20,10 @@
#include "org/eclipse/cyclonedds/core/cdr/cdr_enums.hpp"
#include "dds/features.hpp"

#ifdef DDSCXX_HAS_TYPELIB
#include "dds/ddsi/ddsi_typelib.h"
#endif

//forward declaration of c++ sertype wrapper
template <typename T, class S> class ddscxx_sertype;

Expand Down Expand Up @@ -149,7 +153,7 @@ template <class TOPIC> class TopicTraits
return extensibility::ext_final;
}

#ifdef DDSCXX_HAS_TYPE_DISCOVERY
#ifdef DDSCXX_HAS_TYPELIB
/**
* @brief Returns the typeid for TOPIC.
*
Expand Down Expand Up @@ -247,7 +251,7 @@ template <class TOPIC> class TopicTraits
{
return nullptr;
}
#endif //DDSCXX_HAS_TYPE_DISCOVERY
#endif //DDSCXX_HAS_TYPELIB

/**
* @brief Returns a pointer to the derived sertype.
Expand Down
4 changes: 2 additions & 2 deletions src/ddscxx/include/org/eclipse/cyclonedds/topic/datatopic.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -989,15 +989,15 @@ struct ddscxx_sertype_ops: public ddsi_sertype_ops {
sertype_free_samples<T>,
sertype_equal<T>,
sertype_hash<T>,
#ifdef DDSCXX_HAS_TYPE_DISCOVERY
#ifdef DDSCXX_HAS_TYPELIB
TopicTraits<T>::getTypeId,
TopicTraits<T>::getTypeMap,
TopicTraits<T>::getTypeInfo,
#else
nullptr,
nullptr,
nullptr,
#endif //DDSCXX_HAS_TYPE_DISCOVERY
#endif //DDSCXX_HAS_TYPELIB
TopicTraits<T>::deriveSertype,
sertype_get_serialized_size<T,S>,
sertype_serialize_into<T,S>
Expand Down
2 changes: 1 addition & 1 deletion src/ddscxx/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ set(sources
DeferredDestruction.cpp
KeyHash.cpp)

if (ENABLE_TYPE_DISCOVERY AND ENABLE_TOPIC_DISCOVERY)
if (ENABLE_TYPELIB AND ENABLE_TOPIC_DISCOVERY)
# Add topic/type discovery tests
list(APPEND sources
FindTopic.cpp
Expand Down
4 changes: 2 additions & 2 deletions src/idlcxx/src/traits.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ emit_traits(
" return extensibility::ext_%2$s;\n"
"}\n\n";
static const char *type_info_decl1 =
"#ifdef DDSCXX_HAS_TYPE_DISCOVERY\n"
"#ifdef DDSCXX_HAS_TYPELIB\n"
"template<> constexpr unsigned int TopicTraits<%1$s>::type_map_blob_sz() { return %2$u; }\n"
"template<> constexpr unsigned int TopicTraits<%1$s>::type_info_blob_sz() { return %3$u; }\n"
"template<> inline const uint8_t * TopicTraits<%1$s>::type_map_blob() {\n"
Expand All @@ -143,7 +143,7 @@ emit_traits(
"};\n"
" return blob;\n"
"}\n"
"#endif //DDSCXX_HAS_TYPE_DISCOVERY\n\n";
"#endif //DDSCXX_HAS_TYPELIB\n\n";

if (IDL_PRINTA(&name, get_cpp11_fully_scoped_name, node, gen) < 0 ||
idl_fprintf(gen->header.handle, fmt, name, name+2) < 0)
Expand Down

0 comments on commit f16956e

Please sign in to comment.