Skip to content

Commit 4330fae

Browse files
committed
mqtt: export only if tests are enabled
1 parent dff2d5b commit 4330fae

2 files changed

Lines changed: 16 additions & 6 deletions

File tree

modules/mqtt_streaming_module/include/mqtt_streaming_module/common.h

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,16 @@
2020
#define BEGIN_NAMESPACE_OPENDAQ_MQTT_STREAMING_MODULE BEGIN_NAMESPACE_OPENDAQ_MODULE(mqtt_streaming_module)
2121
#define END_NAMESPACE_OPENDAQ_MQTT_STREAMING_MODULE END_NAMESPACE_OPENDAQ_MODULE
2222

23-
#if defined(_WIN32)
24-
#ifdef OPENDAQ_MODULE_DLL_IMPORT
25-
#define DAQ_MQTT_STREAM_MODULE_API __declspec(dllexport)
23+
#if !defined(OPENDAQ_MQTT_ENABLE_TESTS)
24+
#define DAQ_MQTT_STREAM_MODULE_API
25+
#else
26+
#if defined(_WIN32)
27+
#if defined(OPENDAQ_MODULE_DLL_IMPORT)
28+
#define DAQ_MQTT_STREAM_MODULE_API __declspec(dllimport)
29+
#else
30+
#define DAQ_MQTT_STREAM_MODULE_API __declspec(dllexport)
31+
#endif
2632
#else
27-
#define DAQ_MQTT_STREAM_MODULE_API __declspec(dllimport)
33+
#define DAQ_MQTT_STREAM_MODULE_API __attribute__((visibility("default")))
2834
#endif
29-
#else
30-
#define DAQ_MQTT_STREAM_MODULE_API
3135
#endif

modules/mqtt_streaming_module/src/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,12 @@ add_library(${LIB_NAME} SHARED ${SRC_Include}
8484
)
8585
add_library(${SDK_TARGET_NAMESPACE}::${LIB_NAME} ALIAS ${LIB_NAME})
8686

87+
if(OPENDAQ_MQTT_ENABLE_TESTS)
88+
target_compile_definitions(${LIB_NAME}
89+
PRIVATE OPENDAQ_MQTT_ENABLE_TESTS
90+
)
91+
endif()
92+
8793
if (MSVC)
8894
target_compile_options(${LIB_NAME} PRIVATE /bigobj)
8995
endif()

0 commit comments

Comments
 (0)