Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into igtd/cmake-cxx-std
Browse files Browse the repository at this point in the history
  • Loading branch information
iguessthislldo committed Apr 12, 2024
2 parents ac2e8f1 + 5c8dd05 commit 7ec61db
Show file tree
Hide file tree
Showing 19 changed files with 761 additions and 269 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,8 @@ jobs:
-DBUILD_SHARED_LIBS=TRUE^
-DOPENDDS_ACE_TAO_SRC=${{ github.workspace }}\OpenDDS\build\ACE_TAO^
-DOPENDDS_MPC=${{ github.workspace }}\MPC^
-DOPENDDS_XERCES3=${{ env.VCPKG_INSTALLED_DIR }}/x64-windows^
-DOPENDDS_OPENSSL=${{ env.VCPKG_INSTALLED_DIR }}/x64-windows^
-DOPENDDS_BUILD_TESTS=TRUE^
-DOPENDDS_CMAKE_VERBOSE=all
- uses: ammaraskar/[email protected]
Expand All @@ -308,6 +310,15 @@ jobs:
runs-on: windows-2022

steps:
- name: setup for run-vcpkg
shell: bash
run: |
echo '{ "name": "opendds", "version-string": "github-actions", "dependencies": [ "openssl", "xerces-c" ] }' > vcpkg.json
- name: install openssl & xerces-c
uses: lukka/run-vcpkg@v11
with:
vcpkgGitCommitId: '${{ env.VCPKG_GIT_COMMIT }}'
runVcpkgInstall: true
- name: Checkout OpenDDS
uses: actions/checkout@v4
with:
Expand All @@ -334,6 +345,8 @@ jobs:
-DBUILD_SHARED_LIBS=FALSE^
-DOPENDDS_ACE_TAO_SRC=${{ github.workspace }}\OpenDDS\build\ACE_TAO^
-DOPENDDS_MPC=${{ github.workspace }}\MPC^
-DOPENDDS_XERCES3=${{ env.VCPKG_INSTALLED_DIR }}/x64-windows^
-DOPENDDS_OPENSSL=${{ env.VCPKG_INSTALLED_DIR }}/x64-windows^
-DOPENDDS_BUILD_TESTS=TRUE^
-DOPENDDS_CMAKE_VERBOSE=all
- uses: ammaraskar/[email protected]
Expand Down Expand Up @@ -389,6 +402,8 @@ jobs:
-DBUILD_SHARED_LIBS=TRUE^
-DOPENDDS_ACE_TAO_SRC=${{ github.workspace }}\OpenDDS\build\ACE_TAO^
-DOPENDDS_MPC=${{ github.workspace }}\MPC^
-DOPENDDS_XERCES3=${{ env.VCPKG_INSTALLED_DIR }}/x64-windows^
-DOPENDDS_OPENSSL=${{ env.VCPKG_INSTALLED_DIR }}/x64-windows^
-DOPENDDS_BUILD_TESTS=TRUE^
-DOPENDDS_CMAKE_VERBOSE=all
- uses: ammaraskar/[email protected]
Expand All @@ -408,6 +423,15 @@ jobs:
runs-on: windows-2022

steps:
- name: setup for run-vcpkg
shell: bash
run: |
echo '{ "name": "opendds", "version-string": "github-actions", "dependencies": [ "openssl", "xerces-c" ] }' > vcpkg.json
- name: install openssl & xerces-c
uses: lukka/run-vcpkg@v11
with:
vcpkgGitCommitId: '${{ env.VCPKG_GIT_COMMIT }}'
runVcpkgInstall: true
- name: Checkout OpenDDS
uses: actions/checkout@v4
with:
Expand All @@ -434,6 +458,8 @@ jobs:
-DBUILD_SHARED_LIBS=FALSE^
-DOPENDDS_ACE_TAO_SRC=${{ github.workspace }}\OpenDDS\build\ACE_TAO^
-DOPENDDS_MPC=${{ github.workspace }}\MPC^
-DOPENDDS_XERCES3=${{ env.VCPKG_INSTALLED_DIR }}/x64-windows^
-DOPENDDS_OPENSSL=${{ env.VCPKG_INSTALLED_DIR }}/x64-windows^
-DOPENDDS_BUILD_TESTS=TRUE^
-DOPENDDS_CMAKE_VERBOSE=all
- uses: ammaraskar/[email protected]
Expand Down
10 changes: 0 additions & 10 deletions cmake/ace_group.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,6 @@ _opendds_group_exe(ace_gperf
EXTRA_BIN_DIRS "${TAO_BIN_DIR}"
)

if(OPENDDS_XERCES3)
find_package(XercesC PATHS "${OPENDDS_XERCES3}" NO_DEFAULT_PATH QUIET)
if(NOT XercesC_FOUND)
find_package(XercesC QUIET)
endif()
if(NOT XercesC_FOUND)
message(FATAL_ERROR "Could not find XercesC")
endif()
endif()

function(_opendds_vs_force_static)
# Make sure the MSVC runtime library, which is similar to libc of other
# systems, is the same kind everywhere. Normally we shouldn't make global
Expand Down
35 changes: 22 additions & 13 deletions cmake/build_ace_tao.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,14 @@ execute_process(

# Get the C++ standard OpenDDS is going to be built with. We are going to force
# the ACE/TAO build to use the same standard.
set(opendds_idl_std "$<TARGET_PROPERTY:opendds_idl,CXX_STANDARD>")
set(dcps_std "$<TARGET_PROPERTY:OpenDDS_Dcps,CXX_STANDARD>")
set(std "$<IF:$<TARGET_EXISTS:OpenDDS_Dcps>,${dcps_std},${opendds_idl_std}>")
set(_opendds_idl_std "$<TARGET_PROPERTY:opendds_idl,CXX_STANDARD>")
set(_opendds_dcps_std "$<TARGET_PROPERTY:OpenDDS_Dcps,CXX_STANDARD>")
set(_opendds_std "$<IF:$<TARGET_EXISTS:OpenDDS_Dcps>,${_opendds_dcps_std},${_opendds_idl_std}>")

set(_build_cmd "${CMAKE_COMMAND}" -E env "ACE_ROOT=${OPENDDS_ACE}" "TAO_ROOT=${OPENDDS_TAO}")
if(_OPENDDS_XERCES3_FOR_ACE)
list(APPEND _build_cmd "XERCESCROOT=${_OPENDDS_XERCES3_FOR_ACE}")
endif()

if(_OPENDDS_MPC_TYPE STREQUAL gnuace)
execute_process(
Expand Down Expand Up @@ -74,20 +79,23 @@ if(_OPENDDS_MPC_TYPE STREQUAL gnuace)
list(APPEND byproducts "${file}")
endforeach()

set(make_cmd "${CMAKE_COMMAND}" -E env "ACE_ROOT=${OPENDDS_ACE}" "TAO_ROOT=${OPENDDS_TAO}")
if(CMAKE_GENERATOR STREQUAL "Unix Makefiles")
list(APPEND make_cmd "$(MAKE)")
list(APPEND _build_cmd "$(MAKE)")
else()
find_program(make_exe NAMES gmake make)
cmake_host_system_information(RESULT core_count QUERY NUMBER_OF_LOGICAL_CORES)
list(APPEND make_cmd "${make_exe}" "-j${core_count}")
list(APPEND _build_cmd "${make_exe}" "-j${core_count}")
endif()

list(APPEND _build_cmd
"opendds_cmake_std=$<IF:$<BOOL:${_opendds_std}>,-std=c++${_opendds_std},>"
)

ExternalProject_Add(build_ace_tao
SOURCE_DIR "${OPENDDS_ACE_TAO_SRC}"
CONFIGURE_COMMAND "${CMAKE_COMMAND}" -E echo "Already configured"
BUILD_IN_SOURCE TRUE
BUILD_COMMAND ${make_cmd} "opendds_cmake_std=$<IF:$<BOOL:${std}>,-std=c++${std},>"
BUILD_COMMAND ${_build_cmd}
BUILD_BYPRODUCTS ${byproducts}
USES_TERMINAL_BUILD TRUE # Needed for Ninja to show the ACE/TAO build
INSTALL_COMMAND "${CMAKE_COMMAND}" -E echo "No install step"
Expand Down Expand Up @@ -132,16 +140,17 @@ elseif(_OPENDDS_MPC_TYPE MATCHES "^vs")
endif()
endforeach()

list(APPEND _build_cmd
MSBuild "${sln}" "-maxcpucount"
"-property:Configuration=$<CONFIG>,Platform=${CMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE}"
"$<IF:$<BOOL:${_opendds_std}>,-property:LanguageStandard=stdcpp${_opendds_std},>"
)

ExternalProject_Add(build_ace_tao
SOURCE_DIR "${OPENDDS_ACE_TAO_SRC}"
CONFIGURE_COMMAND "${CMAKE_COMMAND}" -E echo "Already configured"
BUILD_IN_SOURCE TRUE
BUILD_COMMAND
"${CMAKE_COMMAND}" -E env "ACE_ROOT=${OPENDDS_ACE}" "TAO_ROOT=${OPENDDS_TAO}"
MSBuild "${sln}"
"-property:Configuration=$<CONFIG>,Platform=${CMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE}"
"$<IF:$<BOOL:${std}>,-property:LanguageStandard=stdcpp${std},>"
"-maxcpucount"
BUILD_COMMAND ${_build_cmd}
BUILD_BYPRODUCTS ${byproducts}
USES_TERMINAL_BUILD TRUE # Needed for Ninja to show the ACE/TAO build
INSTALL_COMMAND "${CMAKE_COMMAND}" -E echo "No install step"
Expand Down
9 changes: 9 additions & 0 deletions cmake/configure_ace_tao.pl
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
push(@opts, "$key=s");
}
push(@opts, "macro-line=s@");
my %env;
push(@opts, "env=s%" => %env);
if (!GetOptions(\%values, @opts)) {
exit(1);
}
Expand Down Expand Up @@ -120,6 +122,13 @@ sub read_file {
$ENV{MPC_ROOT} = File::Spec->rel2abs($values{mpc});
$ENV{ACE_ROOT} = File::Spec->rel2abs($values{ace});
$ENV{TAO_ROOT} = File::Spec->rel2abs($values{tao});
if ($values{'env'}) {
for my $name (keys(%{$values{'env'}})) {
my $value = $values{env}->{$name};
print("env: $name=$value\n");
$ENV{$name} = $value;
}
}
my $mwc_name = 'ACE_TAO_for_OpenDDS.mwc';
my $mwc_src = $values{'workspace-file'} // "$FindBin::RealBin/../$mwc_name";
my $mwc = "$values{src}/$mwc_name";
Expand Down
13 changes: 13 additions & 0 deletions cmake/init.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -530,3 +530,16 @@ if(NOT DEFINED OPENDDS_SUPPORTS_SHMEM)
set(OPENDDS_SUPPORTS_SHMEM TRUE)
endif()
endif()

# This should be in ace_group.cmake, but it's needed by build_ace_tao.cmake.
if(OPENDDS_XERCES3)
find_package(XercesC PATHS "${OPENDDS_XERCES3}" NO_DEFAULT_PATH QUIET)
if(NOT XercesC_FOUND)
find_package(XercesC QUIET)
endif()
if(NOT XercesC_FOUND)
message(FATAL_ERROR "Could not find XercesC")
endif()
get_filename_component(_opendds_xerces3_for_ace "${XercesC_INCLUDE_DIRS}" DIRECTORY)
set(_OPENDDS_XERCES3_FOR_ACE "${_opendds_xerces3_for_ace}" CACHE PATH "" FORCE)
endif()
4 changes: 2 additions & 2 deletions dds/DCPS/QOS_XML_Handler/XML_String_Intf.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ namespace XML
class XML_Error_Handler;
}

XERCES_CPP_NAMESPACE_BEGIN
namespace XERCES_CPP_NAMESPACE {
class XercesDOMParser;
class DOMDocument;
XERCES_CPP_NAMESPACE_END
}

OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL

Expand Down
39 changes: 32 additions & 7 deletions dds/DCPS/ValueDispatcher.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
#include "TypeSupportImpl.h"
#include "ValueReader.h"
#include "ValueWriter.h"
#include "Sample.h"
#include "debug.h"

OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL

Expand All @@ -21,8 +23,8 @@ struct OpenDDS_Dcps_Export ValueDispatcher {
virtual void* new_value() const = 0;
virtual void delete_value(void* data) const = 0;

virtual bool read(ValueReader& value_reader, void* data) const = 0;
virtual bool write(ValueWriter& value_writer, const void* data) const = 0;
virtual bool read(ValueReader& value_reader, void* data, Sample::Extent ext = Sample::Full) const = 0;
virtual bool write(ValueWriter& value_writer, const void* data, Sample::Extent ext = Sample::Full) const = 0;

virtual DDS::InstanceHandle_t register_instance_helper(DDS::DataWriter* dw, const void* data) const = 0;
virtual DDS::ReturnCode_t write_helper(DDS::DataWriter* dw, const void* data, DDS::InstanceHandle_t inst) const = 0;
Expand All @@ -45,17 +47,40 @@ struct ValueDispatcher_T : public virtual ValueDispatcher {
delete tbd;
}

virtual bool read(ValueReader& value_reader, void* data) const
typedef typename OpenDDS::DCPS::DDSTraits<T> TraitsType;

virtual bool read(ValueReader& value_reader, void* data, Sample::Extent ext = Sample::Full) const
{
return vread(value_reader, *static_cast<T*>(data));
switch (ext) {
case Sample::Full:
return vread(value_reader, *static_cast<T*>(data));
case Sample::KeyOnly:
return vread(value_reader, *static_cast<const KeyOnly<T>*>(data));
default:
if (log_level >= LogLevel::Notice) {
ACE_ERROR((LM_NOTICE, "(%P|%t) NOTICE: ValueDispatcher_T<%C>::read:"
" Called with Sample::Extent NestedKeyOnly\n", TraitsType::type_name()));
}
return false;
}
}

virtual bool write(ValueWriter& value_writer, const void* data) const
virtual bool write(ValueWriter& value_writer, const void* data, Sample::Extent ext = Sample::Full) const
{
return vwrite(value_writer, *static_cast<const T*>(data));
switch (ext) {
case Sample::Full:
return vwrite(value_writer, *static_cast<const T*>(data));
case Sample::KeyOnly:
return vwrite(value_writer, *static_cast<const KeyOnly<const T>*>(data));
default:
if (log_level >= LogLevel::Notice) {
ACE_ERROR((LM_NOTICE, "(%P|%t) NOTICE: ValueDispatcher_T<%C>::write:"
" Called with Sample::Extent NestedKeyOnly\n", TraitsType::type_name()));
}
return false;
}
}

typedef typename OpenDDS::DCPS::DDSTraits<T> TraitsType;
typedef typename TraitsType::DataWriterType DataWriterType;

virtual DDS::InstanceHandle_t register_instance_helper(DDS::DataWriter* dw, const void* data) const
Expand Down
16 changes: 8 additions & 8 deletions dds/DCPS/XTypes/DynamicDataImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5042,10 +5042,6 @@ bool serialized_size_dynamic_union(const Encoding& encoding, size_t& size,
using namespace OpenDDS::XTypes;
const DDS::DynamicType_var type = union_data->type();
const DDS::DynamicType_var base_type = get_base_type(type);
if (ext == Sample::KeyOnly && !has_explicit_keys(base_type)) {
// nothing is serialized (not even a delimiter) for key-only serialization when there is no @key
return true;
}

DDS::TypeDescriptor_var td;
if (!get_type_descriptor(base_type, td)) {
Expand All @@ -5058,6 +5054,10 @@ bool serialized_size_dynamic_union(const Encoding& encoding, size_t& size,
serialized_size_delimiter(encoding, size);
}

if (ext == Sample::KeyOnly && !has_explicit_keys(base_type)) {
return true;
}

// Discriminator
size_t mutable_running_total = 0;
DDS::DynamicType_var disc_type = get_base_type(td->discriminator_type());
Expand Down Expand Up @@ -5704,10 +5704,6 @@ bool serialize_dynamic_union(Serializer& ser, DDS::DynamicData_ptr data, Sample:
using namespace OpenDDS::XTypes;
const DDS::DynamicType_var type = data->type();
const DDS::DynamicType_var base_type = get_base_type(type);
if (ext == Sample::KeyOnly && !has_explicit_keys(base_type)) {
// nothing is serialized (not even a delimiter) for key-only serialization when there is no @key
return true;
}

DDS::TypeDescriptor_var td;
if (!get_type_descriptor(base_type, td)) {
Expand All @@ -5725,6 +5721,10 @@ bool serialize_dynamic_union(Serializer& ser, DDS::DynamicData_ptr data, Sample:
}
}

if (ext == Sample::KeyOnly && !has_explicit_keys(base_type)) {
return true;
}

// Discriminator
DDS::DynamicTypeMember_var dtm;
if (base_type->get_member(dtm, DISCRIMINATOR_ID) != DDS::RETCODE_OK) {
Expand Down
Loading

0 comments on commit 7ec61db

Please sign in to comment.