vcpkg/ports/aws-sdk-cpp/portfile.cmake
Ahmed Yarub Hani Al Nuaimi f519430b0f
[openssl] [aws-c-common] Fix AWS SDK for C++ build on WASM32 and Android (#17348)
* Add curl try_compile parameters
Don't set compiler when compiling for iOS

* Update OpenSSL and AWS SDK for C++ port versions

* [vcpkg baseline][marble] Disable find I18n

* update version record

* Fix AWS C Common build for WASM32

* Fix OpenSSL build for WASM32

* Update AWS C Common and OpenSSL versions

* Update versions/a-/aws-sdk-cpp.json

* Update versions/o-/openssl.json

* Fix port-versions after merging master branch

* Fix port-versions after merging master branch

* Update versions/o-/openssl.json

* Update versions/a-/aws-sdk-cpp.json

* Update versions/o-/openssl.json

* Fix merge conflicts

* Fix merge conflicts

* Update ports/aws-c-common/portfile.cmake

Co-authored-by: Robert Schumacher <roschuma@microsoft.com>

* Update versions/a-/aws-c-common.json

* Update versions/o-/openssl.json

* Update versions/o-/openssl.json

* Update versions/o-/openssl.json

* Update ports/openssl/CONTROL

* Merge master branch and resolve merge conflicts

* Disable -moutline-atomics in Android also

* Revert line ending change

* Fix version info

Co-authored-by: Ahmed Yarub Hani Al Nuaimi <ahmed.alnuaimi@zwift.com>
Co-authored-by: JackBoosY <yuzaiyang@beyondsoft.com>
Co-authored-by: Jack·Boos·Yu <47264268+JackBoosY@users.noreply.github.com>
Co-authored-by: Robert Schumacher <roschuma@microsoft.com>
2021-05-26 14:03:32 -07:00

112 lines
3.9 KiB
CMake

vcpkg_buildpath_length_warning(37)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO aws/aws-sdk-cpp
REF b11ed430fa6a574cc842532192dfeb9bb09e62b4 # 1.8.126
SHA512 39e71f85d977b183df6f0d6d61a028db33573026f6abb8856f35e0e71398e2749db6dbdd033818a2c045ec42076fb23cdbae92608117db0a08ca88a05c825683
HEAD_REF master
PATCHES
patch-relocatable-rpath.patch
fix-AWSSDKCONFIG.patch
)
string(COMPARE EQUAL "${VCPKG_CRT_LINKAGE}" "dynamic" FORCE_SHARED_CRT)
set(BUILD_ONLY core)
include(${CMAKE_CURRENT_LIST_DIR}/compute_build_only.cmake)
set(EXTRA_ARGS)
if(VCPKG_TARGET_IS_OSX OR VCPKG_TARGET_IS_IOS)
set(rpath "@loader_path")
set(EXTRA_ARGS
"-DCURL_HAS_H2_EXITCODE=0"
"-DCURL_HAS_H2_EXITCODE__TRYRUN_OUTPUT=\"\""
"-DCURL_HAS_TLS_PROXY_EXITCODE=0"
"-DCURL_HAS_TLS_PROXY_EXITCODE__TRYRUN_OUTPUT=\"\""
)
elseif (VCPKG_TARGET_IS_ANDROID)
set(EXTRA_ARGS "-DTARGET_ARCH=ANDROID"
"-DGIT_EXECUTABLE=--invalid-git-executable--"
"-DGIT_FOUND=TRUE"
"-DNDK_DIR=$ENV{ANDROID_NDK_HOME}"
"-DANDROID_BUILD_ZLIB=FALSE"
"-DANDROID_BUILD_CURL=FALSE"
"-DANDROID_BUILD_OPENSSL=FALSE"
"-DENABLE_HW_OPTIMIZATION=OFF"
"-DCURL_HAS_H2_EXITCODE=0"
"-DCURL_HAS_H2_EXITCODE__TRYRUN_OUTPUT=\"\""
"-DCURL_HAS_TLS_PROXY_EXITCODE=0"
"-DCURL_HAS_TLS_PROXY_EXITCODE__TRYRUN_OUTPUT=\"\""
)
else()
set(rpath "\$ORIGIN")
endif()
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
DISABLE_PARALLEL_CONFIGURE
PREFER_NINJA
OPTIONS
${EXTRA_ARGS}
-DENABLE_UNITY_BUILD=ON
-DENABLE_TESTING=OFF
-DFORCE_SHARED_CRT=${FORCE_SHARED_CRT}
-DCMAKE_DISABLE_FIND_PACKAGE_Git=TRUE
"-DBUILD_ONLY=${BUILD_ONLY}"
-DBUILD_DEPS=OFF
-DCMAKE_INSTALL_RPATH=${rpath}
)
vcpkg_install_cmake()
vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake TARGET_PATH share)
vcpkg_copy_pdbs()
file(GLOB_RECURSE AWS_TARGETS "${CURRENT_PACKAGES_DIR}/share/*/*-targets-*.cmake")
foreach(AWS_TARGET IN LISTS AWS_TARGETS)
file(READ ${AWS_TARGET} _contents)
string(REGEX REPLACE
"bin\\/([A-Za-z0-9_.-]+\\.lib)"
"lib/\\1"
_contents "${_contents}")
file(WRITE ${AWS_TARGET} "${_contents}")
endforeach()
file(GLOB AWS_CONFIGS "${CURRENT_PACKAGES_DIR}/share/*/aws-cpp-sdk-*-config.cmake")
list(FILTER AWS_CONFIGS EXCLUDE REGEX "aws-cpp-sdk-core-config\\.cmake\$")
foreach(AWS_CONFIG IN LISTS AWS_CONFIGS)
file(READ "${AWS_CONFIG}" _contents)
file(WRITE "${AWS_CONFIG}" "include(CMakeFindDependencyMacro)\nfind_dependency(aws-cpp-sdk-core)\n${_contents}")
endforeach()
file(REMOVE_RECURSE
${CURRENT_PACKAGES_DIR}/debug/include
${CURRENT_PACKAGES_DIR}/debug/share
${CURRENT_PACKAGES_DIR}/lib/pkgconfig
${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig
${CURRENT_PACKAGES_DIR}/nuget
${CURRENT_PACKAGES_DIR}/debug/nuget
)
if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
file(GLOB LIB_FILES ${CURRENT_PACKAGES_DIR}/bin/*.lib)
if(LIB_FILES)
file(COPY ${LIB_FILES} DESTINATION ${CURRENT_PACKAGES_DIR}/lib)
file(REMOVE ${LIB_FILES})
endif()
file(GLOB DEBUG_LIB_FILES ${CURRENT_PACKAGES_DIR}/debug/bin/*.lib)
if(DEBUG_LIB_FILES)
file(COPY ${DEBUG_LIB_FILES} DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib)
file(REMOVE ${DEBUG_LIB_FILES})
endif()
file(APPEND ${CURRENT_PACKAGES_DIR}/include/aws/core/SDKConfig.h "#ifndef USE_IMPORT_EXPORT\n#define USE_IMPORT_EXPORT\n#endif")
endif()
configure_file(${CURRENT_PORT_DIR}/usage ${CURRENT_PACKAGES_DIR}/share/${PORT}/usage @ONLY)
# Handle copyright
file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)