mirror of
https://github.com/QuasarApp/qt-android-cmake.git
synced 2025-04-26 13:44:35 +00:00
Updated to use the official toolchain provided by the Android NDK
This commit is contained in:
parent
081ee8424a
commit
5bb2cd683b
@ -119,6 +119,14 @@ macro(add_qt_android_apk TARGET SOURCE_TARGET)
|
||||
configure_file(${QT_ANDROID_SOURCE_DIR}/AndroidManifest.xml.in ${QT_ANDROID_APP_PACKAGE_SOURCE_ROOT}/AndroidManifest.xml @ONLY)
|
||||
endif()
|
||||
|
||||
# define the STL shared library path
|
||||
if(ANDROID_STL_SHARED_LIBRARIES)
|
||||
list(GET ANDROID_STL_SHARED_LIBRARIES 0 STL_LIBRARY_NAME) # we can only give one to androiddeployqt
|
||||
set(QT_ANDROID_STL_PATH "${ANDROID_STL_PATH}/libs/${ANDROID_ABI}/lib${STL_LIBRARY_NAME}.so")
|
||||
else()
|
||||
set(QT_ANDROID_STL_PATH)
|
||||
endif()
|
||||
|
||||
# set the list of dependant libraries
|
||||
if(ARG_DEPENDS)
|
||||
foreach(LIB ${ARG_DEPENDS})
|
||||
@ -140,6 +148,17 @@ macro(add_qt_android_apk TARGET SOURCE_TARGET)
|
||||
set(QT_ANDROID_APP_EXTRA_LIBS "\"android-extra-libs\": \"${EXTRA_LIBS}\",")
|
||||
endif()
|
||||
|
||||
# set some toolchain variables used by androiddeployqt;
|
||||
# unfortunately, Qt tries to build paths from these variables although these full paths
|
||||
# are already available in the toochain file, so we have to parse them
|
||||
string(REGEX MATCH "${ANDROID_NDK}/toolchains/(.*)-(.*)/prebuilt/.*" ANDROID_TOOLCHAIN_PARSED ${ANDROID_TOOLCHAIN_ROOT})
|
||||
if(ANDROID_TOOLCHAIN_PARSED)
|
||||
set(QT_ANDROID_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1})
|
||||
set(QT_ANDROID_TOOLCHAIN_VERSION ${CMAKE_MATCH_2})
|
||||
else()
|
||||
message(FATAL_ERROR "Failed to parse ANDROID_TOOLCHAIN_ROOT to get toolchain prefix and version")
|
||||
endif()
|
||||
|
||||
# make sure that the output directory for the Android package exists
|
||||
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/libs/${ANDROID_ABI})
|
||||
|
||||
@ -160,8 +179,8 @@ macro(add_qt_android_apk TARGET SOURCE_TARGET)
|
||||
endif()
|
||||
|
||||
# specify the Android API level
|
||||
if(ANDROID_NATIVE_API_LEVEL)
|
||||
set(TARGET_LEVEL_OPTIONS --android-platform android-${ANDROID_NATIVE_API_LEVEL})
|
||||
if(ANDROID_PLATFORM_LEVEL)
|
||||
set(TARGET_LEVEL_OPTIONS --android-platform android-${ANDROID_PLATFORM_LEVEL})
|
||||
endif()
|
||||
|
||||
# create a custom command that will run the androiddeployqt utility to prepare the Android package
|
||||
|
@ -1,7 +1,7 @@
|
||||
Qt Android CMake utility script
|
||||
-------------------------------
|
||||
|
||||
Copyright (c) 2015, Laurent Gomila (laurent.gom@gmail.com)
|
||||
Copyright (c) 2018, Laurent Gomila (laurent.gom@gmail.com)
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
@ -4,15 +4,16 @@
|
||||
"sdk": "@QT_ANDROID_SDK_ROOT@",
|
||||
"ndk": "@QT_ANDROID_NDK_ROOT@",
|
||||
"sdkBuildToolsRevision": "@QT_ANDROID_SDK_BUILDTOOLS_REVISION@",
|
||||
"toolchain-prefix": "@ANDROID_TOOLCHAIN_MACHINE_NAME@",
|
||||
"tool-prefix": "@ANDROID_TOOLCHAIN_MACHINE_NAME@",
|
||||
"toolchain-version": "@ANDROID_COMPILER_VERSION@",
|
||||
"toolchain-prefix": "@QT_ANDROID_TOOLCHAIN_PREFIX@",
|
||||
"tool-prefix": "@QT_ANDROID_TOOLCHAIN_PREFIX@",
|
||||
"toolchain-version": "@QT_ANDROID_TOOLCHAIN_VERSION@",
|
||||
"ndk-host": "@ANDROID_NDK_HOST_SYSTEM_NAME@",
|
||||
"target-architecture": "@ANDROID_ABI@",
|
||||
"application-binary": "@QT_ANDROID_APP_PATH@",
|
||||
"android-package": "@QT_ANDROID_APP_PACKAGE_NAME@",
|
||||
"android-app-name": "@QT_ANDROID_APP_NAME@",
|
||||
"qml-root-path": "@CMAKE_SOURCE_DIR@",
|
||||
"stdcpp-path": "@QT_ANDROID_STL_PATH@",
|
||||
@QT_ANDROID_APP_EXTRA_LIBS@
|
||||
"android-package-source-directory": "@QT_ANDROID_APP_PACKAGE_SOURCE_ROOT@"
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ When using Qt for Android development, QMake & QtCreator is the only sane option
|
||||
|
||||
This utility tries to avoids this by providing a CMake way of doing Android compilation and deployment, without QtCreator. It is based on:
|
||||
|
||||
* the Android CMake toolchain at https://github.com/taka-no-me/android-cmake
|
||||
* the Android CMake toolchains available in the NDK
|
||||
* the ```androiddeployqt``` utility from the Qt Android SDK
|
||||
* the QML / Android example at https://github.com/calincru/QML-Android-Demo
|
||||
|
||||
@ -65,8 +65,8 @@ You can then run CMake:.
|
||||
**On Windows**
|
||||
```
|
||||
cmake -G"MinGW Makefiles"
|
||||
-DCMAKE_TOOLCHAIN_FILE=<qt-android-cmake>/toolchain/android.toolchain.cmake
|
||||
-DCMAKE_MAKE_PROGRAM="%ANDROID_NDK%/prebuilt/windows/bin/make.exe" .
|
||||
-DCMAKE_TOOLCHAIN_FILE="%ANDROID_NDK%/build/cmake/android.toolchain.cmake"
|
||||
-DCMAKE_MAKE_PROGRAM="%ANDROID_NDK%/prebuilt/windows-x86_64/bin/make.exe" .
|
||||
```
|
||||
|
||||
**On Linux**
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user