Add Android viewer to GN
authorJim Van Verth <jvanverth@google.com>
Fri, 21 Oct 2016 14:58:52 +0000 (10:58 -0400)
committerSkia Commit-Bot <skia-commit-bot@chromium.org>
Fri, 21 Oct 2016 15:19:32 +0000 (15:19 +0000)
BUG=skia:

GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=3761

Change-Id: If971e275ed377cd733d01f62622d408479632465
Reviewed-on: https://skia-review.googlesource.com/3761
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Mike Klein <mtklein@chromium.org>
BUILD.gn
third_party/native_app_glue/BUILD.gn [new file with mode: 0644]

index a3b78574a97ecfbe1fc158f25e56039d7718fdb6..21ea7aae4003da23e8bcc6fd51505256a9ed670f 100644 (file)
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -928,8 +928,7 @@ if (skia_enable_tools) {
     if (!is_android) {
       sources += [ "src/views/SkWindow.cpp" ]
     }
-    if (is_android) {
-    } else if (is_linux) {
+    if (is_linux) {
       public_include_dirs += [ "src/views/unix" ]
       sources += [
         "src/views/unix/SkOSWindow_Unix.cpp",
@@ -1197,7 +1196,15 @@ if (skia_enable_tools) {
       ]
       libs = []
 
-      if (is_linux) {
+      if (is_android) {
+        sources += [
+          "tools/viewer/sk_app/android/GLWindowContext_android.cpp",
+          "tools/viewer/sk_app/android/RasterWindowContext_android.cpp",
+          "tools/viewer/sk_app/android/Window_android.cpp",
+          "tools/viewer/sk_app/android/main_android.cpp",
+          "tools/viewer/sk_app/android/surface_glue_android.cpp",
+        ]
+      } else if (is_linux) {
         sources += [
           "tools/viewer/sk_app/unix/GLWindowContext_unix.cpp",
           "tools/viewer/sk_app/unix/RasterWindowContext_unix.cpp",
@@ -1222,7 +1229,11 @@ if (skia_enable_tools) {
 
       if (skia_use_vulkan) {
         sources += [ "tools/viewer/sk_app/VulkanWindowContext.cpp" ]
-        if (is_linux) {
+        if (is_android) {
+          sources +=
+              [ "tools/viewer/sk_app/android/VulkanWindowContext_android.cpp" ]
+          libs += [ "android" ]
+        } else if (is_linux) {
           sources += [ "tools/viewer/sk_app/unix/VulkanWindowContext_unix.cpp" ]
           libs += [ "X11-xcb" ]
         } else if (is_win) {
@@ -1241,7 +1252,9 @@ if (skia_enable_tools) {
         ":views",
         "//third_party/jsoncpp",
       ]
-      if (is_mac) {
+      if (is_android) {
+        deps += [ "//third_party/native_app_glue" ]
+      } else if (is_mac) {
         deps += [ "//third_party/libsdl" ]
       }
       testonly = true
diff --git a/third_party/native_app_glue/BUILD.gn b/third_party/native_app_glue/BUILD.gn
new file mode 100644 (file)
index 0000000..a25065b
--- /dev/null
@@ -0,0 +1,17 @@
+# Copyright 2016 Google Inc.
+#
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+declare_args() {
+}
+
+import("../third_party.gni")
+
+third_party("native_app_glue") {
+  public_include_dirs = [ "$ndk/sources/android/native_app_glue" ]
+
+  sources = [
+    "$ndk/sources/android/native_app_glue/android_native_app_glue.c",
+  ]
+}