Skip to content

Commit

Permalink
[aliyun-oss-cpp-sdk] add new port (microsoft#40597)
Browse files Browse the repository at this point in the history
Co-authored-by: 牧亦 <luanjun.lj@alibaba-inc.com>
  • Loading branch information
junluan and 牧亦 authored Sep 13, 2024
1 parent 4c2b54e commit 29b2ea2
Show file tree
Hide file tree
Showing 6 changed files with 119 additions and 0 deletions.
58 changes: 58 additions & 0 deletions ports/aliyun-oss-cpp-sdk/cmake-export.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
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}
OUTPUT_NAME ${TARGET_OUTPUT_NAME_PREFIX}${PROJECT_NAME}${STATIC_LIB_SUFFIX}
)

+target_include_directories(${PROJECT_NAME}${STATIC_LIB_SUFFIX}
+ PUBLIC $<INSTALL_INTERFACE:include>
+)
+
+target_link_libraries(${PROJECT_NAME}${STATIC_LIB_SUFFIX} ${CRYPTO_LIBS})
+target_link_libraries(${PROJECT_NAME}${STATIC_LIB_SUFFIX} ${CLIENT_LIBS})
+
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
OUTPUT_NAME ${TARGET_OUTPUT_NAME_PREFIX}${PROJECT_NAME}
)
-
+
+ target_include_directories(${PROJECT_NAME}
+ PUBLIC $<INSTALL_INTERFACE:include>
+ )
+
target_include_directories(${PROJECT_NAME}
PRIVATE include
PRIVATE include/alibabacloud/oss
@@ -210,16 +221,22 @@ 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
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)

if (BUILD_SHARED_LIBS)
-install(TARGETS ${PROJECT_NAME}
+install(TARGETS ${PROJECT_NAME} EXPORT unofficial-aliyun-oss-cpp-sdk-config
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
-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
+)
24 changes: 24 additions & 0 deletions ports/aliyun-oss-cpp-sdk/portfile.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO aliyun/aliyun-oss-cpp-sdk
REF "${VERSION}"
SHA512 7773961ad380d28cda96e16ae6491a76e03f0cb5f0c5135b660179dd449d730e1dfffb916489ed60e13815f53566c24cd9cfd8985c468438369341358eeed3bd
HEAD_REF master
PATCHES
cmake-export.patch
)

vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
-DBUILD_SAMPLE=OFF
)

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")
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(unofficial-aliyun-oss-cpp-sdk CONFIG REQUIRED)
target_link_libraries(main PRIVATE unofficial::aliyun-oss-cpp-sdk::cpp-sdk)
20 changes: 20 additions & 0 deletions ports/aliyun-oss-cpp-sdk/vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"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": "linux | osx | android",
"dependencies": [
"curl",
"openssl",
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"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": "cb847011bd7b34fe9ce8ce2ebf15141de1588003",
"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

0 comments on commit 29b2ea2

Please sign in to comment.