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

Some more backports to 010x #433

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
52 changes: 21 additions & 31 deletions .azure/templates/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,27 +27,21 @@ steps:
echo "###vso[task.setvariable variable=build_type;]Debug"
name: setup
- bash: |
echo "###vso[task.setvariable variable=pip_cache;]${HOME}/.cache/pip"
echo "###vso[task.setvariable variable=conan_cache;]${HOME}/.conan/data"
echo "###vso[task.setvariable variable=PATH;]$(python3 -m site --user-base)/bin:${PATH}"
echo "###vso[task.setvariable variable=build_tool_options;]-j 4"
sudo apt-get install -y clang clang-tools clang-tidy
sudo apt install -y clang clang-tools clang-tidy libboost-dev
condition: eq(variables['Agent.OS'], 'Linux')
name: setup_linux
- bash: |
echo "###vso[task.setvariable variable=pip_cache;]${HOME}/Library/Caches/pip"
echo "###vso[task.setvariable variable=conan_cache;]${HOME}/.conan/data"
echo "###vso[task.setvariable variable=PATH;]$(python3 -m site --user-base)/bin:${PATH}"
echo "###vso[task.setvariable variable=build_tool_options;]-j 4"
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --setglobalstate off
brew install bison
brew install googletest
condition: eq(variables['Agent.OS'], 'Darwin')
name: setup_macos
# Use PowerShell rather than Bash to ensure Windows-style paths
- pwsh: |
$python_bin = python -m site --user-base
Write-Host "###vso[task.setvariable variable=pip_cache;]${env:LOCALAPPDATA}\\pip\\Cache"
Write-Host "###vso[task.setvariable variable=conan_cache;]${env:USERPROFILE}\\.conan\\data"
Write-Host "###vso[task.setvariable variable=PATH;]$python_bin\\bin;${env:PATH}"
# Visual Studio is most likely used on Windows agents
if (${env:GENERATOR} -match "2019" -and -not ${env:PLATFORM}) {
Expand All @@ -61,29 +55,27 @@ steps:
}
}
Write-Host "###vso[task.setvariable variable=build_tool_options;]-nologo -verbosity:minimal -maxcpucount:4 -p:CL_MPCount=4"
choco install winflexbison3
condition: eq(variables['Agent.OS'], 'Windows_NT')
name: setup_windows
- task: Cache@2
inputs:
key: pip | 2 | $(Agent.OS)
path: $(pip_cache)
name: cache_pip
- task: Cache@2
inputs:
key: conan | 2 | $(Agent.OS) | $(arch) | $(build_type)
path: $(conan_cache)
name: cache_conan
- bash: |
set -e -x
pip install "conan==1.59.0" --user
conan profile new default --detect
name: install_conan
- pwsh: |
# boost-msvc-14.1 for VS 2017
# boost-msvc-14.2 for VS 2019
# boost-msvc-14.3 for VS 2022
choco install -y boost-msvc-14.2
condition: and(eq(variables['Agent.OS'], 'Windows_NT'), eq(variables['legacy'], 'on'))
name: setup_windows_boost
# Google Test doesn't seem to be available in Chocolatey
# Google Test 1.12.1 is the latest one to support C++11 (only relevant if legacy=on)
# and "apt install googletest" doesn't seem to do the trick on Linux
- bash: |
set -e -x
conan profile update settings.compiler.libcxx=libstdc++11 default
condition: eq(variables['Agent.OS'], 'Linux')
name: update_conan_cxx_library
git clone --depth 1 --branch release-1.12.1 https://github.com/google/googletest.git
mkdir googletest/build
cd googletest/build
cmake -DCMAKE_INSTALL_PREFIX=install -DBUILD_SHARED_LIBS=on \
${GENERATOR:+-G} "${GENERATOR}" -A "${PLATFORM}" -T "${TOOLSET}" ..
cmake --build . --config ${BUILD_TYPE} --target install -- ${BUILD_TOOL_OPTIONS}
condition: or(eq(variables['Agent.OS'], 'Linux'), eq(variables['Agent.OS'], 'Windows_NT'))
name: setup_googletest
- bash: |
set -e -x
sudo apt-get install libacl1-dev libncurses5-dev pkg-config
Expand All @@ -109,7 +101,6 @@ steps:
cyclonedds
mkdir cyclonedds/build
cd cyclonedds/build
conan install -b missing -s arch=${ARCH} -s build_type=${BUILD_TYPE} ..
cmake -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
-DCMAKE_INSTALL_PREFIX=install \
-DCMAKE_PREFIX_PATH="${BUILD_SOURCESDIRECTORY}/iceoryx/build/install" \
Expand All @@ -122,10 +113,9 @@ steps:
set -e -x
mkdir build
cd build
conan install -b missing -s arch=${ARCH} -s build_type=${BUILD_TYPE} ..
cmake -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
-DCMAKE_INSTALL_PREFIX=install \
-DCMAKE_PREFIX_PATH="${BUILD_SOURCESDIRECTORY}/cyclonedds/build/install;${BUILD_SOURCESDIRECTORY}/iceoryx/build/install" \
-DCMAKE_PREFIX_PATH="${BUILD_SOURCESDIRECTORY}/cyclonedds/build/install;${BUILD_SOURCESDIRECTORY}/iceoryx/build/install;${BUILD_SOURCESDIRECTORY}/googletest/build/install" \
-DANALYZER=${ANALYZER:-off} \
-DSANITIZER=${SANITIZER:-none} \
-DENABLE_SHM=${ICEORYX:-off} \
Expand Down
32 changes: 4 additions & 28 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,37 +10,10 @@
# SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
#
cmake_minimum_required(VERSION 3.16)
project(CycloneDDS-CXX VERSION 0.10.3 LANGUAGES C CXX)
project(CycloneDDS-CXX VERSION 0.10.4 LANGUAGES C CXX)

set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake/Modules")

# Conan
if(EXISTS "${CMAKE_BINARY_DIR}/conanbuildinfo.cmake" AND NOT CONAN_DEPENDENCIES)
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
if(APPLE)
# By default Conan strips all RPATHs (see conanbuildinfo.cmake), which
# causes tests to fail as the executables cannot find the library target.
# By setting KEEP_RPATHS, Conan does not set CMAKE_SKIP_RPATH and the
# resulting binaries still have the RPATH information. This is fine because
# CMake will strip the build RPATH information in the install step.
#
# NOTE:
# Conan's default approach is to use the "imports" feature, which copies
# all the dependencies into the bin directory. Of course, this doesn't work
# quite that well for libraries generated in this Project (see Conan
# documentation).
#
# See the links below for more information.
# https://github.com/conan-io/conan/issues/337
# https://docs.conan.io/en/latest/howtos/manage_shared_libraries/rpaths.html
# https://gitlab.kitware.com/cmake/community/wikis/doc/cmake/RPATH-handling
conan_basic_setup(KEEP_RPATHS)
else()
conan_basic_setup()
endif()
conan_define_targets()
endif()

# By default don't treat warnings as errors, else anyone building it with a
# different compiler that just happens to generate a warning, as well as
# anyone adding or modifying something and making a small mistake would run
Expand Down Expand Up @@ -165,6 +138,9 @@ if(SANITIZER)
add_compile_options("-fno-omit-frame-pointer")
add_link_options("-fno-omit-frame-pointer")
endif()
if(san STREQUAL "undefined")
add_compile_options("-fno-sanitize-recover=all")
endif()
if(san AND NOT san STREQUAL "none")
message(STATUS "Enabling sanitizer: ${san}")
add_compile_options("-fsanitize=${san}")
Expand Down
16 changes: 2 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,22 +126,10 @@ variable `BUILD_TESTING` to on when configuring, e.g.:
$ cmake --build .
$ ctest

Such a build requires the presence of [Google Test][7]. You can install this
yourself, or you can choose to instead rely on the [Conan][8] package manager
that the CI build infrastructure also uses. In that case, install Conan and do:

$ conan install .. --build missing

in the build directory prior to running `cmake`. This will automatically
download and/or build Google Test.

For Windows, depending on the generator, you might also need to add switches
to select the architecture and build type, e.g.,

$ conan install -s arch=x86_64 -s build_type=Debug ..
Such a build requires the presence of [Google Test][7]. You need to install this
yourself.

[7]: https://github.com/google/googletest
[8]: https://conan.io/

## Documentation

Expand Down
43 changes: 33 additions & 10 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,33 @@ strategy:
'Ubuntu 20.04 LTS with Clang 10 (Release, x86_64)':
image: ubuntu-20.04
build_type: Release
cc: clang-10
cxx: clang++-10
'macOS 10.15 with Clang 12 (Debug, x86_64)':
image: macOS-10.15
sanitizer: address,undefined
cc: clang-12
cxx: clang++-12
'Ubuntu 22.04 LTS with CLang 12 (Release, x86_64, Iceoryx)':
image: ubuntu-22.04
build_type: Release
iceoryx: on
sanitizer: address,undefined
cc: clang-12
cxx: clang++-12
# C++11 requires boost, installing boost on Windows takes forever, so use Linux
# Google test requires C++14 at minimum, so we can't build tests ...
'Ubuntu 22.04 LTS with CLang 12 (Debug, x86_64, C++11)':
image: ubuntu-22.04
build_type: Debug
cc: clang-12
cxx: clang++-12
legacy: on
'Ubuntu 22.04 LTS with GCC 12 (Debug, x86_64, no type discovery)':
image: ubuntu-22.04
sanitizer: address
cc: gcc-12
cxx: g++-12
type_discovery: off
topic_discovery: off
'macOS 11 with Clang 12 (Debug, x86_64)':
image: macOS-11
sanitizer: address
cc: clang
cxx: clang++
Expand All @@ -58,7 +81,6 @@ strategy:
#'Windows 2019 with Visual Studio 2019 (Visual Studio 2017, Debug, x86)':
# arch: x86
# image: windows-2019
# conanfile: conanfile102.txt
# generator: 'Visual Studio 16 2019'
# toolkit: v141
'Windows 2019 with Visual Studio 2019 (Debug, x86_64)':
Expand All @@ -69,11 +91,12 @@ strategy:
image: windows-2019
build_type: Release
generator: 'Visual Studio 16 2019'
'Windows 2019 with Visual Studio 2019 (Release, x86_64, c++11)':
image: windows-2019
build_type: Release
generator: 'Visual Studio 16 2019'
legacy: on
#C++11 needs boost, installing boost takes forever on Windows
#'Windows 2019 with Visual Studio 2019 (Release, x86_64, c++11)':
# image: windows-2019
# build_type: Release
# generator: 'Visual Studio 16 2019'
# legacy: on

pool:
vmImage: $(image)
Expand Down
9 changes: 0 additions & 9 deletions conanfile.txt

This file was deleted.

4 changes: 4 additions & 0 deletions src/ddscxx/include/dds/core/policy/CorePolicy.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,9 @@ UserData;
typedef dds::core::policy::detail::WriterDataLifecycle
WriterDataLifecycle;

typedef dds::core::policy::detail::WriterBatching
WriterBatching;

#ifdef OMG_DDS_PERSISTENCE_SUPPORT
typedef ::dds::core::policy::detail::DurabilityService
DurabilityService;
Expand Down Expand Up @@ -192,6 +195,7 @@ OMG_DDS_POLICY_TRAITS(DurabilityService, 22)
OMG_DDS_POLICY_TRAITS(DataRepresentation, 23)
OMG_DDS_POLICY_TRAITS(TypeConsistencyEnforcement, 24)
#endif // OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT
OMG_DDS_POLICY_TRAITS(WriterBatching, 25)

}
}
Expand Down
60 changes: 60 additions & 0 deletions src/ddscxx/include/dds/core/policy/TCorePolicy.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -842,6 +842,66 @@ class TWriterDataLifecycle : public dds::core::Value<D>
*/
static TWriterDataLifecycle ManuallyDisposeUnregisteredInstances();

};
//==============================================================================

template <typename D>
class TWriterBatching : public dds::core::Value<D>
{
public:
/**
* Creates a WriterBatching QoS instance
*
* @param batch_updates a boolean indicating if updates should be batched
* before being explicitly flushed
*/
explicit TWriterBatching(bool batch_updates = false);

/**
* Copies a WriterBatching QoS instance
*
* @param other the WriterBatching QoS instance to copy
*/
TWriterBatching(const TWriterBatching& other);

/**
* Copies a WriterBatching QoS instance
*
* @param other the WriterBatching QoS instance to copy
*
* @return reference to the WriterBatching QoS instance that was copied to
*/
TWriterBatching& operator=(const TWriterBatching& other) = default;

public:
/**
* Gets a boolean indicating if updates should be batched
*
* @return a boolean indicating if updates should be batched
*/
bool batch_updates() const;

/**
* Sets a boolean indicating if updates should be batched
*
* @param batch_updates a boolean indicating if updates should be batched
*/
TWriterBatching& batch_updates(
bool batch_updates);

public:
/**
* @return a WriterBatching QoS instance with batch_updates
* set to true
*/
static TWriterBatching BatchUpdates();

/**
* @return a WriterBatching QoS instance with batch_updates
* set to false
*/
static TWriterBatching DoNotBatchUpdates();

};

//==============================================================================
Expand Down
3 changes: 3 additions & 0 deletions src/ddscxx/include/dds/core/policy/detail/CorePolicy.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@ namespace dds { namespace core { namespace policy { namespace detail {

typedef dds::core::policy::TWriterDataLifecycle<org::eclipse::cyclonedds::core::policy::WriterDataLifecycleDelegate>
WriterDataLifecycle;

typedef dds::core::policy::TWriterBatching<org::eclipse::cyclonedds::core::policy::WriterBatchingDelegate>
WriterBatching;
} } } } // namespace dds::core::policy::detail


Expand Down
39 changes: 39 additions & 0 deletions src/ddscxx/include/dds/core/policy/detail/TCorePolicyImpl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,45 @@ TWriterDataLifecycle<D> TWriterDataLifecycle<D>::ManuallyDisposeUnregisteredInst
return TWriterDataLifecycle(false);
}

//TWriterBatching
template <typename D>
TWriterBatching<D>::TWriterBatching(bool batch_updates): dds::core::Value<D>(batch_updates)
{
}

template <typename D>
TWriterBatching<D>::TWriterBatching(const TWriterBatching& other): dds::core::Value<D>(other.delegate())
{
}

template <typename D>
bool TWriterBatching<D>::batch_updates() const
{
return this->delegate().batch_updates();
}

template <typename D>
TWriterBatching<D>& TWriterBatching<D>::batch_updates(
bool batch_updates)
{
this->delegate().batch_updates(batch_updates);
return *this;
}

template <typename D>
TWriterBatching<D> TWriterBatching<D>::BatchUpdates()
{
return TWriterBatching(true);
}


template <typename D>
TWriterBatching<D> TWriterBatching<D>::DoNotBatchUpdates()
{
return TWriterBatching(false);
}


//TReaderDataLifecycle
template <typename D>
TReaderDataLifecycle<D>::TReaderDataLifecycle(const dds::core::Duration& autopurge_nowriter_samples_delay, const dds::core::Duration& autopurge_disposed_samples_delay)
Expand Down
4 changes: 1 addition & 3 deletions src/ddscxx/include/dds/pub/detail/DataWriter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,7 @@ class dds::pub::detail::DataWriter : public ::org::eclipse::cyclonedds::pub::Any

DataWriter(const dds::pub::Publisher& pub,
const ::dds::topic::Topic<T>& topic,
const dds::pub::qos::DataWriterQos& qos,
dds::pub::DataWriterListener<T>* listener,
const dds::core::status::StatusMask& mask);
const dds::pub::qos::DataWriterQos& qos);

virtual ~DataWriter();

Expand Down
Loading
Loading