mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-21 21:30:19 -06:00
Android: Allow building of native libraries inside Android Studio / Gradle
This commit is contained in:
@ -41,6 +41,10 @@ android {
|
||||
applicationIdSuffix ".debug"
|
||||
versionNameSuffix '-debug'
|
||||
jniDebuggable true
|
||||
|
||||
tasks.withType(JavaCompile) {
|
||||
compileTask -> compileTask.dependsOn(compileNative)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -58,3 +62,53 @@ dependencies {
|
||||
// For loading huge screenshots from the disk.
|
||||
compile 'com.squareup.picasso:picasso:2.5.2'
|
||||
}
|
||||
|
||||
task setupCMake(type: Exec) {
|
||||
// Check if a build properties file exists.
|
||||
def propsFile = rootProject.file("build.properties")
|
||||
|
||||
// If it does, call CMake.
|
||||
if (propsFile.canRead()) {
|
||||
// Read the properties file's contents.
|
||||
def buildProperties = new Properties()
|
||||
buildProperties.load(new FileInputStream(propsFile))
|
||||
|
||||
mkdir('build/' + buildProperties.abi)
|
||||
workingDir 'build/' + buildProperties.abi
|
||||
|
||||
executable 'cmake'
|
||||
|
||||
args "-DANDROID=true",
|
||||
"-DANDROID_NATIVE_API_LEVEL=android-18",
|
||||
"-DCMAKE_TOOLCHAIN_FILE=../../../android.toolchain.cmake",
|
||||
"../../../../..",
|
||||
"-DGIT_EXECUTABLE=" + buildProperties.gitPath,
|
||||
"-DANDROID_NDK=" + buildProperties.ndkPath,
|
||||
"-DANDROID_TOOLCHAIN_NAME=" + buildProperties.toolchain,
|
||||
"-DANDROID_ABI=" + buildProperties.abi
|
||||
} else {
|
||||
executable 'echo'
|
||||
args 'No build.properties found; skipping CMake.'
|
||||
}
|
||||
}
|
||||
|
||||
task compileNative(type: Exec, dependsOn: 'setupCMake') {
|
||||
// Check if a build properties file exists.
|
||||
def propsFile = rootProject.file("build.properties")
|
||||
|
||||
// If it does, call make.
|
||||
if (propsFile.canRead()) {
|
||||
// Read the properties file's contents.
|
||||
def buildProperties = new Properties()
|
||||
buildProperties.load(new FileInputStream(propsFile))
|
||||
|
||||
workingDir 'build/' + buildProperties.abi
|
||||
|
||||
executable 'make'
|
||||
|
||||
args buildProperties.makeArgs
|
||||
} else {
|
||||
executable 'echo'
|
||||
args 'No build.properties found; skipping native build.'
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user