From d5ac13895753915d3ab17ff9c9c487d86ae5395f Mon Sep 17 00:00:00 2001 From: WangWeiLin-MV <156736127+WangWeiLin-MV@users.noreply.github.com> Date: Fri, 20 Sep 2024 04:31:59 +0800 Subject: [PATCH] [aliyun-oss-cpp-sdk] Change to find package config mode (#40954) --- ...atch => 0001-dependency-and-targets.patch} | 48 +++++++++++-------- .../0002-unofficial-export.cmake | 26 ++++++++++ .../0003-suppress-fmt-warning.patch | 13 +++++ ports/aliyun-oss-cpp-sdk/portfile.cmake | 6 +-- ports/aliyun-oss-cpp-sdk/usage | 4 -- ports/aliyun-oss-cpp-sdk/vcpkg.json | 1 + versions/a-/aliyun-oss-cpp-sdk.json | 5 ++ versions/baseline.json | 2 +- 8 files changed, 77 insertions(+), 28 deletions(-) rename ports/aliyun-oss-cpp-sdk/{cmake-export.patch => 0001-dependency-and-targets.patch} (69%) create mode 100644 ports/aliyun-oss-cpp-sdk/0002-unofficial-export.cmake create mode 100644 ports/aliyun-oss-cpp-sdk/0003-suppress-fmt-warning.patch delete mode 100644 ports/aliyun-oss-cpp-sdk/usage diff --git a/ports/aliyun-oss-cpp-sdk/cmake-export.patch b/ports/aliyun-oss-cpp-sdk/0001-dependency-and-targets.patch similarity index 69% rename from ports/aliyun-oss-cpp-sdk/cmake-export.patch rename to ports/aliyun-oss-cpp-sdk/0001-dependency-and-targets.patch index de53694159f..5fa3f897a7c 100644 --- a/ports/aliyun-oss-cpp-sdk/cmake-export.patch +++ b/ports/aliyun-oss-cpp-sdk/0001-dependency-and-targets.patch @@ -1,8 +1,23 @@ -diff --git a/sdk/CMakeLists.txt b/sdk/CMakeLists.txt -index 28d04c2..c7b2e6c 100644 ---- a/sdk/CMakeLists.txt -+++ b/sdk/CMakeLists.txt -@@ -146,6 +146,13 @@ set_target_properties(${PROJECT_NAME}${STATIC_LIB_SUFFIX} +diff --git a/CMakeLists.txt b/CMakeLists.txt +index ea0d8d6..2a853a0 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -78,8 +78,8 @@ if (${TARGET_OS} STREQUAL "WINDOWS") + set(CLIENT_INCLUDE_DIRS + ${CMAKE_SOURCE_DIR}/third_party/include) + else() +- include(FindCURL) +- include(FindOpenSSL) ++ find_package(CURL CONFIG REQUIRED) ++ find_package(OpenSSL CONFIG REQUIRED) + + if(NOT CURL_FOUND) + message(FATAL_ERROR "Could not find curl") +diff --git a/sdk/CMakeLists.txt b/sdk/CMakeLists.txt +index 28d04c2..d5d715d 100644 +--- a/sdk/CMakeLists.txt ++++ b/sdk/CMakeLists.txt +@@ -146,6 +146,13 @@ set_target_properties(${PROJECT_NAME}${STATIC_LIB_SUFFIX} OUTPUT_NAME ${TARGET_OUTPUT_NAME_PREFIX}${PROJECT_NAME}${STATIC_LIB_SUFFIX} ) @@ -16,25 +31,22 @@ index 28d04c2..c7b2e6c 100644 target_include_directories(${PROJECT_NAME}${STATIC_LIB_SUFFIX} PRIVATE include PRIVATE include/alibabacloud/oss -@@ -172,7 +179,11 @@ if (BUILD_SHARED_LIBS) - RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib +@@ -173,6 +180,9 @@ if (BUILD_SHARED_LIBS) OUTPUT_NAME ${TARGET_OUTPUT_NAME_PREFIX}${PROJECT_NAME} ) -- -+ + + target_include_directories(${PROJECT_NAME} + PUBLIC $ + ) -+ target_include_directories(${PROJECT_NAME} PRIVATE include PRIVATE include/alibabacloud/oss -@@ -210,16 +221,22 @@ install(FILES ${sdk_encryption_header} +@@ -210,16 +220,18 @@ install(FILES ${sdk_encryption_header} install(FILES ${sdk_public_header} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/alibabacloud/oss) -install(TARGETS ${PROJECT_NAME}${STATIC_LIB_SUFFIX} -+install(TARGETS ${PROJECT_NAME}${STATIC_LIB_SUFFIX} EXPORT unofficial-aliyun-oss-cpp-sdk-config ++install(TARGETS ${PROJECT_NAME}${STATIC_LIB_SUFFIX} EXPORT unofficial-aliyun-oss-cpp-sdk-targets ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} @@ -42,17 +54,13 @@ index 28d04c2..c7b2e6c 100644 if (BUILD_SHARED_LIBS) -install(TARGETS ${PROJECT_NAME} -+install(TARGETS ${PROJECT_NAME} EXPORT unofficial-aliyun-oss-cpp-sdk-config ++install(TARGETS ${PROJECT_NAME} EXPORT unofficial-aliyun-oss-cpp-sdk-targets ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ) --endif() -\ No newline at end of file +-endif() +\ No newline at end of file +endif() + -+install( -+ EXPORT unofficial-aliyun-oss-cpp-sdk-config -+ NAMESPACE unofficial::aliyun-oss-cpp-sdk:: -+ DESTINATION share/unofficial-aliyun-oss-cpp-sdk -+) ++include(0002-unofficial-export.cmake) diff --git a/ports/aliyun-oss-cpp-sdk/0002-unofficial-export.cmake b/ports/aliyun-oss-cpp-sdk/0002-unofficial-export.cmake new file mode 100644 index 00000000000..e049152c21f --- /dev/null +++ b/ports/aliyun-oss-cpp-sdk/0002-unofficial-export.cmake @@ -0,0 +1,26 @@ + +install( + EXPORT unofficial-aliyun-oss-cpp-sdk-targets + NAMESPACE unofficial::aliyun-oss-cpp-sdk:: + DESTINATION share/unofficial-aliyun-oss-cpp-sdk +) + +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/unofficial-aliyun-oss-cpp-sdk-config.cmake.in" [[ +@PACKAGE_INIT@ +include(CMakeFindDependencyMacro) +find_dependency(CURL REQUIRED) +find_dependency(OpenSSL REQUIRED) +include("${CMAKE_CURRENT_LIST_DIR}/unofficial-aliyun-oss-cpp-sdk-targets.cmake") +]] +) + +include(CMakePackageConfigHelpers) +configure_package_config_file("${CMAKE_CURRENT_BINARY_DIR}/unofficial-aliyun-oss-cpp-sdk-config.cmake.in" + "${CMAKE_CURRENT_BINARY_DIR}/unofficial-aliyun-oss-cpp-sdk-config.cmake" + INSTALL_DESTINATION "share/unofficial-aliyun-oss-cpp-sdk" +) + +install(FILES + "${CMAKE_CURRENT_BINARY_DIR}/unofficial-aliyun-oss-cpp-sdk-config.cmake" + DESTINATION "share/unofficial-aliyun-oss-cpp-sdk" +) diff --git a/ports/aliyun-oss-cpp-sdk/0003-suppress-fmt-warning.patch b/ports/aliyun-oss-cpp-sdk/0003-suppress-fmt-warning.patch new file mode 100644 index 00000000000..ac43d69d073 --- /dev/null +++ b/ports/aliyun-oss-cpp-sdk/0003-suppress-fmt-warning.patch @@ -0,0 +1,13 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index ea0d8d6..2a853a0 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -119,7 +119,7 @@ else() + endif() + + list(APPEND SDK_COMPILER_FLAGS "-Wall" "-Werror" "-pedantic" "-Wextra") +- ++ list(APPEND SDK_COMPILER_FLAGS "-Wno-error=deprecated-declarations") + if (ENABLE_COVERAGE) + SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fprofile-arcs -ftest-coverage") + SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -fprofile-arcs -ftest-coverage") diff --git a/ports/aliyun-oss-cpp-sdk/portfile.cmake b/ports/aliyun-oss-cpp-sdk/portfile.cmake index 39a6f0c26ad..ccb6e7f724a 100644 --- a/ports/aliyun-oss-cpp-sdk/portfile.cmake +++ b/ports/aliyun-oss-cpp-sdk/portfile.cmake @@ -5,8 +5,10 @@ vcpkg_from_github( SHA512 7773961ad380d28cda96e16ae6491a76e03f0cb5f0c5135b660179dd449d730e1dfffb916489ed60e13815f53566c24cd9cfd8985c468438369341358eeed3bd HEAD_REF master PATCHES - cmake-export.patch + 0001-dependency-and-targets.patch + 0003-suppress-fmt-warning.patch ) +file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/0002-unofficial-export.cmake" DESTINATION "${SOURCE_PATH}/sdk/") vcpkg_cmake_configure( SOURCE_PATH "${SOURCE_PATH}" @@ -18,7 +20,5 @@ vcpkg_cmake_install() vcpkg_cmake_config_fixup(PACKAGE_NAME unofficial-${PORT}) -file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") - file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE") diff --git a/ports/aliyun-oss-cpp-sdk/usage b/ports/aliyun-oss-cpp-sdk/usage deleted file mode 100644 index 419193d0da4..00000000000 --- a/ports/aliyun-oss-cpp-sdk/usage +++ /dev/null @@ -1,4 +0,0 @@ -The package aliyun-oss-cpp-sdk provides CMake targets: - - find_package(unofficial-aliyun-oss-cpp-sdk CONFIG REQUIRED) - target_link_libraries(main PRIVATE unofficial::aliyun-oss-cpp-sdk::cpp-sdk) diff --git a/ports/aliyun-oss-cpp-sdk/vcpkg.json b/ports/aliyun-oss-cpp-sdk/vcpkg.json index 7132cd1faf6..48ab4a9b5a6 100644 --- a/ports/aliyun-oss-cpp-sdk/vcpkg.json +++ b/ports/aliyun-oss-cpp-sdk/vcpkg.json @@ -1,6 +1,7 @@ { "name": "aliyun-oss-cpp-sdk", "version": "1.10.0", + "port-version": 1, "description": "Alibaba Cloud Object Storage Service (OSS) is a cloud storage service provided by Alibaba Cloud, featuring massive capacity, security, a low cost, and high reliability.", "homepage": "https://github.com/aliyun/aliyun-oss-cpp-sdk", "license": "Apache-2.0", diff --git a/versions/a-/aliyun-oss-cpp-sdk.json b/versions/a-/aliyun-oss-cpp-sdk.json index f01d9c9dc5d..e128d29cf5b 100644 --- a/versions/a-/aliyun-oss-cpp-sdk.json +++ b/versions/a-/aliyun-oss-cpp-sdk.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "732b0995e1fae92ab6192bbf41f0e40a459d9ac7", + "version": "1.10.0", + "port-version": 1 + }, { "git-tree": "cb847011bd7b34fe9ce8ce2ebf15141de1588003", "version": "1.10.0", diff --git a/versions/baseline.json b/versions/baseline.json index b10d4d64199..cac02331bdd 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -82,7 +82,7 @@ }, "aliyun-oss-cpp-sdk": { "baseline": "1.10.0", - "port-version": 0 + "port-version": 1 }, "allegro5": { "baseline": "5.2.9.1",