Skip to content

Commit

Permalink
identity codegen
Browse files Browse the repository at this point in the history
  • Loading branch information
xiazhvera committed Oct 2, 2023
1 parent 9e2948d commit b4be2cd
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
21 changes: 6 additions & 15 deletions identity/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
cmake_minimum_required(VERSION 3.1)
# This file is generated

project(IotIdentity-cpp LANGUAGES CXX)
if (DEFINED SIMPLE_VERSION)
message("Identity version is ${SIMPLE_VERSION}")
set(PROJECT_VERSION ${SIMPLE_VERSION})
endif()
cmake_minimum_required(VERSION 3.1)
project(IotIdentity-cpp CXX)

set(RUNTIME_DIRECTORY bin)

Expand Down Expand Up @@ -57,7 +54,9 @@ else ()
target_compile_options(IotIdentity-cpp PRIVATE -Wall -Wno-long-long -pedantic -Werror)
endif ()

target_compile_definitions(IotIdentity-cpp PRIVATE $<$<CONFIG:Debug>:DEBUG_BUILD>)
if (CMAKE_BUILD_TYPE STREQUAL "" OR CMAKE_BUILD_TYPE MATCHES Debug)
target_compile_definitions(IotIdentity-cpp PRIVATE "-DDEBUG_BUILD")
endif ()

if (BUILD_SHARED_LIBS)
target_compile_definitions(IotIdentity-cpp PUBLIC "-DAWS_IOTIDENTITY_USE_IMPORT_EXPORT")
Expand Down Expand Up @@ -109,14 +108,6 @@ else()
set(TARGET_DIR "static")
endif()

include(CMakePackageConfigHelpers)
if (DEFINED SIMPLE_VERSION)
write_basic_package_version_file(
"${CMAKE_CURRENT_BINARY_DIR}/iotidentity-cpp-config-version.cmake"
COMPATIBILITY SameMajorVersion
)
endif()

install(EXPORT "IotIdentity-cpp-targets"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/IotIdentity-cpp/cmake/${TARGET_DIR}"
NAMESPACE AWS::
Expand Down
2 changes: 2 additions & 0 deletions identity/cmake/iotidentity-cpp-config.cmake
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# This file is generated

include(CMakeFindDependencyMacro)

find_dependency(aws-crt-cpp)
Expand Down
2 changes: 2 additions & 0 deletions identity/include/aws/iotidentity/IotIdentityClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include <aws/crt/StlAllocator.h>
#include <aws/crt/Types.h>

#include <aws/crt/mqtt/Mqtt5Client.h>
#include <aws/crt/mqtt/MqttClient.h>

namespace Aws
Expand Down Expand Up @@ -60,6 +61,7 @@ namespace Aws
{
public:
IotIdentityClient(const std::shared_ptr<Aws::Crt::Mqtt::MqttConnection> &connection);
IotIdentityClient(const std::shared_ptr<Aws::Crt::Mqtt5::Mqtt5Client> &mqtt5Client);

operator bool() const noexcept;
int GetLastError() const noexcept;
Expand Down
5 changes: 5 additions & 0 deletions identity/source/IotIdentityClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ namespace Aws
{
}

IotIdentityClient::IotIdentityClient(const std::shared_ptr<Aws::Crt::Mqtt5::Mqtt5Client> &mqtt5Client)
{
m_connection = Aws::Crt::Mqtt::MqttConnection::NewConnectionFromMqtt5Client(mqtt5Client);
}

IotIdentityClient::operator bool() const noexcept { return m_connection && *m_connection; }

int IotIdentityClient::GetLastError() const noexcept { return aws_last_error(); }
Expand Down

0 comments on commit b4be2cd

Please sign in to comment.