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

Fix Windows DLL build #10

Merged
merged 10 commits into from
Apr 3, 2025
Merged
15 changes: 8 additions & 7 deletions tactical-microgrid-standard/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,24 @@ enable_testing()

find_package(OpenDDS REQUIRED)

add_library(Common
add_library(TMS_Common
common/Handshaking.cpp
common/PowerDevice.cpp
common/DeviceInfoDataReaderListenerImpl.cpp
common/HeartbeatDataReaderListenerImpl.cpp
common/QosHelper.cpp
)
target_include_directories(Common PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
opendds_target_sources(Common
target_include_directories(TMS_Common PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
opendds_export_header(TMS_Common INCLUDE "common/OpenDDS_TMS_export.h" MACRO_PREFIX OpenDDS_TMS)
opendds_target_sources(TMS_Common
PUBLIC
common/mil-std-3071_data_model.idl
INCLUDE_BASE ${CMAKE_CURRENT_SOURCE_DIR}
OPENDDS_IDL_OPTIONS -Lc++11
USE_EXPORT "common/opendds_tms_export.h" OpenDDS_TMS_Export
)
target_link_libraries(Common PUBLIC OpenDDS::Rtps_Udp)
target_compile_features(Common PUBLIC cxx_std_17)
target_link_libraries(TMS_Common PUBLIC OpenDDS::Rtps_Udp)
target_compile_features(TMS_Common PUBLIC cxx_std_17)
opendds_bigobj(TMS_Common)

add_library(Commands_Idl)
opendds_target_sources(Commands_Idl
Expand All @@ -30,7 +31,7 @@ opendds_target_sources(Commands_Idl
OPENDDS_IDL_OPTIONS -Lc++11 -I${CMAKE_CURRENT_SOURCE_DIR}
INCLUDE_BASE ${CMAKE_CURRENT_SOURCE_DIR}
)
target_link_libraries(Commands_Idl PUBLIC Common)
target_link_libraries(Commands_Idl PUBLIC TMS_Common)

add_executable(Controller
controller/main.cpp
Expand Down
3 changes: 2 additions & 1 deletion tactical-microgrid-standard/cli/CLIClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@

#include "common/Handshaking.h"
#include "controller/Common.h"
#include "cli_idl/CLICommandsTypeSupportImpl.h"

#include <cli_idl/CLICommandsTypeSupportImpl.h>

#include <string>
#include <utility>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "common/mil-std-3071_data_modelTypeSupportImpl.h"
#include <common/mil-std-3071_data_modelTypeSupportImpl.h>
#include "DeviceInfoDataReaderListenerImpl.h"

void DeviceInfoDataReaderListenerImpl::on_data_available(DDS::DataReader_ptr reader)
Expand Down
5 changes: 3 additions & 2 deletions tactical-microgrid-standard/common/Handshaking.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
#define HANDSHAKING_H

#include "TimerHandler.h"
#include "common/mil-std-3071_data_modelTypeSupportImpl.h"
#include "opendds_tms_export.h"

#include <common/mil-std-3071_data_modelTypeSupportImpl.h>
#include <common/OpenDDS_TMS_export.h>

#include <dds/DCPS/Service_Participant.h>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "common/mil-std-3071_data_modelTypeSupportImpl.h"
#include <common/mil-std-3071_data_modelTypeSupportImpl.h>
#include "HeartbeatDataReaderListenerImpl.h"

void HeartbeatDataReaderListenerImpl::on_data_available(DDS::DataReader_ptr reader)
Expand Down
2 changes: 1 addition & 1 deletion tactical-microgrid-standard/common/PowerDevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class PowerDevice;
* A: If heartbeat is from selected
* S: If there's a selectable controller with a recent heartbeat
*/
class ControllerSelector :
class OpenDDS_TMS_Export ControllerSelector :
public TimerHandler<NewController, MissedController, LostController, NoControllers> {
public:
explicit ControllerSelector(PowerDevice& pd)
Expand Down
11 changes: 6 additions & 5 deletions tactical-microgrid-standard/common/QosHelper.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#ifndef QOS_HELPER_H
#define QOS_HELPER_H

#include "common/mil-std-3071_data_modelTypeSupportImpl.h"
#include <common/mil-std-3071_data_modelTypeSupportImpl.h>
#include <common/OpenDDS_TMS_export.h>

#include <dds/DdsDcpsCoreC.h>

Expand All @@ -11,7 +12,7 @@

namespace Qos {
namespace Subscriber {
DDS::SubscriberQos get_qos();
OpenDDS_TMS_Export DDS::SubscriberQos get_qos();
}

namespace DataReader {
Expand All @@ -26,11 +27,11 @@ const DDS::DataReaderQos& get_Reply(const tms::Identity& device_id);

using Fn = std::function<DDS::DataReaderQos(const tms::Identity&)>;
using FnMap = std::unordered_map<std::string, Fn>;
extern const FnMap fn_map;
OpenDDS_TMS_Export extern const FnMap fn_map;
}

namespace Publisher {
DDS::PublisherQos get_qos();
OpenDDS_TMS_Export DDS::PublisherQos get_qos();
}

namespace DataWriter {
Expand All @@ -45,7 +46,7 @@ const DDS::DataWriterQos& get_Reply(const tms::Identity& device_id);

using Fn = std::function<DDS::DataWriterQos(const tms::Identity&)>;
using FnMap = std::unordered_map<std::string, Fn>;
extern const FnMap fn_map;
OpenDDS_TMS_Export extern const FnMap fn_map;
}
}

Expand Down
57 changes: 0 additions & 57 deletions tactical-microgrid-standard/common/opendds_tms_export.h

This file was deleted.

3 changes: 2 additions & 1 deletion tactical-microgrid-standard/controller/CLIServer.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
#define CONTROLLER_CLI_SERVER_H

#include "Controller.h"
#include "cli_idl/CLICommandsTypeSupportImpl.h"

#include <cli_idl/CLICommandsTypeSupportImpl.h>

class CLIServer {
public:
Expand Down
2 changes: 1 addition & 1 deletion tactical-microgrid-standard/controller/Common.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef CONTROLLER_COMMON_H
#define CONTROLLER_COMMON_H

#include "common/mil-std-3071_data_modelTypeSupportImpl.h"
#include <common/mil-std-3071_data_modelTypeSupportImpl.h>

#include <dds/DCPS/optional.h>

Expand Down
6 changes: 2 additions & 4 deletions tactical-microgrid-standard/tests/mc-sel/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,9 @@ find_package(OpenDDS REQUIRED)
include(opendds_testing)

add_executable(mc-sel-test mc-sel-test.cpp)
target_link_libraries(mc-sel-test PRIVATE Common)
target_link_libraries(mc-sel-test PRIVATE TMS_Common)

add_executable(basic-mc ${CMAKE_SOURCE_DIR}/controller/Controller.cpp basic-mc.cpp)
opendds_target_sources(basic-mc
INCLUDE_BASE ${CMAKE_SOURCE_DIR})
target_link_libraries(basic-mc PRIVATE Common)
target_link_libraries(basic-mc PRIVATE TMS_Common)

opendds_add_test(COMMAND ./mc-sel-test)
2 changes: 1 addition & 1 deletion tactical-microgrid-standard/tests/mc-sel/basic-mc.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <controller/Controller.h>
#include "controller/Controller.h"

struct Timeout {};
class Test : public TimerHandler<Timeout> {
Expand Down
2 changes: 1 addition & 1 deletion tactical-microgrid-standard/tests/mc-sel/mc-sel-test.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <common/PowerDevice.h>
#include "common/PowerDevice.h"

#include <ace/Process_Manager.h>

Expand Down
Loading