Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Android] Enable LTO #274

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Build for Android

# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
push:
branches: [ master, ci/android ]
pull_request:
branches: [ master, ci/android ]

jobs:
build:
runs-on: ubuntu-20.04

steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: 'recursive'

- name: Set up JDK 8
uses: actions/setup-java@v3
with:
java-version: 8
distribution: temurin

- name: Setup Android SDK
uses: android-actions/setup-android@7c5672355aaa8fde5f97a91aa9a99616d1ace6bc # v2

- uses: nttld/setup-ndk@8c3b609ff4d54576ea420551943fd34b4d03b0dc # v1
id: setup-ndk
with:
# Newer doesn't work with Qt 5.15: https://bugreports.qt.io/browse/QTBUG-104580
ndk-version: r21
add-to-path: false

- name: Install Qt
uses: jurplel/install-qt-action@43ec12788e42f375acfcb2cec059edfb9572fbaa # v3
with:
version: '5.15.2'
host: 'linux'
target: 'android'
arch: 'android'
cache: true

- name: Build firebird
env:
ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }}
ANDROID_NDK_ROOT: ${{ steps.setup-ndk.outputs.ndk-path }}
run: |
mkdir build
cd build
qmake .. ANDROID_ABIS="arm64-v8a armeabi-v7a"
make -j4 apk
mv android-build/build/outputs/apk/debug/android-build-debug.apk firebird-emu.apk

- name: Upload zip
uses: actions/upload-artifact@v3
with:
name: firebird-emu-android
path: build/firebird-emu.apk
if-no-files-found: error
7 changes: 6 additions & 1 deletion firebird.pro
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,10 @@ QMAKE_CXXFLAGS_RELEASE = -O3 -DNDEBUG
# with Qt's -reduce-relocations option (QTBUG-86173).
# MinGW fails with
# lto1.exe: internal compiler error: in gen_subprogram_die, at dwarf2out.c:22668
!clang | !if(linux|freebsd): !win32: CONFIG += ltcg
# On 32bit ARM, Qt adds -Oz by default but that breaks LTO with NDK r21
# (https://github.com/android/ndk/issues/721). Can be worked around with
# CONFIG -= optimize size, but the resulting binary has random crashes.
if(android:contains(QT_ARCH, "arm64.*")) | if(linux:!clang): CONFIG += ltcg

# noexecstack is not supported by MinGW's as
!win32 {
Expand Down Expand Up @@ -137,6 +140,8 @@ else: DEFINES += NO_TRANSLATION
message("FB_ARCH: $$FB_ARCH")
message("TRANSLATION_ENABLED: $$TRANSLATION_ENABLED")
message("SUPPORT_LINUX: $$SUPPORT_LINUX")
ltcg: message("LTCG: true")
else: message("LTCG: false")

equals(SUPPORT_LINUX, true) {
DEFINES += SUPPORT_LINUX
Expand Down