mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-02-13 07:49:19 +01:00
Android: Allow git and cmake locations to be overridden
This commit is contained in:
parent
fff657a7da
commit
7e36166374
@ -101,13 +101,13 @@ task setupCMake(type: Exec) {
|
|||||||
mkdir('build/' + abi)
|
mkdir('build/' + abi)
|
||||||
workingDir 'build/' + abi
|
workingDir 'build/' + abi
|
||||||
|
|
||||||
executable 'cmake'
|
executable getExecutablePath("cmake")
|
||||||
|
|
||||||
args "-DANDROID=true",
|
args "-DANDROID=true",
|
||||||
"-DANDROID_NATIVE_API_LEVEL=android-18",
|
"-DANDROID_NATIVE_API_LEVEL=android-18",
|
||||||
"-DCMAKE_TOOLCHAIN_FILE=../../../android.toolchain.cmake",
|
"-DCMAKE_TOOLCHAIN_FILE=../../../android.toolchain.cmake",
|
||||||
"../../../../..",
|
"../../../../..",
|
||||||
"-DGIT_EXECUTABLE=" + getGitPath(),
|
"-DGIT_EXECUTABLE=" + getExecutablePath("git"),
|
||||||
"-DANDROID_NDK=" + getNdkPath(),
|
"-DANDROID_NDK=" + getNdkPath(),
|
||||||
"-DANDROID_TOOLCHAIN_NAME=" + getToolchainName(),
|
"-DANDROID_TOOLCHAIN_NAME=" + getToolchainName(),
|
||||||
"-DANDROID_ABI=" + abi
|
"-DANDROID_ABI=" + abi
|
||||||
@ -140,24 +140,33 @@ task compileNative(type: Exec, dependsOn: 'setupCMake') {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String getGitPath() {
|
String getExecutablePath(String command) {
|
||||||
try {
|
def propsFile = rootProject.file("build.properties")
|
||||||
def stdout = new ByteArrayOutputStream()
|
def path = null
|
||||||
|
if (propsFile.canRead()) {
|
||||||
exec {
|
def buildProperties = new Properties()
|
||||||
commandLine 'which', 'git'
|
buildProperties.load(new FileInputStream(propsFile))
|
||||||
standardOutput = stdout
|
println buildProperties
|
||||||
}
|
path = buildProperties[command + "Path"]
|
||||||
|
|
||||||
def gitPath = stdout.toString().trim()
|
|
||||||
project.logger.quiet("Gradle: Found git executuable:" + gitPath)
|
|
||||||
|
|
||||||
return gitPath
|
|
||||||
} catch (ignored) {
|
|
||||||
// Shouldn't happen. How did the user get this file without git?
|
|
||||||
project.logger.error("Gradle error: Couldn't find git executable.")
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
if (path == null) {
|
||||||
|
try {
|
||||||
|
def stdout = new ByteArrayOutputStream()
|
||||||
|
|
||||||
|
exec {
|
||||||
|
commandLine 'which', command
|
||||||
|
standardOutput = stdout
|
||||||
|
}
|
||||||
|
|
||||||
|
path = stdout.toString().trim()
|
||||||
|
} catch (ignored) {
|
||||||
|
project.logger.error("Gradle error: Couldn't find " + command + " executable.")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (path != null) {
|
||||||
|
project.logger.quiet("Gradle: Found " + command + " executuable:" + path)
|
||||||
|
}
|
||||||
|
return path
|
||||||
}
|
}
|
||||||
|
|
||||||
String getNdkPath() {
|
String getNdkPath() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user