Merge pull request #105 from scribam/cmake-android

Use CMake for Android build and add GitHub CI
This commit is contained in:
flyinghead 2020-08-16 11:00:15 +02:00 committed by GitHub
commit 0942032f3c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 48 additions and 8 deletions

33
.github/workflows/android.yml vendored Normal file
View File

@ -0,0 +1,33 @@
name: Android CI
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Set up build environment
run: echo "y" | sudo ${ANDROID_HOME}/tools/bin/sdkmanager --install "ndk;20.0.5594570"
- uses: actions/checkout@v2
with:
fetch-depth: 0
- run: git fetch origin +refs/tags/*:refs/tags/*
- uses: actions/cache@v1
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Gradle
working-directory: shell/android-studio
run: ./gradlew assembleDreamcastDebug --parallel
- uses: actions/upload-artifact@v2
with:
name: reicast-dreamcast-debug.apk
path: shell/android-studio/reicast/build/outputs/apk/dreamcast/debug/reicast-dreamcast-debug.apk

View File

@ -35,8 +35,14 @@ android {
versionName getVersionName()
vectorDrawables.useSupportLibrary = true
externalNativeBuild {
cmake {
arguments '-DANDROID_ARM_MODE=arm'
}
}
ndk {
moduleName "dc"
moduleName 'flycast'
abiFilters 'armeabi-v7a', 'arm64-v8a'
}
}
@ -72,13 +78,14 @@ android {
flavorDimensions "systemtype"
productFlavors {
dreamcast {
externalNativeBuild { ndkBuild { arguments ("-j" + Runtime.runtime.availableProcessors()) } }
}
}
externalNativeBuild {
ndkBuild {
path 'src/main/jni/Android.mk'
cmake {
version '3.10.2+'
path '../../../CMakeLists.txt'
}
}

View File

@ -9,7 +9,7 @@ import android.util.Log;
import static android.media.AudioTrack.STATE_INITIALIZED;
public final class AudioBackend {
static { System.loadLibrary("dc"); }
static { System.loadLibrary("flycast"); }
private AudioTrack audioTrack;
private long writePosition;

View File

@ -7,7 +7,7 @@ import com.reicast.emulator.periph.SipEmulator;
public final class JNIdc
{
static { System.loadLibrary("dc"); }
static { System.loadLibrary("flycast"); }
public static native String initEnvironment(Emulator emulator, String homeDirectory);
public static native void setExternalStorageDirectories(Object[] pathList);

View File

@ -10,7 +10,7 @@ import com.reicast.emulator.Emulator;
public final class InputDeviceManager implements InputManager.InputDeviceListener {
public static final int VIRTUAL_GAMEPAD_ID = 0x12345678;
static { System.loadLibrary("dc"); }
static { System.loadLibrary("flycast"); }
private static final InputDeviceManager INSTANCE = new InputDeviceManager();
private InputManager inputManager;
private int maple_port = 0;

View File

@ -90,7 +90,7 @@ LOCAL_CPP_FEATURES :=
# LOCAL_SHARED_LIBRARIES:= libcutils libutils
LOCAL_PRELINK_MODULE := false
LOCAL_MODULE := dc
LOCAL_MODULE := flycast
LOCAL_DISABLE_FORMAT_STRING_CHECKS=true
LOCAL_ASFLAGS := -fPIC -fvisibility=hidden
LOCAL_LDLIBS := -llog -lEGL -lz -landroid