Make qt-internal-configure-tests aware of Vcpkg's OpenSSL packages
The currently provisioned OpenSSL for Android, i.e., `prebuilt-openssl-3.0.7-for-android-ndk-r25b.zip` has a different structure compared to what Vcpkg installed directory has. This patch makes sure that we are considering the Vcpkg structure as well. CMAKE_ANDROID_ARCH_ABI should be translated to Vcpkg's triplet target name, and we add a `-dynamic` suffix to them because we are building android artifacts with a custom triplets with similar names. Change-Id: Id48a8ad351a64ab18001f729d948fbf1b7e47b29 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
parent
4f168621d2
commit
9e4e52a9b3
@ -600,18 +600,33 @@ function(qt_internal_add_test name)
|
||||
|
||||
if (ANDROID)
|
||||
if(arg_BUNDLE_ANDROID_OPENSSL_LIBS)
|
||||
if(NOT OPENSSL_ROOT_DIR)
|
||||
message(WARNING "The argument BUNDLE_ANDROID_OPENSSL_LIBS is set "
|
||||
"but OPENSSL_ROOT_DIR parameter is not set.")
|
||||
else()
|
||||
if(EXISTS "${OPENSSL_ROOT_DIR}/${CMAKE_ANDROID_ARCH_ABI}/libcrypto_3.so")
|
||||
set_property(TARGET ${name} APPEND PROPERTY QT_ANDROID_EXTRA_LIBS
|
||||
"${OPENSSL_ROOT_DIR}/${CMAKE_ANDROID_ARCH_ABI}/libcrypto_3.so"
|
||||
"${OPENSSL_ROOT_DIR}/${CMAKE_ANDROID_ARCH_ABI}/libssl_3.so")
|
||||
else()
|
||||
message(STATUS "Test should bundle OpenSSL libraries but they are not found."
|
||||
" This is fine if OpenSSL was built statically.")
|
||||
if(EXISTS "${OPENSSL_ROOT_DIR}/${CMAKE_ANDROID_ARCH_ABI}/libcrypto_3.so")
|
||||
message(STATUS "Looking for OpenSSL in ${OPENSSL_ROOT_DIR}")
|
||||
set_property(TARGET ${name} APPEND PROPERTY QT_ANDROID_EXTRA_LIBS
|
||||
"${OPENSSL_ROOT_DIR}/${CMAKE_ANDROID_ARCH_ABI}/libcrypto_3.so"
|
||||
"${OPENSSL_ROOT_DIR}/${CMAKE_ANDROID_ARCH_ABI}/libssl_3.so")
|
||||
elseif(QT_USE_VCPKG AND DEFINED ENV{VCPKG_ROOT})
|
||||
message(STATUS "Looking for OpenSSL in $ENV{VCPKG_ROOT}")
|
||||
if (CMAKE_ANDROID_ARCH_ABI MATCHES "arm64-v8a")
|
||||
set(coin_vcpkg_target_triplet "arm64-android-dynamic")
|
||||
elseif(CMAKE_ANDROID_ARCH_ABI MATCHES "armeabi-v7a")
|
||||
set(coin_vcpkg_target_triplet "arm-neon-android-dynamic")
|
||||
elseif(CMAKE_ANDROID_ARCH_ABI MATCHES "x86_64")
|
||||
set(coin_vcpkg_target_triplet "x64-android-dynamic")
|
||||
elseif(CMAKE_ANDROID_ARCH_ABI MATCHES "x86")
|
||||
set(coin_vcpkg_target_triplet "x86-android-dynamic")
|
||||
endif()
|
||||
if(EXISTS "$ENV{VCPKG_ROOT}/installed/${coin_vcpkg_target_triplet}/lib/libcrypto.so")
|
||||
message(STATUS "Found OpenSSL in $ENV{VCPKG_ROOT}/installed/${coin_vcpkg_target_triplet}/lib")
|
||||
set_property(TARGET ${name} APPEND PROPERTY QT_ANDROID_EXTRA_LIBS
|
||||
"$ENV{VCPKG_ROOT}/installed/${coin_vcpkg_target_triplet}/lib/libcrypto.so"
|
||||
"$ENV{VCPKG_ROOT}/installed/${coin_vcpkg_target_triplet}/lib/libssl.so")
|
||||
endif()
|
||||
else()
|
||||
message(STATUS "The argument BUNDLE_ANDROID_OPENSSL_LIBS is set "
|
||||
"but OPENSSL_ROOT_DIR parameter is not set."
|
||||
"Test should bundle OpenSSL libraries but they are not found."
|
||||
"This is fine if OpenSSL was built statically.")
|
||||
endif()
|
||||
endif()
|
||||
qt_internal_android_test_arguments("${name}" test_executable extra_test_args)
|
||||
|
Loading…
Reference in New Issue
Block a user