04da0df568
Enable building androiddeployqt when performing host builds only. Added QtPlatformAndroid.cmake to locate Java and the setup the android SDK platform when building on android. Install the androiddeployqt support files when performing a host build. Added ANDROID_SDK_ROOT configuration variable for specifying the android sdk directory. Generating the deployment-settings.json will be done in another change. Change-Id: I1bf15315af4ed904d2fb1d22b0e8e834df32d6ed Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
45 lines
1.4 KiB
CMake
45 lines
1.4 KiB
CMake
#
|
|
# Platform Settings for Android
|
|
#
|
|
|
|
if (NOT DEFINED ANDROID_SDK_ROOT)
|
|
message(FATAL_ERROR "ANDROID_SDK_ROOT is not defined")
|
|
endif()
|
|
|
|
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()
|
|
|
|
# Minimum recommend android SDK api version
|
|
set(qt_android_api_version "android-21")
|
|
|
|
# Locate android.jar
|
|
set(android_jar "${ANDROID_SDK_ROOT}/platforms/${qt_android_api_version}/android.jar")
|
|
if(NOT EXISTS "${android_jar}")
|
|
# Locate the highest available platform
|
|
file(GLOB android_platforms
|
|
LIST_DIRECTORIES true
|
|
RELATIVE "${ANDROID_SDK_ROOT}/platforms"
|
|
"${ANDROID_SDK_ROOT}/platforms/*")
|
|
# If list is not empty
|
|
if(android_platforms)
|
|
list(SORT android_platforms)
|
|
list(REVERSE android_platforms)
|
|
list(GET android_platforms 0 android_platform_latest)
|
|
set(qt_android_api_version ${android_platform_latest})
|
|
set(android_jar "${ANDROID_SDK_ROOT}/platforms/${qt_android_api_version}/android.jar")
|
|
endif()
|
|
endif()
|
|
|
|
if(NOT EXISTS "${android_jar}")
|
|
message(FATAL_ERROR "No suitable Android SDK platform found. Minimum version is ${qt_android_api_version}")
|
|
endif()
|
|
|
|
message(STATUS "Using Android SDK API ${qt_android_api_version} from ${ANDROID_SDK_ROOT}/platforms")
|
|
|
|
# Locate Java
|
|
include(UseJava)
|
|
|
|
# Find JDK 8.0
|
|
find_package(Java 1.8 COMPONENTS Development REQUIRED)
|