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

apk optimisations #1

Closed
wants to merge 12 commits into from
Closed
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
56 changes: 39 additions & 17 deletions .github/workflows/Android_Build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,19 @@ on:
- master
pull_request:

env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release

jobs:
x64:
runs-on: ubuntu-latest

strategy:
matrix:
build_type:
- release

steps:
- name: Set BUILD_TYPE variable
run: echo "BUILD_TYPE=${{ matrix.build_type }}" >> $GITHUB_ENV

- uses: actions/checkout@v2
- name: Fetch submodules
run: git submodule update --init --recursive
Expand All @@ -29,31 +33,44 @@ jobs:
- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: 'zulu' # See 'Supported distributions' for available options
distribution: 'zulu'
java-version: '17'

- name: Configure CMake
run: cmake -B ${{github.workspace}}/build -DBUILD_HYDRA_CORE=1 -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_TOOLCHAIN_FILE=${ANDROID_NDK_ROOT}/build/cmake/android.toolchain.cmake -DANDROID_ABI=x86_64 -DENABLE_VULKAN=0 -DENABLE_USER_BUILD=ON

- name: Build
run: |
# Apply patch for GLES compatibility
git apply ./.github/gles.patch
cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
# Build the project with CMake
cmake --build ${{github.workspace}}/build --config ${{ env.BUILD_TYPE }}
# Move the generated library to the appropriate location
mv ./build/libAlber.so ./src/pandroid/app/src/main/jniLibs/x86_64/
# Build the Android app with Gradle
cd src/pandroid
./gradlew assembleDebug
./gradlew assemble${{ env.BUILD_TYPE }}
cd ../..

- name: Upload executable
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: Android APK (x86-64)
path: './src/pandroid/app/build/outputs/apk/debug/app-debug.apk'
name: Android APKs (x86-64)
path: |
./src/pandroid/app/build/outputs/apk/${{ env.BUILD_TYPE }}/app-${{ env.BUILD_TYPE }}.apk

arm64:
runs-on: ubuntu-latest

strategy:
matrix:
build_type:
- release

steps:
- name: Set BUILD_TYPE variable
run: echo "BUILD_TYPE=${{ matrix.build_type }}" >> $GITHUB_ENV

- uses: actions/checkout@v2
- name: Fetch submodules
run: git submodule update --init --recursive
Expand All @@ -68,24 +85,29 @@ jobs:
- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: 'zulu' # See 'Supported distributions' for available options
distribution: 'zulu'
java-version: '17'

- name: Configure CMake
run: cmake -B ${{github.workspace}}/build -DBUILD_HYDRA_CORE=1 -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_TOOLCHAIN_FILE=${ANDROID_NDK_ROOT}/build/cmake/android.toolchain.cmake -DANDROID_ABI=arm64-v8a -DENABLE_VULKAN=0 -DENABLE_USER_BUILD=ON -DCMAKE_CXX_FLAGS="-march=armv8-a+crypto"

- name: Build
run: |
# Apply patch for GLES compatibility
git apply ./.github/gles.patch
cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
# Build the project with CMake
cmake --build ${{github.workspace}}/build --config ${{ env.BUILD_TYPE }}
# Move the generated library to the appropriate location
mv ./build/libAlber.so ./src/pandroid/app/src/main/jniLibs/arm64-v8a/
# Build the Android app with Gradle
cd src/pandroid
./gradlew assembleDebug
./gradlew assemble${{ env.BUILD_TYPE }}
ls -R app/build/outputs
cd ../..

- name: Upload executable
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: Android APK (arm64)
path: './src/pandroid/app/build/outputs/apk/debug/app-debug.apk'

name: Android APKs (arm64)
path: |
./src/pandroid/app/build/outputs/apk/${{ env.BUILD_TYPE }}/app-${{ env.BUILD_TYPE }}.apk
16 changes: 14 additions & 2 deletions src/pandroid/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,20 @@ android {
}

buildTypes {
release {
getByName("release") {
isMinifyEnabled = false
isShrinkResources = false
isDebuggable = false
signingConfig = signingConfigs.getByName("debug")
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
}
getByName("debug") {
isMinifyEnabled = false
isShrinkResources = false
isDebuggable = true
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
Expand All @@ -41,4 +53,4 @@ dependencies {
implementation("androidx.preference:preference:1.2.1")
implementation("androidx.constraintlayout:constraintlayout:2.1.4")
implementation("com.google.code.gson:gson:2.10.1")
}
}
2 changes: 2 additions & 0 deletions src/pandroid/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:isGame="true"
android:hardwareAccelerated="true"
android:theme="@style/Theme.Pandroid"
tools:targetApi="31">
<activity
Expand Down
Loading