Improve Android build

Use new features in qtutilities to prevent duplication of
version and other meta-info in manifest file.
This commit is contained in:
Martchus 2019-08-22 01:10:35 +02:00
parent 73748692b7
commit cddfebab8b
6 changed files with 18 additions and 9 deletions

View File

@ -12,10 +12,10 @@ set(META_APP_URL "https://github.com/${META_APP_AUTHOR}/${META_PROJECT_NAME}")
set(META_APP_DESCRIPTION "A simple password store using AES-256-CBC encryption via OpenSSL")
set(META_GUI_OPTIONAL YES)
set(META_USE_QQC2 ON)
set(META_ANDROID_PACKAGE_NAME "org.martchus.passwordmanager")
set(META_VERSION_MAJOR 4)
set(META_VERSION_MINOR 1)
set(META_VERSION_PATCH 0)
set(META_APP_VERSION ${META_VERSION_MAJOR}.${META_VERSION_MINOR}.${META_VERSION_PATCH})
set(PNG_ICON_NO_CROP ON)
# add project files

View File

@ -133,7 +133,7 @@ export PATH=/usr/lib/jvm/java-8-openjdk/jre/bin/:$PATH
# configure with the toolchain file provided by the Android NDK (still WIP)
# note: This configuration is likely required in the future to resolve https://gitlab.kitware.com/cmake/cmake/issues/18739. But for now
# better keep using CMake's internal Android support.
# better keep using CMake's internal Android support because this config has its own pitfalls (see CMAKE_CXX_FLAGS).
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DANDROID_ABI=$_android_arch \
@ -148,7 +148,7 @@ cmake \
-DCMAKE_INSTALL_PREFIX=$other_libs_root \
-DCMAKE_PREFIX_PATH="$root" \
-DCMAKE_FIND_ROOT_PATH="$root;$root/libs" \
-DCMAKE_CXX_FLAGS="-I/opt/android-ndk/sources/cxx-stl/llvm-libc++/include" \
-DCMAKE_CXX_FLAGS="-include $android_ndk_root/sysroot/usr/include/math.h -include $android_ndk_root/sources/cxx-stl/llvm-libc++/include/math.h -I$other_libs_include" \
-DBUILD_SHARED_LIBS=ON \
-DZLIB_LIBRARY="$android_ndk_root/platforms/android-$_android_api_level/arch-$_android_arch2/usr/lib/libz.so" \
-DCLANG_FORMAT_ENABLED=ON \
@ -165,6 +165,8 @@ cmake \
-DANDROID_APK_KEYSTORE_URL="$keystore_url" \
-DANDROID_APK_KEYSTORE_ALIAS="$keystore_alias" \
-DANDROID_APK_KEYSTORE_PASSWORD="$keystore_password" \
-DANDROID_APK_APPLICATION_ID_SUFFIX=".unstable" \
-DANDROID_APK_APPLICATION_LABEL="Password Manager (unstable)" \
$SOURCES/subdirs/$_reponame
# configure with CMake's internal Android support
@ -194,6 +196,8 @@ cmake \
-DANDROID_APK_KEYSTORE_URL="$keystore_url" \
-DANDROID_APK_KEYSTORE_ALIAS="$keystore_alias" \
-DANDROID_APK_KEYSTORE_PASSWORD="$keystore_password" \
-DANDROID_APK_APPLICATION_ID_SUFFIX=".unstable" \
-DANDROID_APK_APPLICATION_LABEL="Password Manager (unstable)" \
$SOURCES/subdirs/$_reponame
# build all binaries and make APK file using all CPU cores

View File

@ -1,5 +1,5 @@
<?xml version="1.0"?>
<manifest package="org.martchus.passwordmanager" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="4.1.0" android:versionCode="4" android:installLocation="auto">
<manifest package="@META_ANDROID_PACKAGE_NAME@" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="@META_APP_VERSION@" android:versionCode="@META_VERSION_MAJOR@" android:installLocation="auto">
<application
android:icon="@mipmap/ic_launcher"
android:name="org.qtproject.qt5.android.bindings.QtApplication"
@ -7,7 +7,7 @@
android:resizeableActivity="true">
<activity
android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation"
android:name="org.martchus.passwordmanager.Activity"
android:name="@META_ANDROID_PACKAGE_NAME@.Activity"
android:label="@string/app_name"
android:screenOrientation="unspecified"
android:theme="@style/AppTheme">

View File

@ -39,6 +39,11 @@ android {
buildToolsVersion androidBuildToolsVersion
defaultConfig {
applicationId "@META_ANDROID_PACKAGE_NAME@"
applicationIdSuffix "@ANDROID_APK_APPLICATION_ID_SUFFIX@"
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'

View File

@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">Password Manager</string>
</resources>

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">@ANDROID_APK_APPLICATION_LABEL@</string>
</resources>