Skip to content

Commit

Permalink
Merge pull request #27 from iguessthislldo/igtd/xtypes-complete
Browse files Browse the repository at this point in the history
Pass `-Gxtypes-complete` to `opendds_target_sources`
  • Loading branch information
iguessthislldo authored Mar 28, 2024
2 parents 69b7a53 + c03c3c0 commit b72f70a
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 32 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ target_link_libraries(OpenDDW
Threads::Threads
)

OPENDDS_TARGET_SOURCES(OpenDDW idl/std_qos.idl)
opendds_target_sources(OpenDDW idl/std_qos.idl OPENDDS_IDL_OPTIONS -Gxtypes-complete)

INCLUDE(CMakePackageConfigHelpers)

Expand Down
36 changes: 18 additions & 18 deletions idl2library.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# idl2library(IDLS <files> [BUILD_STATIC])
# Generate a shared or static library for each IDL in a list.
# Generate a shared or static library for each IDL in a list.
#
# Example:
# idl2library(IDLS idl/example.idl idl/std_doc.idl)
Expand All @@ -20,12 +20,12 @@ macro(get_idl_target_name idlfile output)
endmacro()

#Finds all of the input file's (absolute path) dependencies and returns them in IDL_TARGET_DEPENDENCIES
function(find_idl_dependencies input_file)
function(find_idl_dependencies input_file)
unset(search_list)
unset(return_list)
LIST(APPEND current_list ${input_file}) #Files that need to be searched (full path)
LIST(APPEND search_list ${input_file}) #Don't search more than once (full path)

while(current_list)
SET(file_list ${current_list})
unset(current_list)
Expand All @@ -50,7 +50,7 @@ endfunction()
function(idl2library)
set(options BUILD_STATIC)
set(multiValueArgs IDLS)

cmake_parse_arguments(idl2library "BUILD_STATIC" "" "IDLS" ${ARGN})

if (${idl2library_BUILD_STATIC})
Expand All @@ -69,20 +69,20 @@ function(idl2library)
endif()
list(APPEND IDL_WISHLIST ${IDL_ARG})
endforeach()
option(OPENDDS_CPP11_IDL_MAPPING "Use C++11 IDL mapping" OFF)

option(OPENDDS_CPP11_IDL_MAPPING "Use C++11 IDL mapping" OFF)
option(OPENDDS_CMAKE_VERBOSE "Print verbose output when loading the OpenDDS Config Package" ON)

find_package(OpenDDS REQUIRED)

if(NOT IDL_WISHLIST)
message("No IDLs specified. Update your CMakeLists.txt to include a list of the required IDLs, and pass that list to idl2library()")
endif()

list(REMOVE_DUPLICATES IDL_WISHLIST)
message("The following idls are being used: ${IDL_WISHLIST}")
# For each input idl create the following variables:

# For each input idl create the following variables:
# ${current_idl_target}_ABSPATH, ${current_idl_target}_ABSDIR, ${current_idl_target}_RELPATH, ${current_idl_target}_RELDIR
foreach(SINGLE_IDL ${IDL_WISHLIST})
get_idl_target_name(${SINGLE_IDL} current_idl_target)
Expand All @@ -92,11 +92,11 @@ function(idl2library)
unset(${current_idl_target}_RELDIR)

cmake_path(IS_ABSOLUTE SINGLE_IDL SINGLE_IDL_IS_ABS)
if(SINGLE_IDL_IS_ABS)
if(SINGLE_IDL_IS_ABS)
set(${current_idl_target}_ABSPATH ${SINGLE_IDL})
else()
find_file(${current_idl_target}_ABSPATH
${SINGLE_IDL}
find_file(${current_idl_target}_ABSPATH
${SINGLE_IDL}
PATHS ${CMAKE_CURRENT_SOURCE_DIR}
NO_CACHE
REQUIRED
Expand Down Expand Up @@ -154,19 +154,19 @@ function(idl2library)
unset(current_idl_include_opts)

find_idl_dependencies("${${current_idl_target}_ABSPATH}") #Dependencies are returned in IDL_TARGET_DEPENDENCIES

#Note: current_idl_include_opts needs to be a list. Previously it was a string and that will no longer work correctly.
foreach(target_dependency ${IDL_TARGET_DEPENDENCIES})
if(NOT "${${target_dependency}_ABSDIR}" STREQUAL "${${current_idl_target}_ABSDIR}")
list(APPEND current_idl_include_opts "-I${${target_dependency}_ABSDIR}")
endif()
endforeach()
list(REMOVE_DUPLICATES current_idl_include_opts)

if(OPENDDS_CPP11_IDL_MAPPING)
list(APPEND current_idl_include_opts "-Lc++11 ")
endif()

message("Adding library: ${current_idl_target}")
message("current_idl_include_opts: ${current_idl_include_opts}")
message("Dependencies: ${IDL_TARGET_DEPENDENCIES}\n")
Expand All @@ -178,9 +178,9 @@ function(idl2library)
add_library(${current_idl_target} SHARED)
endif()

OPENDDS_TARGET_SOURCES(${current_idl_target}
opendds_target_sources(${current_idl_target}
${${current_idl_target}_RELPATH}
OPENDDS_IDL_OPTIONS ${current_idl_include_opts}
OPENDDS_IDL_OPTIONS ${current_idl_include_opts} -Gxtypes-complete
TAO_IDL_OPTIONS ${current_idl_include_opts}
INCLUDE_BASE ${${current_idl_target}_ABSDIR}
)
Expand Down
22 changes: 9 additions & 13 deletions src/dds_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
#include <dds/DCPS/transport/framework/TransportRegistry.h>
#include <dds/DCPS/transport/rtps_udp/RtpsUdpInst.h>
#include <dds/DCPS/transport/rtps_udp/RtpsUdpInst_rch.h>
#ifdef ACE_AS_STATIC_LIBS
# include <dds/DCPS/transport/rtps_udp/RtpsUdp.h>
#endif
#include <dds/DCPS/Service_Participant.h>
#include <dds/DCPS/RTPS/RtpsDiscovery.h>
#include <dds/DCPS/ServiceEventDispatcher.h>
Expand All @@ -32,12 +35,6 @@
#include "platformIndependent.h"
#include "std_qosC.h"

//For using static open dds these files need to be in some cpp file
#if defined (ACE_AS_STATIC_LIBS)
#include <dds/DCPS/RTPS/RtpsDiscovery.h>
#include <dds/DCPS/transport/rtps_udp/RtpsUdp.h>
#endif

//Helper function to get the address list for a sequence
std::string GetAddressInfo(const OpenDDS::DCPS::TransportLocatorSeq& info)
{
Expand Down Expand Up @@ -149,14 +146,14 @@ DDSManager::~DDSManager()

m_messageHandler(LogMessageType::DDS_INFO, "Deleting DDSManagerImpl");

if (!CORBA::is_nil(m_domainParticipant.in()))
if (m_domainParticipant)
{
status = m_domainParticipant->delete_contained_entities();
checkStatus(status, "DDS::DomainParticipant::delete_contained_entities");
}

DDS::DomainParticipantFactory_var dpf = TheParticipantFactory;
if (!CORBA::is_nil(dpf.in()))
if (dpf)
{
status = dpf->delete_participant(m_domainParticipant);
checkStatus(status, "DDS::DomainParticipant::delete_participant");
Expand All @@ -175,14 +172,13 @@ bool DDSManager::joinDomain(const int& domainID, const std::string& config, std:
{
// If the domain participant has already been instantiated and it's
// connected to a different domain than the request, report an error
if (!CORBA::is_nil(m_domainParticipant.in()) &&
domainID != m_domainParticipant->get_domain_id())
if (m_domainParticipant && domainID != m_domainParticipant->get_domain_id())
{
return false;
}

// If the domain participant has already been instantiated, we're done
if (!CORBA::is_nil(m_domainParticipant.in()))
if (m_domainParticipant)
{
return true;
}
Expand Down Expand Up @@ -283,7 +279,7 @@ bool DDSManager::joinDomain(const int& domainID, const std::string& config, std:
nullptr,
OpenDDS::DCPS::DEFAULT_STATUS_MASK);

if (CORBA::is_nil(m_domainParticipant.in()))
if (!m_domainParticipant)
{
std::cerr << "Error creating participant for domain '"
<< domainID
Expand Down Expand Up @@ -439,7 +435,7 @@ bool DDSManager::joinDomain(const int& domainID, const std::string& config, std:
//------------------------------------------------------------------------------
bool DDSManager::enableDomain()
{
if (CORBA::is_nil(m_domainParticipant.in()))
if (!m_domainParticipant)
{
return false;
}
Expand Down

0 comments on commit b72f70a

Please sign in to comment.