Allow including of vulkan.h as a required public api when using vulkan.
authorGreg Daniel <egdaniel@google.com>
Wed, 12 Apr 2017 17:29:50 +0000 (13:29 -0400)
committerSkia Commit-Bot <skia-commit-bot@chromium.org>
Wed, 12 Apr 2017 18:24:25 +0000 (18:24 +0000)
Bug: skia:
Change-Id: I3ac382edc12144dcda9ef168f752b14878e0e5ac
Reviewed-on: https://skia-review.googlesource.com/13262
Commit-Queue: Mike Klein <mtklein@chromium.org>
Reviewed-by: Mike Klein <mtklein@chromium.org>
BUILD.gn
gn/find_headers.py

index 2dbd380..64944b1 100644 (file)
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -74,6 +74,7 @@ skia_public_includes = [
   "include/svg",
   "include/utils",
   "include/utils/mac",
+  skia_vulkan_headers_path,
 ]
 
 # Skia public API, generally provided by :skia.
@@ -139,8 +140,6 @@ config("skia_private") {
   libs = []
   lib_dirs = []
   if (skia_use_vulkan) {
-    include_dirs += [ skia_vulkan_headers_path ]
-
     if (skia_vulkan_sdk != "" && !is_android) {
       if (is_win) {
         lib_dirs += [
@@ -743,8 +742,15 @@ if (skia_enable_tools) {
     public_configs = [ ":skia.h_config" ]
     skia_h = "$target_gen_dir/skia.h"
     script = "gn/find_headers.py"
-    args = [ rebase_path(skia_h, root_build_dir) ] +
-           rebase_path(skia_public_includes)
+    if (skia_use_vulkan) {
+      use_vulkan_string = "True"
+    } else {
+      use_vulkan_string = "False"
+    }
+    args = [
+             rebase_path(skia_h, root_build_dir),
+             use_vulkan_string,
+           ] + rebase_path(skia_public_includes - [ skia_vulkan_headers_path ])
     depfile = "$skia_h.deps"
     outputs = [
       skia_h,
index 4ade28d..f02ebc9 100755 (executable)
@@ -15,14 +15,11 @@ import sys
 # very same mechanism Ninja uses to know which .h files affect which .cpp files.
 
 skia_h       = sys.argv[1]
-include_dirs = sys.argv[2:]
+use_vulkan   = eval(sys.argv[2])
+include_dirs = sys.argv[3:]
 
 blacklist = {
   "GrGLConfig_chrome.h",
-  "GrVkBackendContext.h",
-  "GrVkDefines.h",
-  "GrVkInterface.h",
-  "GrVkTypes.h",
   "SkFontMgr_fontconfig.h",
 }
 
@@ -30,8 +27,9 @@ headers = []
 for directory in include_dirs:
   for d, _, files in os.walk(directory):
     for f in files:
-      if f.endswith('.h') and f not in blacklist:
-        headers.append(os.path.join(d,f))
+      if not d.endswith('vk') or use_vulkan:
+        if f.endswith('.h') and f not in blacklist:
+          headers.append(os.path.join(d,f))
 headers.sort()
 
 with open(skia_h, "w") as f: