aboutsummaryrefslogtreecommitdiffhomepage
path: root/platform_tools/android/apps
diff options
context:
space:
mode:
Diffstat (limited to 'platform_tools/android/apps')
-rw-r--r--platform_tools/android/apps/build.gradle89
-rw-r--r--platform_tools/android/apps/skqp/build.gradle51
-rw-r--r--platform_tools/android/apps/skqp/src/main/java/org/skia/skqp/SkQP.java2
-rw-r--r--platform_tools/android/apps/viewer/build.gradle56
-rw-r--r--platform_tools/android/apps/viewer/src/main/java/org/skia/viewer/ViewerApplication.java2
5 files changed, 101 insertions, 99 deletions
diff --git a/platform_tools/android/apps/build.gradle b/platform_tools/android/apps/build.gradle
index 9f285e5b06..7aa9b56af8 100644
--- a/platform_tools/android/apps/build.gradle
+++ b/platform_tools/android/apps/build.gradle
@@ -18,92 +18,3 @@ allprojects {
jcenter()
}
}
-
-def setupSkiaLibraryBuild(project, appVariants, appName) {
- appVariants.all{ variant ->
- def buildNativeLib = project.task("${variant.name}_BuildSkiaLib", type:Exec) {
- workingDir '../../../..' // top-level skia directory
- commandLine constructBuildCommand(project, variant, appName).split()
- }
- buildNativeLib.onlyIf { !project.hasProperty("suppressNativeBuild") }
-
- def copyNativeLib = project.task("${variant.name}_CopySkiaLib", type:Copy) {
- def fromDir = getVariantOutDir(project, variant).skiaOut
- def intoDir = getVariantOutDir(project, variant).androidOut
- from fromDir
- into intoDir
- include "${appName}.so"
- }
-
- TaskCollection<Task> compileTask = project.tasks.matching {
- // println(it.name)
- it.name.toLowerCase().contains("compile" + variant.name.toLowerCase()) &&
- it.name.toLowerCase().endsWith("ndk")
- }
- compileTask.findAll()*.dependsOn copyNativeLib
- copyNativeLib.dependsOn buildNativeLib
- }
-}
-
-def getLocalProperties() {
- Properties properties = new Properties()
- File propFile = project.rootProject.file('local.properties')
- if (propFile.canRead()) {
- properties.load(propFile.newDataInputStream())
- }
- propFile = project.rootProject.file('gradle.properties')
- if (propFile.canRead()) {
- properties.load(propFile.newDataInputStream())
- }
- return properties
-}
-
-def getVariantOutDir(project, variant) {
- String variantPrefix = null
- String androidLibDir = null
- if (variant.name.startsWith("arm64")) {
- variantPrefix = "arm64"
- androidLibDir = "arm64-v8a"
- } else if (variant.name.startsWith("arm")) {
- variantPrefix = "arm"
- androidLibDir = "armeabi-v7a"
- } else if (variant.name.startsWith("x64")) {
- variantPrefix = "x64"
- androidLibDir = "x86_64"
- } else if (variant.name.startsWith("x86")) {
- variantPrefix = "x86"
- androidLibDir = "x86"
- }
-
- String skiaOutDir = null
- String propName = "${variantPrefix}.out.dir"
- if (project.hasProperty(propName)) {
- skiaOutDir = project.getProperties().getAt(propName)
- } else {
- skiaOutDir = getLocalProperties().getProperty(propName, "missing_variant_out")
- }
-
- return [skiaOut: skiaOutDir,
- androidOut: "src/main/libs/${androidLibDir}"]
-}
-
-def constructBuildCommand(project, variant, appName) {
- String depotToolsDir = null
- for (String entry : System.getenv("PATH").split(":")) {
- if (entry.contains("depot_tools")) {
- depotToolsDir = entry;
- break;
- }
- }
- if (depotToolsDir == null) {
- depotToolsDir = getLocalProperties().getProperty('depot_tools.dir', null)
- }
-
- if (depotToolsDir == null) {
- throw GradleScriptException("Depot Tools not found! Please update your path to include" +
- " depot_tools or define depot_tools.dir in local.properties")
- }
-
- String out_dir = getVariantOutDir(project, variant).skiaOut
- return "${depotToolsDir}/ninja -C $out_dir $appName"
-}
diff --git a/platform_tools/android/apps/skqp/build.gradle b/platform_tools/android/apps/skqp/build.gradle
index e368a66ef6..7d747c1791 100644
--- a/platform_tools/android/apps/skqp/build.gradle
+++ b/platform_tools/android/apps/skqp/build.gradle
@@ -4,8 +4,12 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
+
apply plugin: 'com.android.application'
+//Make sure this is directory corresponds to skia/platform_tools/android
+final String ANDROID_CMAKE_HEADER_PATH = "../../CMakeLists.txt"
+
dependencies {
compile 'com.android.support:design:26.+'
compile 'com.android.support.test:runner:0.5'
@@ -21,9 +25,48 @@ android {
versionCode 1
versionName "1.0"
signingConfig signingConfigs.debug
+
+ externalNativeBuild {
+ cmake {
+ //Native libraries to build
+ targets "libskqp_app"
+
+ arguments "-DANDROID_STL=c++_static",
+ "-DTARGETS=${android.defaultConfig.externalNativeBuild.cmake.targets}"
+ }
+ }
+
+ buildTypes {
+ debug {
+ applicationIdSuffix ".debug"
+ debuggable true
+ }
+ }
+
+ productFlavors {
+ arm {
+ ndk {
+ abiFilters "armeabi-v7a"
+ }
+ }
+
+ x86 {
+ ndk {
+ abiFilters "x86"
+ }
+ }
+
+ x64 {
+ ndk {
+ abiFilters "x86_64"
+ }
+ }
+ }
+ }
+
+ externalNativeBuild {
+ cmake {
+ path ANDROID_CMAKE_HEADER_PATH
+ }
}
- sourceSets.main.jni.srcDirs = []
- sourceSets.main.jniLibs.srcDir "src/main/libs"
- productFlavors { universal{}; arm {}; arm64 {}; x86 {}; x64 {}; arm64vulkan{}; }
- setupSkiaLibraryBuild(project, applicationVariants, "libskqp_app")
}
diff --git a/platform_tools/android/apps/skqp/src/main/java/org/skia/skqp/SkQP.java b/platform_tools/android/apps/skqp/src/main/java/org/skia/skqp/SkQP.java
index 58e09ec982..4457fc61f8 100644
--- a/platform_tools/android/apps/skqp/src/main/java/org/skia/skqp/SkQP.java
+++ b/platform_tools/android/apps/skqp/src/main/java/org/skia/skqp/SkQP.java
@@ -28,7 +28,7 @@ public class SkQP {
protected static final String LOG_PREFIX = "org.skia.skqp";
static {
- System.loadLibrary("skqp_app");
+ System.loadLibrary("libskqp_app");
}
protected void runTests(Context context, String outputDirPath) {
diff --git a/platform_tools/android/apps/viewer/build.gradle b/platform_tools/android/apps/viewer/build.gradle
index 630544d0bb..ad34f8a61d 100644
--- a/platform_tools/android/apps/viewer/build.gradle
+++ b/platform_tools/android/apps/viewer/build.gradle
@@ -4,8 +4,12 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
+
apply plugin: 'com.android.application'
+//Make sure this is directory corresponds to skia/platform_tools/android
+final String ANDROID_CMAKE_HEADER_PATH = "../../CMakeLists.txt"
+
dependencies {
compile 'com.android.support:support-v13:23.3.0'
compile 'com.android.support:appcompat-v7:23.3.0'
@@ -21,10 +25,54 @@ android {
versionCode 1
versionName "1.0"
signingConfig signingConfigs.debug
+
+ externalNativeBuild {
+ cmake {
+ //Native libraries to build
+ targets "libviewer"
+
+ arguments "-DANDROID_STL=c++_static",
+ "-DTARGETS=${android.defaultConfig.externalNativeBuild.cmake.targets}"
+ }
+ }
+
+ buildTypes {
+ debug {
+ applicationIdSuffix ".debug"
+ debuggable true
+ }
+ }
+
+ productFlavors {
+ arm64 {
+ ndk {
+ abiFilters "arm64-v8a"
+ }
+ }
+
+ arm {
+ ndk {
+ abiFilters "armeabi-v7a"
+ }
+ }
+
+ x86 {
+ ndk {
+ abiFilters "x86"
+ }
+ }
+
+ x64 {
+ ndk {
+ abiFilters "x86_64"
+ }
+ }
+ }
}
- sourceSets.main.jni.srcDirs = [] //disable automatic ndk-build call
- sourceSets.main.jniLibs.srcDir "src/main/libs"
- productFlavors { universal{}; arm {}; arm64 {}; x86 {}; x64 {}; arm64vulkan{}; }
- setupSkiaLibraryBuild(project, applicationVariants, "libviewer")
+ externalNativeBuild {
+ cmake {
+ path ANDROID_CMAKE_HEADER_PATH
+ }
+ }
}
diff --git a/platform_tools/android/apps/viewer/src/main/java/org/skia/viewer/ViewerApplication.java b/platform_tools/android/apps/viewer/src/main/java/org/skia/viewer/ViewerApplication.java
index 7253eb7503..0c007ef363 100644
--- a/platform_tools/android/apps/viewer/src/main/java/org/skia/viewer/ViewerApplication.java
+++ b/platform_tools/android/apps/viewer/src/main/java/org/skia/viewer/ViewerApplication.java
@@ -16,7 +16,7 @@ public class ViewerApplication extends Application {
private String mStateJsonStr, mTitle;
static {
- System.loadLibrary("viewer");
+ System.loadLibrary("libviewer");
}
private native long createNativeApp(AssetManager assetManager);