Skip to content

Commit 23168a5

Browse files
JonathanHensongraebm
authored andcommitted
Mqtt updates (aws#13)
* updated mqtt client for new mqtt interface. * Updated sample and dependency versions.
1 parent 38abf2e commit 23168a5

File tree

8 files changed

+133
-108
lines changed

8 files changed

+133
-108
lines changed

CMakeLists.txt

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ if (${CMAKE_INSTALL_LIBDIR} STREQUAL "lib64")
1212
set(FIND_LIBRARY_USE_LIB64_PATHS true)
1313
endif()
1414

15+
if (NOT CMAKE_CXX_STANDARD)
16+
set(CMAKE_CXX_STANDARD 11)
17+
endif()
18+
1519
if (BUILD_DEPS)
1620
set(AWS_DEPS_BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR}/deps)
1721
if (DEFINED CMAKE_INSTALL_PREFIX)
@@ -88,9 +92,8 @@ else()
8892
endif()
8993
list(APPEND CMAKE_MODULE_PATH "${CMAKE_PREFIX_PATH}/${CMAKE_INSTALL_LIBDIR}/cmake")
9094

91-
if (NOT CMAKE_CXX_STANDARD)
92-
set(CMAKE_CXX_STANDARD 11)
93-
endif()
95+
include(AwsCFlags)
96+
include(AwsSharedLibSetup)
9497

9598
file(GLOB AWS_CRT_HEADERS
9699
"include/aws/crt/*.h"
@@ -165,14 +168,15 @@ endif()
165168

166169
add_library(${CMAKE_PROJECT_NAME} ${AWS_CRT_CPP_SRC})
167170

168-
if (BUILD_SHARED_LIBS AND WIN32)
169-
target_compile_definitions(${CMAKE_PROJECT_NAME} PUBLIC -DUSE_IMPORT_EXPORT)
171+
if (BUILD_SHARED_LIBS)
172+
target_compile_definitions(${CMAKE_PROJECT_NAME} PUBLIC -DAWS_CRT_CPP_USE_IMPORT_EXPORT)
170173
target_compile_definitions(${CMAKE_PROJECT_NAME} PRIVATE -DAWS_CRT_CPP_EXPORTS)
171174
endif()
172175

173176
set_target_properties(${CMAKE_PROJECT_NAME} PROPERTIES LINKER_LANGUAGE CXX)
177+
set_target_properties(${CMAKE_PROJECT_NAME} PROPERTIES CXX_STANDARD ${CMAKE_CXX_STANDARD})
174178

175-
set(CMAKE_C_FLAGS_DEBUGOPT "")
179+
aws_prepare_symbol_visibility_args(${CMAKE_PROJECT_NAME} "AWS_CRT_CPP")
176180

177181
#set warnings
178182
if (MSVC)

aws-common-runtime/CMakeLists.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ if (UNIX AND NOT APPLE)
2727
endif()
2828

2929
set(AWS_C_IO_URL "https://github.com/awslabs/aws-c-io.git")
30-
set(AWS_C_IO_SHA "v0.2.3")
30+
set(AWS_C_IO_SHA "v0.2.4")
3131
include(BuildAwsCIO)
3232

3333
set(AWS_C_MQTT_URL "https://github.com/awslabs/aws-c-mqtt.git")
34-
set(AWS_C_MQTT_SHA "v0.2.2")
34+
set(AWS_C_MQTT_SHA "v0.3.1")
3535
include(BuildAwsCMqtt)
3636

3737
set(AWS_C_CAL_URL "https://github.com/awslabs/aws-c-cal.git")
@@ -46,3 +46,4 @@ if (UNIX AND NOT APPLE)
4646
else()
4747
add_dependencies(AwsCIO AwsCCommon )
4848
endif()
49+

include/aws/crt/Exports.h

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,21 @@
1616
*/
1717

1818
#if defined(USE_WINDOWS_DLL_SEMANTICS) || defined(WIN32)
19-
# ifdef USE_IMPORT_EXPORT
19+
# ifdef AWS_CRT_CPP_USE_IMPORT_EXPORT
2020
# ifdef AWS_CRT_CPP_EXPORTS
2121
# define AWS_CRT_CPP_API __declspec(dllexport)
2222
# else
2323
# define AWS_CRT_CPP_API __declspec(dllimport)
2424
# endif /* AWS_CRT_CPP_API */
2525
# else
2626
# define AWS_CRT_CPP_API
27-
# endif // USE_IMPORT_EXPORT
27+
# endif // AWS_CRT_CPP_USE_IMPORT_EXPORT
2828

2929
#else // defined (USE_WINDOWS_DLL_SEMANTICS) || defined (WIN32)
30-
# define AWS_CRT_CPP_API
31-
#endif // defined (USE_WINDOWS_DLL_SEMANTICS) || defined (WIN32)
30+
# if ((__GNUC__ >= 4) || defined(__clang__)) && defined(AWS_CRT_CPP_USE_IMPORT_EXPORT) && \
31+
defined(AWS_CRT_CPP_EXPORTS)
32+
# define AWS_CRT_CPP_API __attribute__((visibility("default")))
33+
# else
34+
# define AWS_CRT_CPP_API
35+
# endif // __GNUC__ >= 4 || defined(__clang__)
36+
#endif

include/aws/crt/mqtt/MqttClient.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,11 @@ namespace Aws
129129
* Initiates the connection, OnConnectionCompleted will
130130
* be invoked in an event-loop thread.
131131
*/
132-
bool Connect(const char *clientId, bool cleanSession, uint16_t keepAliveTime) noexcept;
132+
bool Connect(
133+
const char *clientId,
134+
bool cleanSession,
135+
uint16_t keepAliveTimeSecs = 0,
136+
uint32_t pingTimeoutMs = 0) noexcept;
133137

134138
/**
135139
* Initiates disconnect, OnDisconnectHandler will be invoked in an event-loop thread.

samples/mqtt_pub_sub/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ file(GLOB MQTT_PUB_SUB_SRC
99
set(PUB_SUB_PROJECT_NAME aws-crt-cpp-mqtt-pub-sub)
1010
add_executable(${PUB_SUB_PROJECT_NAME} ${MQTT_PUB_SUB_SRC})
1111
set_target_properties(${PUB_SUB_PROJECT_NAME} PROPERTIES LINKER_LANGUAGE CXX)
12+
set_target_properties(${PUB_SUB_PROJECT_NAME} PROPERTIES CXX_STANDARD ${CMAKE_CXX_STANDARD})
1213

1314
set(CMAKE_C_FLAGS_DEBUGOPT "")
1415

0 commit comments

Comments
 (0)