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

Added a option for using statically built opendds. #14

Merged
merged 3 commits into from
Oct 9, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
cmake_minimum_required(VERSION 3.20)

option(OpenDDWStatic "OpenDDWStatic" OFF) #Build openddw to be compatible with a static build of opendds
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of setting this, you could use OPENDDS_STATIC.

Copy link
Contributor Author

@doug1234 doug1234 Oct 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way to get this define from a complied opendds library or are you suggesting I just name the option consistently?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The former, I think. OPENDDS_STATIC is a CMake variable, but if by define you mean a C predecessor macro, then you could use ACE_AS_STATIC_LIBS.

project(OpenDDW VERSION 0.0.1 LANGUAGES CXX)

find_package(OpenDDS REQUIRED)
Expand Down Expand Up @@ -66,6 +67,10 @@ elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
)
endif()

if(OpenDDWStatic)
add_compile_definitions(OPENDDW_STATIC)
endif(OpenDDWStatic)

target_compile_options(OpenDDW PRIVATE $<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>,$<CXX_COMPILER_ID:GNU>>: -Wall -Wextra -Wpedantic -Wno-unused> $<$<CXX_COMPILER_ID:MSVC>: /W4>)

set(OPENDDS_TARGETS
Expand Down
6 changes: 6 additions & 0 deletions src/dds_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@
#include "platformIndependent.h"
#include "std_qosC.h"

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

std::map<int, int> g_transportInstances;

//------------------------------------------------------------------------------
Expand Down