diff options
author | liyuqian <liyuqian@google.com> | 2016-05-02 05:33:20 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-05-02 05:33:20 -0700 |
commit | 2275017e45305b5bca8d82803b9ced9d5da3fd72 (patch) | |
tree | e7494e7f91ed14aee9411f345577cf410a82052d /platform_tools | |
parent | 95167758572eca33008dce3e8bebe2a7656a06c9 (diff) |
Add CMake path to gradle
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1921553009
Review-Url: https://codereview.chromium.org/1921553009
Diffstat (limited to 'platform_tools')
-rw-r--r-- | platform_tools/android/apps/build.gradle | 19 | ||||
-rw-r--r-- | platform_tools/android/apps/vulkanviewer/build.gradle | 2 |
2 files changed, 16 insertions, 5 deletions
diff --git a/platform_tools/android/apps/build.gradle b/platform_tools/android/apps/build.gradle index 7622cbdca3..40e085cf5f 100644 --- a/platform_tools/android/apps/build.gradle +++ b/platform_tools/android/apps/build.gradle @@ -19,12 +19,12 @@ allprojects { } } -def setupSkiaLibraryBuild(project, appVariants, buildCmd) { +def setupSkiaLibraryBuild(project, appVariants, buildCmd, requireCMake = false) { appVariants.all{ variant -> def buildNativeLib = project.task("${variant.name}_SkiaNativeLib", type:Exec) { workingDir '../../../..' // top-level skia directory commandLine constructBuildCommand(variant, buildCmd).split() - environment PATH: getPathWithDepotTools() + environment PATH: getPathWithDeps(requireCMake) environment ANDROID_SDK_ROOT: getSDKPath() } buildNativeLib.onlyIf { !project.hasProperty("suppressNativeBuild") } @@ -63,8 +63,7 @@ def getSDKPath() { return path } -def getPathWithDepotTools() { - System.getenv("PATH") + ":" + getLocalProperties().getProperty('depot_tools.dir', null) +def getPathWithDeps(requireCMake = false) { String path = System.getenv("PATH") if (!path.contains("depot_tools")) { path += ":" + getLocalProperties().getProperty('depot_tools.dir', null) @@ -74,6 +73,18 @@ def getPathWithDepotTools() { throw GradleScriptException("Depot Tools not found! Please update your path to include" + " depot_tools or define depot_tools.dir in gradle.properties") } + + if (requireCMake) { + String cmakePath = getSDKPath() + "/cmake/bin" + if (!file(cmakePath).exists()) { + throw new GradleScriptException("cmake not found! Please install the android SDK version" + + " of cmake.", null); + } + if (!path.contains(cmakePath)) { + path = cmakePath + ":" + path + } + } + return path } diff --git a/platform_tools/android/apps/vulkanviewer/build.gradle b/platform_tools/android/apps/vulkanviewer/build.gradle index d8825c5464..731be4c3da 100644 --- a/platform_tools/android/apps/vulkanviewer/build.gradle +++ b/platform_tools/android/apps/vulkanviewer/build.gradle @@ -20,5 +20,5 @@ android { sourceSets.main.jniLibs.srcDir "src/main/libs" productFlavors { arm {}; arm64 {}; x86 {}; x86_64 {}; mips {}; mips64 {}; } - setupSkiaLibraryBuild(project, applicationVariants, "--vulkan CopyVulkanViewerDeps") + setupSkiaLibraryBuild(project, applicationVariants, "--vulkan CopyVulkanViewerDeps", true) } |