Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[aliyun-oss-cpp-sdk] add new port #40597

Merged
merged 17 commits into from
Sep 13, 2024
21 changes: 21 additions & 0 deletions ports/aliyun-oss-cpp-sdk/portfile.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO aliyun/aliyun-oss-cpp-sdk
REF ${VERSION}
junluan marked this conversation as resolved.
Show resolved Hide resolved
SHA512 7773961ad380d28cda96e16ae6491a76e03f0cb5f0c5135b660179dd449d730e1dfffb916489ed60e13815f53566c24cd9cfd8985c468438369341358eeed3bd
HEAD_REF master
)

vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS ${FEATURE_OPTIONS}
junluan marked this conversation as resolved.
Show resolved Hide resolved
-DBUILD_SAMPLE=OFF
)

vcpkg_cmake_install()

file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${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")
4 changes: 4 additions & 0 deletions ports/aliyun-oss-cpp-sdk/usage
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
The package aliyun-oss-cpp-sdk provides CMake targets:

find_package(aliyun-oss-cpp-sdk CONFIG REQUIRED)
target_link_libraries(main PRIVATE aliyun-oss-cpp-sdk)
28 changes: 28 additions & 0 deletions ports/aliyun-oss-cpp-sdk/vcpkg-cmake-wrapper.cmake
junluan marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
find_path(ALIYUN_OSS_CPP_SDK_INCLUDE_DIR NAMES alibabacloud/oss/OssClient.h PATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/include" NO_DEFAULT_PATH)
find_library(ALIYUN_OSS_CPP_SDK_LIBRARY_RELEASE NAMES alibabacloud-oss-cpp-sdk PATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib" NO_DEFAULT_PATH)
find_library(ALIYUN_OSS_CPP_SDK_LIBRARY_DEBUG NAMES alibabacloud-oss-cpp-sdk PATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug/lib" NO_DEFAULT_PATH)
if(NOT ALIYUN_OSS_CPP_SDK_INCLUDE_DIR OR NOT (ALIYUN_OSS_CPP_SDK_LIBRARY_RELEASE OR ALIYUN_OSS_CPP_SDK_LIBRARY_DEBUG))
message(FATAL_ERROR "Broken installation of vcpkg port aliyun-oss-cpp-sdk")
endif()

function (parse_header_single_define filename var regex)
set(__header_contents "")
if (EXISTS ${filename})
file(STRINGS ${filename} __header_contents REGEX "#define[ \t]+${var}[ \t]+\".+\"")
endif ()
if (__header_contents MATCHES "(${regex})")
set(${var} ${CMAKE_MATCH_1} PARENT_SCOPE)
else ()
set(${var} "" PARENT_SCOPE)
endif ()
endfunction ()

parse_header_single_define(${ALIYUN_OSS_CPP_SDK_INCLUDE_DIR}/alibabacloud/oss/Config.h ALIBABACLOUD_OSS_VERSION_STR "[0-9]+\\.[0-9]+\\.[0-9]+")

add_library(aliyun-oss-cpp-sdk INTERFACE IMPORTED)

set_target_properties(aliyun-oss-cpp-sdk PROPERTIES
INTERFACE_LINK_LIBRARIES "\$<\$<NOT:\$<CONFIG:DEBUG>>:${ALIYUN_OSS_CPP_SDK_LIBRARY_RELEASE}>;\$<\$<CONFIG:DEBUG>:${ALIYUN_OSS_CPP_SDK_LIBRARY_DEBUG}>"
INTERFACE_INCLUDE_DIRECTORIES "${ALIYUN_OSS_CPP_SDK_INCLUDE_DIR}")

set(aliyun-oss-cpp-sdk_VERSION "${ALIBABACLOUD_OSS_VERSION_STR}")
16 changes: 16 additions & 0 deletions ports/aliyun-oss-cpp-sdk/vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "aliyun-oss-cpp-sdk",
"version": "1.10.0",
"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",
"supports": "!(uwp | osx)",
"dependencies": [
"curl",
"openssl",
{
"name": "vcpkg-cmake",
"host": true
}
]
}
9 changes: 9 additions & 0 deletions versions/a-/aliyun-oss-cpp-sdk.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"versions": [
{
"git-tree": "842af12c28f0bc80b566f0a88a996a90f1d0d218",
"version": "1.10.0",
"port-version": 0
}
]
}
4 changes: 4 additions & 0 deletions versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@
"baseline": "3.10.1",
"port-version": 0
},
"aliyun-oss-cpp-sdk": {
"baseline": "1.10.0",
"port-version": 0
},
"allegro5": {
"baseline": "5.2.9.1",
"port-version": 0
Expand Down