Move qt_internal_sort_android_platforms to public android helpers
The function is used in semi-public API and should in QtPublicAndroidHelpers.cmake. Amends de40931eba2cf09a8c97c9a75c6d23c77748f44c Change-Id: I3946ecb091584ac5406b3eb4d2024210398f26a3 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit b0dc47aa447beaf4ab4bad39edeae06275c48f74) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
2b2271bea3
commit
49bf0afdc7
@ -23,33 +23,6 @@ if (NOT IS_DIRECTORY "${ANDROID_SDK_ROOT}")
|
||||
message(FATAL_ERROR "Could not find ANDROID_SDK_ROOT or path is not a directory: ${ANDROID_SDK_ROOT}")
|
||||
endif()
|
||||
|
||||
function(qt_internal_sort_android_platforms out_var)
|
||||
if(CMAKE_VERSION GREATER_EQUAL 3.18)
|
||||
set(platforms ${ARGN})
|
||||
list(SORT platforms COMPARE NATURAL)
|
||||
else()
|
||||
# Simulate natural sorting:
|
||||
# - prepend every platform with its version as three digits, zero-padded
|
||||
# - regular sort
|
||||
# - remove the padded version prefix
|
||||
set(platforms)
|
||||
foreach(platform IN LISTS ARGN)
|
||||
set(version "000")
|
||||
if(platform MATCHES ".*-([0-9]+)$")
|
||||
set(version ${CMAKE_MATCH_1})
|
||||
string(LENGTH "${version}" version_length)
|
||||
math(EXPR padding_length "3 - ${version_length}")
|
||||
string(REPEAT "0" ${padding_length} padding)
|
||||
string(PREPEND version ${padding})
|
||||
endif()
|
||||
list(APPEND platforms "${version}~${platform}")
|
||||
endforeach()
|
||||
list(SORT platforms)
|
||||
list(TRANSFORM platforms REPLACE "^.*~" "")
|
||||
endif()
|
||||
set("${out_var}" "${platforms}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# This variable specifies the API level used for building Java code, it can be the same as Qt for
|
||||
# Android's maximum supported Android version or higher.
|
||||
if(NOT QT_ANDROID_API_USED_FOR_JAVA)
|
||||
|
@ -10,7 +10,7 @@ function(_qt_internal_detect_latest_android_platform out_var)
|
||||
|
||||
# If list is not empty
|
||||
if(android_platforms)
|
||||
qt_internal_sort_android_platforms(android_platforms ${android_platforms})
|
||||
_qt_internal_sort_android_platforms(android_platforms ${android_platforms})
|
||||
list(REVERSE android_platforms)
|
||||
list(GET android_platforms 0 android_platform_latest)
|
||||
set(${out_var} "${android_platform_latest}" PARENT_SCOPE)
|
||||
@ -18,3 +18,30 @@ function(_qt_internal_detect_latest_android_platform out_var)
|
||||
set(${out_var} "${out_var}-NOTFOUND" PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(_qt_internal_sort_android_platforms out_var)
|
||||
if(CMAKE_VERSION GREATER_EQUAL 3.18)
|
||||
set(platforms ${ARGN})
|
||||
list(SORT platforms COMPARE NATURAL)
|
||||
else()
|
||||
# Simulate natural sorting:
|
||||
# - prepend every platform with its version as three digits, zero-padded
|
||||
# - regular sort
|
||||
# - remove the padded version prefix
|
||||
set(platforms)
|
||||
foreach(platform IN LISTS ARGN)
|
||||
set(version "000")
|
||||
if(platform MATCHES ".*-([0-9]+)$")
|
||||
set(version ${CMAKE_MATCH_1})
|
||||
string(LENGTH "${version}" version_length)
|
||||
math(EXPR padding_length "3 - ${version_length}")
|
||||
string(REPEAT "0" ${padding_length} padding)
|
||||
string(PREPEND version ${padding})
|
||||
endif()
|
||||
list(APPEND platforms "${version}~${platform}")
|
||||
endforeach()
|
||||
list(SORT platforms)
|
||||
list(TRANSFORM platforms REPLACE "^.*~" "")
|
||||
endif()
|
||||
set("${out_var}" "${platforms}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
Loading…
x
Reference in New Issue
Block a user