From 5dabd1b5ef467998df6c4e8d92488dc22b8c9069 Mon Sep 17 00:00:00 2001 From: gsstoykov <146725010+gsstoykov@users.noreply.github.com> Date: Wed, 7 Feb 2024 17:15:37 +0200 Subject: [PATCH] chore: Upgrade Hedera Protobufs to v0.47.0 (#41) Signed-off-by: gsstoykov --- .github/workflows/zxc-build-library.yaml | 17 +++++--- BuildOpenSSL.cmake | 51 ------------------------ CMakeLists.txt | 8 ++-- vcpkg | 2 +- vcpkg.json | 27 ++++++++++--- 5 files changed, 38 insertions(+), 67 deletions(-) delete mode 100644 BuildOpenSSL.cmake diff --git a/.github/workflows/zxc-build-library.yaml b/.github/workflows/zxc-build-library.yaml index a065949..50c2dfb 100644 --- a/.github/workflows/zxc-build-library.yaml +++ b/.github/workflows/zxc-build-library.yaml @@ -32,7 +32,7 @@ jobs: echo "::group::Show SemVer Binary Version Info" semver --version echo "::endgroup::" - + - name: Validate HAPI Version Tag id: version run: | @@ -43,7 +43,7 @@ jobs: echo "::error title=Version Error::The supplied hapi-version-tag parameter (${HAPI_VERSION}) is invalid and does not conform to the semantic versioning specifications." exit 2 fi - + [[ "${HAPI_VERSION}" == v* ]] || HAPI_VERSION="v${HAPI_VERSION}" echo "number=${HAPI_VERSION}" >> "${GITHUB_OUTPUT}" @@ -59,10 +59,10 @@ jobs: include: - os: Linux preset: linux-x64 -# - os: macos-latest -# preset: macos-x64 -# - os: windows-latest -# preset: windows-x64 + # - os: macos-latest + # preset: macos-x64 + # - os: windows-latest + # preset: windows-x64 needs: - hapi-version steps: @@ -88,6 +88,11 @@ jobs: with: binaryCachePath: ${{ github.workspace }}/b/vcpkg_cache + - name: Convert VCPkg to Full Clone + run: | + cd vcpkg + git fetch --unshallow --prune + - name: CMake Build (Debug) uses: lukka/run-cmake@v10 with: diff --git a/BuildOpenSSL.cmake b/BuildOpenSSL.cmake deleted file mode 100644 index 3c3d65c..0000000 --- a/BuildOpenSSL.cmake +++ /dev/null @@ -1,51 +0,0 @@ -include(ExternalProject) -set(OPENSSL_SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR}/_deps/openssl-src) # default path by CMake -set(OPENSSL_INSTALL_DIR ${CMAKE_CURRENT_BINARY_DIR}/openssl) -set(OPENSSL_INCLUDE_DIR ${OPENSSL_INSTALL_DIR}/include) -set(OPENSSL_CONFIGURE_COMMAND ${OPENSSL_SOURCE_DIR}/Configure no-shared) - -if (WIN32) - set(OPENSSL_CONFIGURE_COMMAND perl ${OPENSSL_CONFIGURE_COMMAND}) - set(OPENSSL_BUILD_COMMAND nmake /S) - set(OPENSSL_INSTALL_COMMAND nmake install_sw /S) - set(OPENSSL_LIBRARY_EXTENSION .lib) -else () - set(OPENSSL_BUILD_COMMAND make) - set(OPENSSL_INSTALL_COMMAND make install_sw) - set(OPENSSL_LIBRARY_EXTENSION .a) -endif () - -if (LINUX) - set(OPENSSL_BYPRODUCT_DIR ${OPENSSL_INSTALL_DIR}/lib64) -else () - set(OPENSSL_BYPRODUCT_DIR ${OPENSSL_INSTALL_DIR}/lib) -endif () - -ExternalProject_Add(OpenSSL - SOURCE_DIR ${OPENSSL_SOURCE_DIR} - GIT_REPOSITORY https://github.com/openssl/openssl.git - GIT_TAG master - GIT_SHALLOW TRUE - USES_TERMINAL_DOWNLOAD TRUE - CONFIGURE_COMMAND ${OPENSSL_CONFIGURE_COMMAND} --prefix=${OPENSSL_INSTALL_DIR} --openssldir=${OPENSSL_INSTALL_DIR} - BUILD_COMMAND ${OPENSSL_BUILD_COMMAND} - TEST_COMMAND "" - INSTALL_COMMAND ${OPENSSL_INSTALL_COMMAND} - INSTALL_DIR ${OPENSSL_INSTALL_DIR} - BUILD_BYPRODUCTS ${OPENSSL_BYPRODUCT_DIR}/libcrypto${OPENSSL_LIBRARY_EXTENSION} ${OPENSSL_BYPRODUCT_DIR}/libssl${OPENSSL_LIBRARY_EXTENSION} - UPDATE_COMMAND "" - ) - -# We cannot use find_library because ExternalProject_Add() is performed at build time. -# And to please the property INTERFACE_INCLUDE_DIRECTORIES, we make the include directory in advance. -file(MAKE_DIRECTORY ${OPENSSL_INCLUDE_DIR}) - -add_library(OpenSSL::Crypto STATIC IMPORTED GLOBAL) -set_property(TARGET OpenSSL::Crypto PROPERTY IMPORTED_LOCATION ${OPENSSL_BYPRODUCT_DIR}/libcrypto${OPENSSL_LIBRARY_EXTENSION}) -set_property(TARGET OpenSSL::Crypto PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${OPENSSL_INCLUDE_DIR}) -add_dependencies(OpenSSL::Crypto OpenSSL) - -add_library(OpenSSL::SSL STATIC IMPORTED GLOBAL) -set_property(TARGET OpenSSL::SSL PROPERTY IMPORTED_LOCATION ${OPENSSL_BYPRODUCT_DIR}/libssl${OPENSSL_LIBRARY_EXTENSION}) -set_property(TARGET OpenSSL::SSL PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${OPENSSL_INCLUDE_DIR}) -add_dependencies(OpenSSL::SSL OpenSSL) \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index c1b5956..859527f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.21...3.24) -project(hedera-protobufs-cpp VERSION 0.1.0 DESCRIPTION "Hedera C++ Protobuf Library" LANGUAGES CXX) +project(hedera-protobufs-cpp VERSION 0.47.0 DESCRIPTION "Hedera C++ Protobuf Library" LANGUAGES CXX) set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) @@ -10,9 +10,9 @@ include(FetchContent) set(Protobuf_USE_STATIC_LIBS ON) -include(BuildOpenSSL.cmake) set(gRPC_SSL_PROVIDER package) +find_package(OpenSSL REQUIRED) find_package(ZLIB REQUIRED) find_package(Protobuf REQUIRED) find_package(gRPC CONFIG REQUIRED) @@ -20,10 +20,10 @@ find_package(re2 CONFIG REQUIRED) find_package(c-ares CONFIG REQUIRED) find_package(absl CONFIG REQUIRED) -set(HAPI_VERSION_TAG "v0.44.0" CACHE STRING "Use the configured version tag for the Hedera API protobufs") +set(HAPI_VERSION_TAG "v0.47.0" CACHE STRING "Use the configured version tag for the Hedera API protobufs") if (HAPI_VERSION_TAG STREQUAL "") - set(HAPI_VERSION_TAG "v0.44.0") + set(HAPI_VERSION_TAG "v0.47.0") endif () # Fetch the protobuf definitions diff --git a/vcpkg b/vcpkg index 35619c2..0f9a4f6 160000 --- a/vcpkg +++ b/vcpkg @@ -1 +1 @@ -Subproject commit 35619c26a9bb550eacd7c17119d9732b085b198e +Subproject commit 0f9a4f65e4d06fd70a8d839ec3a1eafc05652e70 diff --git a/vcpkg.json b/vcpkg.json index 3e2c14a..e9e9d6b 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -1,10 +1,27 @@ { "name": "hedera-protobufs-cpp", - "version-string": "0.30.0", + "version-string": "0.1.0", + "builtin-baseline": "680071397677bb123b2f2b0ebe73905feae4a955", "dependencies": [ - "zlib", - "protobuf", - "grpc", - "upb" + { + "name": "openssl", + "version>=": "3.2.0#2" + }, + { + "name": "zlib", + "version>=": "1.2.12" + }, + { + "name": "protobuf", + "version>=": "3.21.6" + }, + { + "name": "grpc", + "version>=": "1.49.0" + }, + { + "name": "upb", + "version>=": "2022-06-21" + } ] }