Allow building Skia with Fuchsia SDK enabled buildroots.

The Fuchsia SDK can now be consumed by non-Fuchsia buildroots to produce
Fuchsia artifacts.

The Fuchsia SDK comes with a JSON manifest that describes the various SDK
"parts". GN targets are stamped for each of these parts. The location of these
GN targets can be configured. That location is set to |fuchsia_sdk_root| in
each buildroot. This variable is defined in //build/fuchsia/sdk.gni in each
buildroot. For buildroots that don't care or know about the Fuchsia SDK, that
file may not exist. This is why, the import of that file is guarded behind
the is_fuchsia flag. When the Fuchsia SDK is enabled, that file will define
values for two required variable |using_fuchsia_sdk| and |fuchsia_sdk_root|.

The first flag defines if the SDK is being used. If unset (but defined), the
builds are in-tree. Eventually we want only SDK builds. |fuchsia_sdk_root|
is set to the spot in the buildroot where the GN targets for the SDK parts
are stamped.

Change-Id: I99a0b48326d722703c786263edde7421f9014179
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/212034
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
diff --git a/BUILD.gn b/BUILD.gn
index 3c5c0db..50b1350 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -9,6 +9,7 @@
 import("gn/skia.gni")
 
 if (is_fuchsia) {
+  import("//build/fuchsia/sdk.gni")
   import("//build/vulkan/config.gni")
 }
 
@@ -406,9 +407,13 @@
 optional("fontmgr_fuchsia") {
   enabled = skia_enable_fontmgr_fuchsia
 
-  deps = [
-    "//sdk/fidl/fuchsia.fonts",
-  ]
+  deps = []
+
+  if (is_fuchsia && using_fuchsia_sdk) {
+    deps += [ "$fuchsia_sdk_root/fidl:fuchsia.fonts" ]
+  } else {
+    deps += [ "//sdk/fidl/fuchsia.fonts" ]
+  }
   sources = [
     "src/ports/SkFontMgr_fuchsia.cpp",
     "src/ports/SkFontMgr_fuchsia.h",
@@ -626,8 +631,12 @@
       public_defines += [ "SK_ENABLE_VK_LAYERS" ]
     }
     if (is_fuchsia) {
-      public_deps +=
-          [ "//third_party/vulkan_loader_and_validation_layers:vulkan" ]
+      if (using_fuchsia_sdk) {
+        public_deps += [ "$fuchsia_sdk_root/pkg:vulkan" ]
+      } else {
+        public_deps +=
+            [ "//third_party/vulkan_loader_and_validation_layers:vulkan" ]
+      }
     }
   }