Skip to content

Commit

Permalink
Fix building Android release versions
Browse files Browse the repository at this point in the history
With out -03 -flto=full android builds will fail with a message that
it's not possible wiht out O1 - O3
  • Loading branch information
AJenbo committed Jun 18, 2021
1 parent 019db81 commit 4e6870a
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 11 deletions.
11 changes: 1 addition & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
17 changes: 17 additions & 0 deletions android-project/CMake/android_defs.cmake
Original file line number Diff line number Diff line change
@@ -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")
2 changes: 1 addition & 1 deletion android-project/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ android {
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'
}
}
Expand Down

0 comments on commit 4e6870a

Please sign in to comment.