Skip to content

Commit

Permalink
Windows fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Juan Lopez Fernandez <juanlopez@eprosima.com>
  • Loading branch information
juanlofer-eprosima committed Mar 12, 2024
1 parent e325698 commit 76d7338
Show file tree
Hide file tree
Showing 23 changed files with 152 additions and 34 deletions.
2 changes: 1 addition & 1 deletion include/fastdds/rtps/common/LocatorWithMask.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class RTPS_DllAPI LocatorWithMask : public Locator
uint8_t mask_ = 24;
};

std::ostream& operator <<(
RTPS_DllAPI std::ostream& operator <<(
std::ostream& output,
const LocatorWithMask& loc);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,27 +32,27 @@ namespace rtps {
* @note When using this structure to interact with Fast-DDS, \c name is the only attribute the user needs to provide.
* The rest of the attributes are internally filled, and are in fact ignored even if already provided by the user.
*/
struct RTPS_DllAPI AllowedNetworkInterface : public NetworkInterfaceWithFilter
struct AllowedNetworkInterface : public NetworkInterfaceWithFilter
{
using NetworkInterfaceWithFilter::NetworkInterfaceWithFilter;

//! Destructor
virtual ~AllowedNetworkInterface() = default;
virtual RTPS_DllAPI ~AllowedNetworkInterface() = default;

//! Copy constructor
AllowedNetworkInterface(
RTPS_DllAPI AllowedNetworkInterface(
const AllowedNetworkInterface& iface) = default;

//! Copy assignment
AllowedNetworkInterface& operator =(
RTPS_DllAPI AllowedNetworkInterface& operator =(
const AllowedNetworkInterface& iface) = default;

//! Move constructor
AllowedNetworkInterface(
RTPS_DllAPI AllowedNetworkInterface(
AllowedNetworkInterface&& iface) = default;

//! Move assignment
AllowedNetworkInterface& operator =(
RTPS_DllAPI AllowedNetworkInterface& operator =(
AllowedNetworkInterface&& iface) = default;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,27 +32,27 @@ namespace rtps {
* @note When using this structure to interact with Fast-DDS, \c name is the only attribute the user needs to provide.
* The rest of the attributes are internally filled, and are in fact ignored even if already provided by the user.
*/
struct RTPS_DllAPI BlockedNetworkInterface : public NetworkInterface
struct BlockedNetworkInterface : public NetworkInterface
{
using NetworkInterface::NetworkInterface;

//! Destructor
virtual ~BlockedNetworkInterface() = default;
virtual RTPS_DllAPI ~BlockedNetworkInterface() = default;

//! Copy constructor
BlockedNetworkInterface(
RTPS_DllAPI BlockedNetworkInterface(
const BlockedNetworkInterface& iface) = default;

//! Copy assignment
BlockedNetworkInterface& operator =(
RTPS_DllAPI BlockedNetworkInterface& operator =(
const BlockedNetworkInterface& iface) = default;

//! Move constructor
BlockedNetworkInterface(
RTPS_DllAPI BlockedNetworkInterface(
BlockedNetworkInterface&& iface) = default;

//! Move assignment
BlockedNetworkInterface& operator =(
RTPS_DllAPI BlockedNetworkInterface& operator =(
BlockedNetworkInterface&& iface) = default;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ enum class NetmaskFilterKind
ON
};

std::ostream& operator <<(
RTPS_DllAPI std::ostream& operator <<(
std::ostream& output,
const NetmaskFilterKind& netmask_filter_kind);

Expand Down
18 changes: 9 additions & 9 deletions include/fastdds/rtps/transport/network/NetworkInterface.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,39 +34,39 @@ namespace rtps {
* @note When using this structure to interact with Fast-DDS, \c name is the only attribute the user needs to provide.
* The rest of the attributes are internally filled, and are in fact ignored even if already provided by the user.
*/
struct RTPS_DllAPI NetworkInterface
struct NetworkInterface
{
//! Constructor by name
NetworkInterface(
RTPS_DllAPI NetworkInterface(
const std::string& name);

//! Constructor by device name, IP address string and locator with mask
NetworkInterface(
RTPS_DllAPI NetworkInterface(
const std::string& device,
const std::string& ip,
const LocatorWithMask& locator);

//! Destructor
virtual ~NetworkInterface() = default;
virtual RTPS_DllAPI ~NetworkInterface() = default;

//! Copy constructor
NetworkInterface(
RTPS_DllAPI NetworkInterface(
const NetworkInterface& iface) = default;

//! Copy assignment
NetworkInterface& operator =(
RTPS_DllAPI NetworkInterface& operator =(
const NetworkInterface& iface) = default;

//! Move constructor
NetworkInterface(
RTPS_DllAPI NetworkInterface(
NetworkInterface&& iface) = default;

//! Move assignment
NetworkInterface& operator =(
RTPS_DllAPI NetworkInterface& operator =(
NetworkInterface&& iface) = default;

//! Comparison operator
bool operator ==(
RTPS_DllAPI bool operator ==(
const NetworkInterface& iface) const;

//! Interface device name or IP address in string format (to be filled by the user)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ namespace rtps {
* @note When using this structure to interact with Fast-DDS, \c name is the only attribute the user needs to provide.
* The rest of the attributes are internally filled, and are in fact ignored even if already provided by the user.
*/
struct RTPS_DllAPI NetworkInterfaceWithFilter : public NetworkInterface
struct NetworkInterfaceWithFilter : public NetworkInterface
{
//! Constructor by name and netmask filter
NetworkInterfaceWithFilter(
RTPS_DllAPI NetworkInterfaceWithFilter(
const std::string& name,
NetmaskFilterKind netmask_filter);

//! Constructor by name
NetworkInterfaceWithFilter(
RTPS_DllAPI NetworkInterfaceWithFilter(
const std::string& name);

//! Constructor by device name, IP address string, locator with mask and netmask filter
Expand All @@ -54,32 +54,32 @@ struct RTPS_DllAPI NetworkInterfaceWithFilter : public NetworkInterface
NetmaskFilterKind netmask_filter);

//! Constructor by device name, IP address string and locator with mask
NetworkInterfaceWithFilter(
RTPS_DllAPI NetworkInterfaceWithFilter(
const std::string& device,
const std::string& ip,
const LocatorWithMask& locator);

//! Destructor
virtual ~NetworkInterfaceWithFilter() = default;
virtual RTPS_DllAPI ~NetworkInterfaceWithFilter() = default;

//! Copy constructor
NetworkInterfaceWithFilter(
RTPS_DllAPI NetworkInterfaceWithFilter(
const NetworkInterfaceWithFilter& iface) = default;

//! Copy assignment
NetworkInterfaceWithFilter& operator =(
RTPS_DllAPI NetworkInterfaceWithFilter& operator =(
const NetworkInterfaceWithFilter& iface) = default;

//! Move constructor
NetworkInterfaceWithFilter(
RTPS_DllAPI NetworkInterfaceWithFilter(
NetworkInterfaceWithFilter&& iface) = default;

//! Move assignment
NetworkInterfaceWithFilter& operator =(
RTPS_DllAPI NetworkInterfaceWithFilter& operator =(
NetworkInterfaceWithFilter&& iface) = default;

//! Comparison operator
bool operator ==(
RTPS_DllAPI bool operator ==(
const NetworkInterfaceWithFilter& iface) const;

//! Netmask filter configuration
Expand Down
3 changes: 3 additions & 0 deletions test/unittest/dds/collections/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,13 @@ set(LOANABLE_SEQUENCE_TESTS_SOURCE

add_executable(LoanableSequenceTests ${LOANABLE_SEQUENCE_TESTS_SOURCE})
target_compile_definitions(LoanableSequenceTests PRIVATE
BOOST_ASIO_STANDALONE
ASIO_STANDALONE
$<$<AND:$<NOT:$<BOOL:${WIN32}>>,$<STREQUAL:"${CMAKE_BUILD_TYPE}","Debug">>:__DEBUG>
$<$<BOOL:${INTERNAL_DEBUG}>:__INTERNALDEBUG> # Internal debug activated.
)
target_include_directories(LoanableSequenceTests PRIVATE
${Asio_INCLUDE_DIR}
${PROJECT_SOURCE_DIR}/include ${PROJECT_BINARY_DIR}/include
${PROJECT_SOURCE_DIR}/src/cpp)
target_link_libraries(LoanableSequenceTests GTest::gtest)
Expand Down
12 changes: 12 additions & 0 deletions test/unittest/dds/core/condition/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,13 @@ set(CONDITION_TESTS_SOURCE

add_executable(ConditionTests ${CONDITION_TESTS_SOURCE})
target_compile_definitions(ConditionTests PRIVATE
BOOST_ASIO_STANDALONE
ASIO_STANDALONE
$<$<AND:$<NOT:$<BOOL:${WIN32}>>,$<STREQUAL:"${CMAKE_BUILD_TYPE}","Debug">>:__DEBUG>
$<$<BOOL:${INTERNAL_DEBUG}>:__INTERNALDEBUG> # Internal debug activated.
)
target_include_directories(ConditionTests PRIVATE
${Asio_INCLUDE_DIR}
${PROJECT_SOURCE_DIR}/include
${PROJECT_BINARY_DIR}/include
${PROJECT_SOURCE_DIR}/src/cpp
Expand All @@ -75,10 +78,13 @@ set(CONDITION_NOTIFIER_TESTS_SOURCE

add_executable(ConditionNotifierTests ${CONDITION_NOTIFIER_TESTS_SOURCE})
target_compile_definitions(ConditionNotifierTests PRIVATE
BOOST_ASIO_STANDALONE
ASIO_STANDALONE
$<$<AND:$<NOT:$<BOOL:${WIN32}>>,$<STREQUAL:"${CMAKE_BUILD_TYPE}","Debug">>:__DEBUG>
$<$<BOOL:${INTERNAL_DEBUG}>:__INTERNALDEBUG> # Internal debug activated.
)
target_include_directories(ConditionNotifierTests PRIVATE
${Asio_INCLUDE_DIR}
mock/WaitSetImpl
${GTEST_INCLUDE_DIRS}
${PROJECT_SOURCE_DIR}/include
Expand Down Expand Up @@ -107,10 +113,13 @@ set(STATUS_CONDITION_IMPL_TESTS_SOURCE

add_executable(StatusConditionImplTests ${STATUS_CONDITION_IMPL_TESTS_SOURCE})
target_compile_definitions(StatusConditionImplTests PRIVATE
BOOST_ASIO_STANDALONE
ASIO_STANDALONE
$<$<AND:$<NOT:$<BOOL:${WIN32}>>,$<STREQUAL:"${CMAKE_BUILD_TYPE}","Debug">>:__DEBUG>
$<$<BOOL:${INTERNAL_DEBUG}>:__INTERNALDEBUG> # Internal debug activated.
)
target_include_directories(StatusConditionImplTests PRIVATE
${Asio_INCLUDE_DIR}
mock/ConditionNotifier
${GTEST_INCLUDE_DIRS}
${PROJECT_SOURCE_DIR}/include
Expand Down Expand Up @@ -138,10 +147,13 @@ set(WAITSET_IMPL_TESTS_SOURCE

add_executable(WaitSetImplTests ${WAITSET_IMPL_TESTS_SOURCE})
target_compile_definitions(WaitSetImplTests PRIVATE
BOOST_ASIO_STANDALONE
ASIO_STANDALONE
$<$<AND:$<NOT:$<BOOL:${WIN32}>>,$<STREQUAL:"${CMAKE_BUILD_TYPE}","Debug">>:__DEBUG>
$<$<BOOL:${INTERNAL_DEBUG}>:__INTERNALDEBUG> # Internal debug activated.
)
target_include_directories(WaitSetImplTests PRIVATE
${Asio_INCLUDE_DIR}
mock/ConditionNotifier
${GTEST_INCLUDE_DIRS}
${PROJECT_SOURCE_DIR}/include
Expand Down
3 changes: 3 additions & 0 deletions test/unittest/dds/core/entity/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,13 @@ endif()

add_executable(EntityTests ${ENTITY_TESTS_SOURCE})
target_compile_definitions(EntityTests PRIVATE
BOOST_ASIO_STANDALONE
ASIO_STANDALONE
$<$<AND:$<NOT:$<BOOL:${WIN32}>>,$<STREQUAL:"${CMAKE_BUILD_TYPE}","Debug">>:__DEBUG>
$<$<BOOL:${INTERNAL_DEBUG}>:__INTERNALDEBUG> # Internal debug activated.
)
target_include_directories(EntityTests PRIVATE
${Asio_INCLUDE_DIR}
${PROJECT_SOURCE_DIR}/include
${PROJECT_BINARY_DIR}/include
${PROJECT_SOURCE_DIR}/src/cpp
Expand Down
3 changes: 3 additions & 0 deletions test/unittest/dds/publisher/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -331,10 +331,13 @@ endif()

add_executable(PublisherTests ${PUBLISHERTESTS_SOURCE})
target_compile_definitions(PublisherTests PRIVATE
BOOST_ASIO_STANDALONE
ASIO_STANDALONE
$<$<AND:$<NOT:$<BOOL:${WIN32}>>,$<STREQUAL:"${CMAKE_BUILD_TYPE}","Debug">>:__DEBUG>
$<$<BOOL:${INTERNAL_DEBUG}>:__INTERNALDEBUG> # Internal debug activated.
)
target_include_directories(PublisherTests PRIVATE
${Asio_INCLUDE_DIR}
${PROJECT_SOURCE_DIR}/include ${PROJECT_BINARY_DIR}/include
${PROJECT_SOURCE_DIR}/src/cpp
${PROJECT_SOURCE_DIR}/thirdparty/taocpp-pegtl
Expand Down
9 changes: 9 additions & 0 deletions test/unittest/dds/subscriber/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ endif()

add_executable(SubscriberTests ${SUBSCRIBERTESTS_SOURCE})
target_compile_definitions(SubscriberTests PRIVATE
BOOST_ASIO_STANDALONE
ASIO_STANDALONE
$<$<AND:$<NOT:$<BOOL:${WIN32}>>,$<STREQUAL:"${CMAKE_BUILD_TYPE}","Debug">>:__DEBUG>
$<$<BOOL:${INTERNAL_DEBUG}>:__INTERNALDEBUG> # Internal debug activated.
)
Expand All @@ -87,6 +89,7 @@ target_compile_definitions(DataReaderTests PRIVATE
$<$<BOOL:${INTERNAL_DEBUG}>:__INTERNALDEBUG> # Internal debug activated.
)
target_include_directories(DataReaderTests PRIVATE
${Asio_INCLUDE_DIR}
${PROJECT_SOURCE_DIR}/include ${PROJECT_BINARY_DIR}/include
${PROJECT_SOURCE_DIR}/src/cpp
${Asio_INCLUDE_DIR}
Expand All @@ -98,10 +101,13 @@ gtest_discover_tests(DataReaderTests)

add_executable(DataReaderInstanceTests ${DATAREADERINSTANCETESTS_SOURCE})
target_compile_definitions(DataReaderInstanceTests PRIVATE
BOOST_ASIO_STANDALONE
ASIO_STANDALONE
$<$<AND:$<NOT:$<BOOL:${WIN32}>>,$<STREQUAL:"${CMAKE_BUILD_TYPE}","Debug">>:__DEBUG>
$<$<BOOL:${INTERNAL_DEBUG}>:__INTERNALDEBUG> # Internal debug activated.
)
target_include_directories(DataReaderInstanceTests PRIVATE
${Asio_INCLUDE_DIR}
${PROJECT_SOURCE_DIR}/include ${PROJECT_BINARY_DIR}/include
${PROJECT_SOURCE_DIR}/src/cpp
)
Expand All @@ -112,13 +118,16 @@ gtest_discover_tests(DataReaderInstanceTests)

add_executable(DataReaderHistoryTests ${DATAREADERHISTORYTESTS_SOURCE})
target_compile_definitions(DataReaderHistoryTests PRIVATE
BOOST_ASIO_STANDALONE
ASIO_STANDALONE
$<$<AND:$<NOT:$<BOOL:${WIN32}>>,$<STREQUAL:"${CMAKE_BUILD_TYPE}","Debug">>:__DEBUG>
$<$<BOOL:${INTERNAL_DEBUG}>:__INTERNALDEBUG> # Internal debug activated.
$<$<BOOL:${MSVC}>:NOMINMAX> # avoid conflic with std::min & std::max in visual studio
# acknowledge atomic layout issue on old versions of visual studio STL
$<$<AND:$<BOOL:${MSVC}>,$<VERSION_LESS:${CMAKE_CXX_COMPILER_VERSION},19.29.30140.0>>:_ENABLE_ATOMIC_ALIGNMENT_FIX>
)
target_include_directories(DataReaderHistoryTests PRIVATE
${Asio_INCLUDE_DIR}
${PROJECT_SOURCE_DIR}/test/mock/rtps/RTPSReader
${PROJECT_SOURCE_DIR}/test/mock/rtps/StatelessReader
${PROJECT_SOURCE_DIR}/test/mock/dds/Topic
Expand Down
3 changes: 3 additions & 0 deletions test/unittest/dds/topic/DDSSQLFilter/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,13 @@ add_executable(DDSSQLFilterTests
${DDSSQLFILTER_LIB_SOURCES}
)
target_compile_definitions(DDSSQLFilterTests PRIVATE
BOOST_ASIO_STANDALONE
ASIO_STANDALONE
$<$<AND:$<NOT:$<BOOL:${WIN32}>>,$<STREQUAL:"${CMAKE_BUILD_TYPE}","Debug">>:__DEBUG>
$<$<BOOL:${INTERNAL_DEBUG}>:__INTERNALDEBUG> # Internal debug activated.
)
target_include_directories(DDSSQLFilterTests PRIVATE
${Asio_INCLUDE_DIR}
${PROJECT_SOURCE_DIR}/include ${PROJECT_BINARY_DIR}/include
${PROJECT_SOURCE_DIR}/src/cpp
${PROJECT_SOURCE_DIR}/thirdparty/taocpp-pegtl
Expand Down
6 changes: 6 additions & 0 deletions test/unittest/logging/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,15 @@ include_directories(mock/)

add_executable(LogTests ${LOGTESTS_SOURCE})
target_compile_definitions(LogTests PRIVATE
BOOST_ASIO_STANDALONE
ASIO_STANDALONE
$<$<AND:$<NOT:$<BOOL:${WIN32}>>,$<STREQUAL:"${CMAKE_BUILD_TYPE}","Debug">>:__DEBUG>
$<$<BOOL:${INTERNAL_DEBUG}>:__INTERNALDEBUG> # Internal debug activated.
HAVE_LOG_NO_INFO=0 FASTDDS_ENFORCE_LOG_INFO # logInfo is used in some tests
)

target_include_directories(LogTests PRIVATE
${Asio_INCLUDE_DIR}
${PROJECT_SOURCE_DIR}/include ${PROJECT_BINARY_DIR}/include
${PROJECT_SOURCE_DIR}/src/cpp)
target_link_libraries(LogTests GTest::gtest ${MOCKS}
Expand Down Expand Up @@ -81,10 +84,13 @@ endif(TINYXML2_INCLUDE_DIR)

add_executable(LogFileTests ${LOGFILETESTS_SOURCE})
target_compile_definitions(LogFileTests PRIVATE
BOOST_ASIO_STANDALONE
ASIO_STANDALONE
$<$<AND:$<NOT:$<BOOL:${WIN32}>>,$<STREQUAL:"${CMAKE_BUILD_TYPE}","Debug">>:__DEBUG>
$<$<BOOL:${INTERNAL_DEBUG}>:__INTERNALDEBUG> # Internal debug activated.
)
target_include_directories(LogFileTests PRIVATE
${Asio_INCLUDE_DIR}
${PROJECT_SOURCE_DIR}/include ${PROJECT_BINARY_DIR}/include
${PROJECT_SOURCE_DIR}/src/cpp)
target_link_libraries(LogFileTests GTest::gtest ${MOCKS}
Expand Down
Loading

0 comments on commit 76d7338

Please sign in to comment.