diff --git a/CMakeLists.txt b/CMakeLists.txt index ab62796de81..62974f6a6a3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -189,16 +189,7 @@ endif() if(ANDROID) list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/android-project/CMake") - - set(ASAN OFF) - set(UBSAN OFF) - set(DEVILUTIONX_SYSTEM_LIBSODIUM OFF) - set(DISABLE_ZERO_TIER ON) - set(TTF_FONT_DIR \"\") - - file( - COPY "${DevilutionX_SOURCE_DIR}/Packaging/resources/CharisSILB.ttf" - DESTINATION "${DevilutionX_SOURCE_DIR}/android-project/app/src/main/assets") + include(android_defs) endif() if(PIE) diff --git a/android-project/CMake/android_defs.cmake b/android-project/CMake/android_defs.cmake new file mode 100644 index 00000000000..ee7c52c903c --- /dev/null +++ b/android-project/CMake/android_defs.cmake @@ -0,0 +1,17 @@ +#General compilation options +set(ASAN OFF) +set(UBSAN OFF) +set(DEVILUTIONX_SYSTEM_LIBSODIUM OFF) +set(DISABLE_ZERO_TIER ON) + +if(BINARY_RELEASE OR CMAKE_BUILD_TYPE STREQUAL "Release") + # Workaroudn linker bug in CLang: https://github.com/android/ndk/issues/721 + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3 -flto=full") +endif() + +#additional compilation definitions +set(TTF_FONT_DIR \"\") + +file( + COPY "${DevilutionX_SOURCE_DIR}/Packaging/resources/CharisSILB.ttf" + DESTINATION "${DevilutionX_SOURCE_DIR}/android-project/app/src/main/assets") diff --git a/android-project/app/build.gradle b/android-project/app/build.gradle index 871647e5054..033e93d643b 100644 --- a/android-project/app/build.gradle +++ b/android-project/app/build.gradle @@ -8,7 +8,7 @@ else { } android { - compileSdkVersion 28 + compileSdkVersion 29 aaptOptions { noCompress 'mpq' } @@ -17,12 +17,12 @@ android { applicationId "org.diasurgical.devilutionx" } minSdkVersion 21 - targetSdkVersion 28 + targetSdkVersion 29 versionCode 18 versionName "1.2.1" externalNativeBuild { cmake { - arguments "-DANDROID_APP_PLATFORM=android-21", "-DANDROID_STL=c++_static" + arguments "-DANDROID_STL=c++_static" abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64' } } @@ -43,9 +43,9 @@ android { version "3.13.0+" } } - + } - + if (buildAsLibrary) { libraryVariants.all { variant -> variant.outputs.each { output -> diff --git a/android-project/app/src/main/AndroidManifest.xml b/android-project/app/src/main/AndroidManifest.xml index ff209fae38b..e672d774382 100644 --- a/android-project/app/src/main/AndroidManifest.xml +++ b/android-project/app/src/main/AndroidManifest.xml @@ -39,12 +39,13 @@ + android:hardwareAccelerated="true" + android:requestLegacyExternalStorage="true"> - +