From 140826edd5ab0411743a86dd2a382d7631ec943d Mon Sep 17 00:00:00 2001 From: Eder Bastos Date: Fri, 22 May 2015 17:13:25 -0400 Subject: Android: Have build.gradle figure out what ABI and Toolchain to use. --- Source/Android/app/build.gradle | 61 +++++++++++++++++++++++++++++++++++------ 1 file changed, 53 insertions(+), 8 deletions(-) (limited to 'Source/Android') diff --git a/Source/Android/app/build.gradle b/Source/Android/app/build.gradle index f87c2b5319..bf1d999706 100644 --- a/Source/Android/app/build.gradle +++ b/Source/Android/app/build.gradle @@ -69,13 +69,12 @@ android { } } - // TODO Uncomment this when we successfully build for x86_64. - /*x86_64 { + x86_64 { flavorDimension "abi" ndk { abiFilter "x86_64" } - }*/ + } } } @@ -103,8 +102,10 @@ task setupCMake(type: Exec) { def buildProperties = new Properties() buildProperties.load(new FileInputStream(propsFile)) - mkdir('build/' + buildProperties.abi) - workingDir 'build/' + buildProperties.abi + String abi = getAbi() + + mkdir('build/' + abi) + workingDir 'build/' + abi executable 'cmake' @@ -114,8 +115,8 @@ task setupCMake(type: Exec) { "../../../../..", "-DGIT_EXECUTABLE=" + getGitPath(), "-DANDROID_NDK=" + getNdkPath(), - "-DANDROID_TOOLCHAIN_NAME=" + buildProperties.toolchain, - "-DANDROID_ABI=" + buildProperties.abi + "-DANDROID_TOOLCHAIN_NAME=" + getToolchainName(), + "-DANDROID_ABI=" + abi } else { executable 'echo' args 'No build.properties found; skipping CMake.' @@ -132,7 +133,9 @@ task compileNative(type: Exec, dependsOn: 'setupCMake') { def buildProperties = new Properties() buildProperties.load(new FileInputStream(propsFile)) - workingDir 'build/' + buildProperties.abi + String abi = getAbi() + + workingDir 'build/' + abi executable 'make' @@ -183,4 +186,46 @@ String getNdkPath() { project.logger.error("Gradle error: Couldn't find NDK.") return null; } +} + +String getAbi() { + String taskName = getGradle().startParameter.taskNames[0] + String abi; + + if (taskName == null) { + return "" + } + + project.logger.quiet("Gradle: Build = " + taskName) + + if (taskName.contains("Arm_64")) { + abi = "arm64-v8a" + } else if (taskName.contains("Arm")) { + abi = "armeabi-v7a" + } else if (taskName.contains("X86_64")) { + abi = "x86_64" + } + + project.logger.quiet("Gradle: ABI name: " + abi) + return abi; +} + +String getToolchainName() { + String taskName = getGradle().startParameter.taskNames[0] + String toolchain; + + if (taskName == null) { + return "" + } + + if (taskName.contains("Arm_64")) { + toolchain = "aarch64-linux-android-4.9" + } else if (taskName.contains("Arm")) { + toolchain = "arm-linux-androideabi-4.9" + } else if (taskName.contains("X86_64")) { + toolchain = "x86_64-4.9" + } + + project.logger.quiet("Gradle: ABI name: " + toolchain) + return toolchain; } \ No newline at end of file -- cgit v1.2.3 From fe8d9e5a386db4ead9f810162a89cea9a13ffb01 Mon Sep 17 00:00:00 2001 From: Eder Bastos Date: Fri, 22 May 2015 17:14:28 -0400 Subject: Android: Upgrade to newest Build-Tools version. --- Source/Android/app/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Source/Android') diff --git a/Source/Android/app/build.gradle b/Source/Android/app/build.gradle index bf1d999706..7c66a7ac2f 100644 --- a/Source/Android/app/build.gradle +++ b/Source/Android/app/build.gradle @@ -2,7 +2,7 @@ apply plugin: 'com.android.application' android { compileSdkVersion 21 - buildToolsVersion "20.0.0" + buildToolsVersion "22.0.1" lintOptions { // This is important as it will run lint but not abort on error -- cgit v1.2.3