From 43c6f7f4a164f50d60c6edfe4248f8fae905a77b Mon Sep 17 00:00:00 2001 From: PeterPetrik Date: Wed, 13 Sep 2023 18:05:39 +0200 Subject: [PATCH] make stripDebugDebugSymbols work add debug symbols to aab --- .gitignore | 1 + CMakeLists.txt | 19 ++++++++++++++----- app/CMakeLists.txt | 11 ++++++++++- .../build.gradle.in | 12 ++++++++++-- 4 files changed, 35 insertions(+), 8 deletions(-) rename app/android/build.gradle => cmake_templates/build.gradle.in (88%) diff --git a/.gitignore b/.gitignore index 817be4f1c..4df5908e1 100644 --- a/.gitignore +++ b/.gitignore @@ -17,5 +17,6 @@ app/android/AndroidManifest.xml *.gpkg-shm Input_keystore.keystore CMakeLists.txt.user +app/android/build.gradle app/android/.gradle/* app/android/.gradle diff --git a/CMakeLists.txt b/CMakeLists.txt index e72af5b2e..62fdbc8cf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,6 +24,10 @@ if (DEFINED ENV{INPUT_SDK_ANDROID_BASE}) # Target/Minimum API levels for Android, used as Input target properties set(INPUT_ANDROID_TARGET_SDK_VERSION "33") set(INPUT_ANDROID_MIN_SDK_VERSION "${ANDROIDAPI}") + set(INPUT_ANDROID_NDK_PATH "$ENV{ANDROID_NDK_ROOT}") + if (NOT INPUT_ANDROID_NDK_PATH) + message(FATAL_ERROR "Set required environment variable ANDROID_NDK_ROOT.") + endif () endif () if (IOS) @@ -173,7 +177,16 @@ message(STATUS "Mergin Maps Input ${version_desc} - ${platform_desc}") if (ANDROID) set(INPUT_SDK_PATH_ANDROID_ABI_armeabi-v7a ${INPUT_SDK_PATH}/arm-android) + + if (NOT EXISTS ${INPUT_SDK_PATH_ANDROID_ABI_armeabi-v7a}) + message(WARNING "INPUT_SDK_PATH arm-android directory does not exist!") + endif () + set(INPUT_SDK_PATH_ANDROID_ABI_arm64-v8a ${INPUT_SDK_PATH}/arm64-android) + if (NOT EXISTS ${INPUT_SDK_PATH_ANDROID_ABI_arm64-v8a}) + message(WARNING "INPUT_SDK_PATH arm64-android directory does not exist!") + endif () + set(INPUT_SDK_PATH_MULTI ${INPUT_SDK_PATH_ANDROID_ABI_${ANDROID_ABI}}) # allow libraries outside of SDK/NDK directory set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY BOTH) @@ -215,7 +228,7 @@ if (NOT IOS) ) endif () -if (NOT LINUX) +if (NOT LNX) find_package(Charset REQUIRED) find_package(Iconv REQUIRED) endif () @@ -376,10 +389,6 @@ if (IOS) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-shorten-64-to-32") endif () -if (ANDROID) - set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -g0") -endif () - # ######################################################################################## # SUBDIRECTORIES # ######################################################################################## diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt index 3df7d0c5b..fc9a1a0fe 100644 --- a/app/CMakeLists.txt +++ b/app/CMakeLists.txt @@ -297,6 +297,15 @@ if (ANDROID) ${INPUT_CMAKE_TEMPLATES_PATH}/AndroidManifest.xml.in ${CMAKE_CURRENT_SOURCE_DIR}/android/AndroidManifest.xml @ONLY ) + + if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/android/build.gradle) + file(REMOVE ${CMAKE_CURRENT_SOURCE_DIR}/android/build.gradle) + endif () + configure_file( + ${INPUT_CMAKE_TEMPLATES_PATH}/build.gradle.in + ${CMAKE_CURRENT_SOURCE_DIR}/android/build.gradle @ONLY + ) + set_target_properties( Input PROPERTIES QT_ANDROID_PACKAGE_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/android @@ -471,7 +480,7 @@ target_link_libraries( Spatialite::Spatialite ) -if (NOT LINUX) +if (NOT LNX) target_link_libraries(Input PUBLIC Charset::Charset Iconv::Iconv) endif () diff --git a/app/android/build.gradle b/cmake_templates/build.gradle.in similarity index 88% rename from app/android/build.gradle rename to cmake_templates/build.gradle.in index 0a169d6d6..9e5d7a331 100644 --- a/app/android/build.gradle +++ b/cmake_templates/build.gradle.in @@ -1,6 +1,13 @@ /* keep in sync with /opt/Qt//android//src/android/templates/build.gradle */ buildscript { + ext { + buildToolsVersion = androidBuildToolsVersion + compileSdkVersion = androidCompileSdkVersion.toInteger() + targetSdkVersion = androidCompileSdkVersion.toInteger() + ndkVersion = androidNdkVersion + } + repositories { google() mavenCentral() @@ -44,7 +51,8 @@ android { compileSdkVersion androidCompileSdkVersion.toInteger() buildToolsVersion androidBuildToolsVersion ndkVersion androidNdkVersion - + ndkPath '@INPUT_ANDROID_NDK_PATH@' + packagingOptions.jniLibs.useLegacyPackaging true sourceSets { @@ -83,6 +91,6 @@ android { minSdkVersion qtMinSdkVersion targetSdkVersion qtTargetSdkVersion ndk.abiFilters = qtTargetAbiList.split(",") - ndk.debugSymbolLevel "FULL" + ndk.debugSymbolLevel "SYMBOL_TABLE" } }