From 538879caeaedf1c0433d89024e2ccb5705eb8284 Mon Sep 17 00:00:00 2001 From: KGronek-Pubnub Date: Thu, 24 Oct 2024 15:11:43 +0200 Subject: [PATCH] Add Android support (#197) --- .pubnub.yml | 23 +++++++++++++++-------- CHANGELOG.md | 9 +++++++++ CMakeLists.txt | 19 +++++++++++++++---- core/pubnub_version_internal.h | 2 +- 4 files changed, 40 insertions(+), 13 deletions(-) diff --git a/.pubnub.yml b/.pubnub.yml index be2364c5..76c5b55c 100644 --- a/.pubnub.yml +++ b/.pubnub.yml @@ -1,8 +1,15 @@ name: c-core schema: 1 -version: "4.14.0" +version: "4.14.1" scm: github.com/pubnub/c-core changelog: + - date: 2024-10-24 + version: v4.14.1 + changes: + - type: bug + text: "Fix CMakeLists to build correctly on Windows." + - type: improvement + text: "Prepare CMakeLists to support builds for Arm64 architecture." - date: 2024-10-15 version: v4.14.0 changes: @@ -868,7 +875,7 @@ sdks: distribution-type: source code distribution-repository: GitHub release package-name: C-Core - location: https://github.com/pubnub/c-core/releases/tag/v4.14.0 + location: https://github.com/pubnub/c-core/releases/tag/v4.14.1 requires: - name: "miniz" @@ -934,7 +941,7 @@ sdks: distribution-type: source code distribution-repository: GitHub release package-name: C-Core - location: https://github.com/pubnub/c-core/releases/tag/v4.14.0 + location: https://github.com/pubnub/c-core/releases/tag/v4.14.1 requires: - name: "miniz" @@ -1000,7 +1007,7 @@ sdks: distribution-type: source code distribution-repository: GitHub release package-name: C-Core - location: https://github.com/pubnub/c-core/releases/tag/v4.14.0 + location: https://github.com/pubnub/c-core/releases/tag/v4.14.1 requires: - name: "miniz" @@ -1062,7 +1069,7 @@ sdks: distribution-type: source code distribution-repository: GitHub release package-name: C-Core - location: https://github.com/pubnub/c-core/releases/tag/v4.14.0 + location: https://github.com/pubnub/c-core/releases/tag/v4.14.1 requires: - name: "miniz" @@ -1123,7 +1130,7 @@ sdks: distribution-type: source code distribution-repository: GitHub release package-name: C-Core - location: https://github.com/pubnub/c-core/releases/tag/v4.14.0 + location: https://github.com/pubnub/c-core/releases/tag/v4.14.1 requires: - name: "miniz" @@ -1179,7 +1186,7 @@ sdks: distribution-type: source code distribution-repository: GitHub release package-name: C-Core - location: https://github.com/pubnub/c-core/releases/tag/v4.14.0 + location: https://github.com/pubnub/c-core/releases/tag/v4.14.1 requires: - name: "miniz" @@ -1232,7 +1239,7 @@ sdks: distribution-type: source code distribution-repository: GitHub release package-name: C-Core - location: https://github.com/pubnub/c-core/releases/tag/v4.14.0 + location: https://github.com/pubnub/c-core/releases/tag/v4.14.1 requires: - name: "miniz" diff --git a/CHANGELOG.md b/CHANGELOG.md index 100e6944..a266a427 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,12 @@ +## v4.14.1 +October 24 2024 + +#### Fixed +- Fix CMakeLists to build correctly on Windows. + +#### Modified +- Prepare CMakeLists to support builds for Arm64 architecture. + ## v4.14.0 October 15 2024 diff --git a/CMakeLists.txt b/CMakeLists.txt index 32c34b42..e8c26259 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -445,6 +445,11 @@ if(${OPENSSL}) if(WIN32 OR WIN64 OR MSVC) find_library(OpenSSL REQUIRED NAMES libssl PATHS ${OPENSSL_ROOT_DIR}/${CUSTOM_OPENSSL_LIB_DIR} NO_DEFAULT_PATH) find_library(Crypto REQUIRED NAMES libcrypto PATHS ${OPENSSL_ROOT_DIR}/${CUSTOM_OPENSSL_LIB_DIR} NO_DEFAULT_PATH) + elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64|arm64") + # find_library doesn't work when building for Android architecture + set(OpenSSL "${OPENSSL_ROOT_DIR}/${CUSTOM_OPENSSL_LIB_DIR}/libssl.a") + set(Crypto "${OPENSSL_ROOT_DIR}/${CUSTOM_OPENSSL_LIB_DIR}/libcrypto.a") + link_libraries(${OpenSSL} ${Crypto}) else() find_library(OpenSSL REQUIRED NAMES ssl PATHS ${OPENSSL_ROOT_DIR}/${CUSTOM_OPENSSL_LIB_DIR} NO_DEFAULT_PATH) find_library(Crypto REQUIRED NAMES crypto PATHS ${OPENSSL_ROOT_DIR}/${CUSTOM_OPENSSL_LIB_DIR} NO_DEFAULT_PATH) @@ -478,9 +483,15 @@ if(${OPENSSL}) ${CMAKE_CURRENT_LIST_DIR}/openssl/pbpal_openssl_blocking_io.c ${FEATURE_SOURCEFILES}) - set(FEATURE_SOURCEFILES - ${CMAKE_CURRENT_LIST_DIR}/openssl/pbauto_heartbeat_init_posix.c - ${FEATURE_SOURCEFILES}) + if(UNIX) + set(FEATURE_SOURCEFILES + ${CMAKE_CURRENT_LIST_DIR}/posix/pbauto_heartbeat_init_posix.c + ${FEATURE_SOURCEFILES}) + else() + set(FEATURE_SOURCEFILES + ${CMAKE_CURRENT_LIST_DIR}/windows/pbauto_heartbeat_init_windows.c + ${FEATURE_SOURCEFILES}) + endif() set(LDLIBS ${LDLIBS}) @@ -537,7 +548,7 @@ if(NOT ESP_PLATFORM) set(LIBTYPE SHARED) else() message(STATUS "Building static library") - set(LIBYTPE STATIC) + set(LIBTYPE STATIC) endif() add_library(pubnub ${LIBTYPE} ${SOURCEFILES}) diff --git a/core/pubnub_version_internal.h b/core/pubnub_version_internal.h index 2719721e..ecd52c95 100644 --- a/core/pubnub_version_internal.h +++ b/core/pubnub_version_internal.h @@ -3,7 +3,7 @@ #define INC_PUBNUB_VERSION_INTERNAL -#define PUBNUB_SDK_VERSION "4.14.0" +#define PUBNUB_SDK_VERSION "4.14.1" #endif /* !defined INC_PUBNUB_VERSION_INTERNAL */