mirror of
https://github.com/QuasarApp/qt-android-cmake.git
synced 2025-05-06 02:09:36 +00:00
Support build with Qt5.14, 5.15 with new qtandroiddeploy config file. Fix issue #35.
This commit is contained in:
parent
250fdb2caa
commit
6c56d64715
@ -71,6 +71,16 @@ macro(add_qt_android_apk TARGET SOURCE_TARGET)
|
|||||||
|
|
||||||
# extract the full path of the source target binary
|
# extract the full path of the source target binary
|
||||||
set(QT_ANDROID_APP_PATH "$<TARGET_FILE:${SOURCE_TARGET}>") # full file path to the app's main shared library
|
set(QT_ANDROID_APP_PATH "$<TARGET_FILE:${SOURCE_TARGET}>") # full file path to the app's main shared library
|
||||||
|
if(${Qt5Core_VERSION} VERSION_GREATER_EQUAL 5.14)
|
||||||
|
set(QT_ANDROID_SUPPORT_MULTI_ABI ON)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(QT_ANDROID_SUPPORT_MULTI_ABI)
|
||||||
|
# qtandroideploy will append by itself the ANDROID_ABI to the target name
|
||||||
|
set(QT_ANDROID_APPLICATION_BINARY "${SOURCE_TARGET}")
|
||||||
|
else()
|
||||||
|
set(QT_ANDROID_APPLICATION_BINARY ${QT_ANDROID_APP_PATH})
|
||||||
|
endif()
|
||||||
|
|
||||||
# define the application name
|
# define the application name
|
||||||
if(ARG_NAME)
|
if(ARG_NAME)
|
||||||
@ -155,22 +165,35 @@ macro(add_qt_android_apk TARGET SOURCE_TARGET)
|
|||||||
message(WARNING "Failed to determine ANDROID_STL_PREFIX value for ANDROID_STL=${ANDROID_STL}")
|
message(WARNING "Failed to determine ANDROID_STL_PREFIX value for ANDROID_STL=${ANDROID_STL}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# define the STL shared library path
|
if(QT_ANDROID_SUPPORT_MULTI_ABI)
|
||||||
# up until NDK r18, ANDROID_STL_SHARED_LIBRARIES is populated by the NDK's toolchain file
|
# from Qt 5.14 qtandroideploy will find the correct stl.
|
||||||
# since NDK r19, the only option for a shared STL library is libc++_shared
|
set(QT_ANDROID_STL_PATH "${QT_ANDROID_NDK_ROOT}/sources/cxx-stl/${ANDROID_STL_PREFIX}/libs")
|
||||||
if(ANDROID_STL_SHARED_LIBRARIES)
|
|
||||||
list(GET ANDROID_STL_SHARED_LIBRARIES 0 STL_LIBRARY_NAME) # we can only give one to androiddeployqt
|
|
||||||
if(ANDROID_STL_PATH)
|
|
||||||
set(QT_ANDROID_STL_PATH "${ANDROID_STL_PATH}/libs/${ANDROID_ABI}/lib${ANDROID_STL}.so")
|
|
||||||
else()
|
|
||||||
set(QT_ANDROID_STL_PATH "${QT_ANDROID_NDK_ROOT}/sources/cxx-stl/${ANDROID_STL_PREFIX}/libs/${ANDROID_ABI}/lib${ANDROID_STL}.so")
|
|
||||||
endif()
|
|
||||||
elseif(ANDROID_STL STREQUAL c++_shared)
|
|
||||||
set(QT_ANDROID_STL_PATH "${QT_ANDROID_NDK_ROOT}/sources/cxx-stl/${ANDROID_STL_PREFIX}/libs/${ANDROID_ABI}/libc++_shared.so")
|
|
||||||
else()
|
else()
|
||||||
message(WARNING "ANDROID_STL (${ANDROID_STL}) isn't a known shared stl library."
|
# define the STL shared library path
|
||||||
"You should consider setting ANDROID_STL to c++_shared (like Qt).")
|
# up until NDK r18, ANDROID_STL_SHARED_LIBRARIES is populated by the NDK's toolchain file
|
||||||
set(QT_ANDROID_STL_PATH "${QT_ANDROID_NDK_ROOT}/sources/cxx-stl/${ANDROID_STL_PREFIX}/libs/${ANDROID_ABI}/libc++_shared.so")
|
# since NDK r19, the only option for a shared STL library is libc++_shared
|
||||||
|
if(ANDROID_STL_SHARED_LIBRARIES)
|
||||||
|
list(GET ANDROID_STL_SHARED_LIBRARIES 0 STL_LIBRARY_NAME) # we can only give one to androiddeployqt
|
||||||
|
if(ANDROID_STL_PATH)
|
||||||
|
set(QT_ANDROID_STL_PATH "${ANDROID_STL_PATH}/libs/${ANDROID_ABI}/lib${ANDROID_STL}.so")
|
||||||
|
else()
|
||||||
|
set(QT_ANDROID_STL_PATH "${QT_ANDROID_NDK_ROOT}/sources/cxx-stl/${ANDROID_STL_PREFIX}/libs/${ANDROID_ABI}/lib${ANDROID_STL}.so")
|
||||||
|
endif()
|
||||||
|
elseif(ANDROID_STL STREQUAL c++_shared)
|
||||||
|
set(QT_ANDROID_STL_PATH "${QT_ANDROID_NDK_ROOT}/sources/cxx-stl/${ANDROID_STL_PREFIX}/libs/${ANDROID_ABI}/libc++_shared.so")
|
||||||
|
else()
|
||||||
|
message(WARNING "ANDROID_STL (${ANDROID_STL}) isn't a known shared stl library."
|
||||||
|
"You should consider setting ANDROID_STL to c++_shared (like Qt).")
|
||||||
|
set(QT_ANDROID_STL_PATH "${QT_ANDROID_NDK_ROOT}/sources/cxx-stl/${ANDROID_STL_PREFIX}/libs/${ANDROID_ABI}/libc++_shared.so")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# From Qt 5.14 qtandroideploy "target-architecture" is no longer valid in input file
|
||||||
|
# It have been replaced by "architectures": { "${ANDROID_ABI}": "${ANDROID_ABI}" }
|
||||||
|
# This allow to package multiple ABI in a single apk
|
||||||
|
# For now we only support single ABI build with this script (to ensure it work with Qt5.14 & Qt5.15)
|
||||||
|
if(QT_ANDROID_SUPPORT_MULTI_ABI)
|
||||||
|
set(QT_ANDROID_ARCHITECTURES "\"${ANDROID_ABI}\":\"${ANDROID_ABI}\"")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# set the list of dependant libraries
|
# set the list of dependant libraries
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
android:installLocation="auto"
|
android:installLocation="auto"
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:versionCode="@QT_ANDROID_APP_VERSION_CODE@">
|
android:versionCode="@QT_ANDROID_APP_VERSION_CODE@">
|
||||||
|
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="28"/>
|
||||||
<application
|
<application
|
||||||
android:label="@QT_ANDROID_APP_NAME@"
|
android:label="@QT_ANDROID_APP_NAME@"
|
||||||
android:name="org.qtproject.qt5.android.bindings.QtApplication">
|
android:name="org.qtproject.qt5.android.bindings.QtApplication">
|
||||||
@ -18,6 +19,10 @@
|
|||||||
<category android:name="android.intent.category.LAUNCHER"/>
|
<category android:name="android.intent.category.LAUNCHER"/>
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
|
|
||||||
|
<!-- Application arguments -->
|
||||||
|
<!-- meta-data android:name="android.app.arguments" android:value="arg1 arg2 arg3"/ -->
|
||||||
|
<!-- Application arguments -->
|
||||||
|
|
||||||
<meta-data android:name="android.app.lib_name" android:value="-- %%INSERT_APP_LIB_NAME%% --"/>
|
<meta-data android:name="android.app.lib_name" android:value="-- %%INSERT_APP_LIB_NAME%% --"/>
|
||||||
<meta-data android:name="android.app.qt_sources_resource_id" android:resource="@array/qt_sources"/>
|
<meta-data android:name="android.app.qt_sources_resource_id" android:resource="@array/qt_sources"/>
|
||||||
<meta-data android:name="android.app.repository" android:value="default"/>
|
<meta-data android:name="android.app.repository" android:value="default"/>
|
||||||
@ -25,17 +30,21 @@
|
|||||||
<meta-data android:name="android.app.bundled_libs_resource_id" android:resource="@array/bundled_libs"/>
|
<meta-data android:name="android.app.bundled_libs_resource_id" android:resource="@array/bundled_libs"/>
|
||||||
<!-- Deploy Qt libs as part of package -->
|
<!-- Deploy Qt libs as part of package -->
|
||||||
<meta-data android:name="android.app.bundle_local_qt_libs" android:value="-- %%BUNDLE_LOCAL_QT_LIBS%% --"/>
|
<meta-data android:name="android.app.bundle_local_qt_libs" android:value="-- %%BUNDLE_LOCAL_QT_LIBS%% --"/>
|
||||||
<meta-data android:name="android.app.bundled_in_lib_resource_id" android:resource="@array/bundled_in_lib"/>
|
|
||||||
<meta-data android:name="android.app.bundled_in_assets_resource_id" android:resource="@array/bundled_in_assets"/>
|
|
||||||
<!-- Run with local libs -->
|
<!-- Run with local libs -->
|
||||||
<meta-data android:name="android.app.use_local_qt_libs" android:value="-- %%USE_LOCAL_QT_LIBS%% --"/>
|
<meta-data android:name="android.app.use_local_qt_libs" android:value="-- %%USE_LOCAL_QT_LIBS%% --"/>
|
||||||
<meta-data android:name="android.app.libs_prefix" android:value="/data/local/tmp/qt/"/>
|
<meta-data android:name="android.app.libs_prefix" android:value="/data/local/tmp/qt/"/>
|
||||||
<meta-data android:name="android.app.load_local_libs" android:value="-- %%INSERT_LOCAL_LIBS%% --"/>
|
<meta-data android:name="android.app.load_local_libs_resource_id" android:resource="@array/load_local_libs"/>
|
||||||
<meta-data android:name="android.app.load_local_jars" android:value="-- %%INSERT_LOCAL_JARS%% --"/>
|
<meta-data android:name="android.app.load_local_jars" android:value="-- %%INSERT_LOCAL_JARS%% --"/>
|
||||||
<meta-data android:name="android.app.static_init_classes" android:value="-- %%INSERT_INIT_CLASSES%% --"/>
|
<meta-data android:name="android.app.static_init_classes" android:value="-- %%INSERT_INIT_CLASSES%% --"/>
|
||||||
<!-- Used to specify custom system library path to run with local system libs -->
|
<!-- Used to specify custom system library path to run with local system libs -->
|
||||||
<!-- <meta-data android:name="android.app.system_libs_prefix" android:value="/system/lib/"/> -->
|
<!-- <meta-data android:name="android.app.system_libs_prefix" android:value="/system/lib/"/> -->
|
||||||
<!-- Messages maps -->
|
<!-- Messages maps -->
|
||||||
|
<meta-data android:value="@string/ministro_not_found_msg" android:name="android.app.ministro_not_found_msg"/>
|
||||||
|
<meta-data android:value="@string/ministro_needed_msg" android:name="android.app.ministro_needed_msg"/>
|
||||||
|
<meta-data android:value="@string/fatal_error_msg" android:name="android.app.fatal_error_msg"/>
|
||||||
|
<meta-data android:value="@string/unsupported_android_version" android:name="android.app.unsupported_android_version"/>
|
||||||
|
<!-- Messages maps -->
|
||||||
|
|
||||||
<!-- Splash screen -->
|
<!-- Splash screen -->
|
||||||
<!-- meta-data android:name="android.app.splash_screen_drawable" android:resource="@drawable/logo"/ -->
|
<!-- meta-data android:name="android.app.splash_screen_drawable" android:resource="@drawable/logo"/ -->
|
||||||
|
@ -54,8 +54,13 @@ android {
|
|||||||
lintOptions {
|
lintOptions {
|
||||||
abortOnError false
|
abortOnError false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Do not compress Qt binary resources file
|
||||||
|
aaptOptions {
|
||||||
|
noCompress 'rcc'
|
||||||
|
}
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdkVersion 16
|
resConfigs "en"
|
||||||
targetSdkVersion @QT_ANDROID_NATIVE_API_LEVEL@
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,8 +8,11 @@
|
|||||||
"tool-prefix": "@QT_ANDROID_TOOL_PREFIX@",
|
"tool-prefix": "@QT_ANDROID_TOOL_PREFIX@",
|
||||||
"toolchain-version": "@QT_ANDROID_TOOLCHAIN_VERSION@",
|
"toolchain-version": "@QT_ANDROID_TOOLCHAIN_VERSION@",
|
||||||
"ndk-host": "@ANDROID_NDK_HOST_SYSTEM_NAME@",
|
"ndk-host": "@ANDROID_NDK_HOST_SYSTEM_NAME@",
|
||||||
|
"architectures": {
|
||||||
|
@QT_ANDROID_ARCHITECTURES@
|
||||||
|
},
|
||||||
"target-architecture": "@ANDROID_ABI@",
|
"target-architecture": "@ANDROID_ABI@",
|
||||||
"application-binary": "@QT_ANDROID_APP_PATH@",
|
"application-binary": "@QT_ANDROID_APPLICATION_BINARY@",
|
||||||
"android-package": "@QT_ANDROID_APP_PACKAGE_NAME@",
|
"android-package": "@QT_ANDROID_APP_PACKAGE_NAME@",
|
||||||
"android-app-name": "@QT_ANDROID_APP_NAME@",
|
"android-app-name": "@QT_ANDROID_APP_NAME@",
|
||||||
"qml-root-path": "@CMAKE_SOURCE_DIR@",
|
"qml-root-path": "@CMAKE_SOURCE_DIR@",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user