build: GN use pre-generated source
authorMike Schuchardt <mikes@lunarg.com>
Fri, 19 Jul 2019 03:57:23 +0000 (20:57 -0700)
committerMike Schuchardt <mikes@lunarg.com>
Fri, 19 Jul 2019 17:36:03 +0000 (10:36 -0700)
BUILD.gn

index 27063ab025a03986251eb85a2a7206655d46232c..5acbfffb86f9551cae26d1abf78699a69acd657d 100644 (file)
--- a/BUILD.gn
+++ b/BUILD.gn
 
 import("//build_overrides/vulkan_loader.gni")
 
-vulkan_registry_script_files = [
-  "$vulkan_headers_dir/registry/cgenerator.py",
-  "$vulkan_headers_dir/registry/conventions.py",
-  "$vulkan_headers_dir/registry/generator.py",
-  "$vulkan_headers_dir/registry/reg.py",
-  "$vulkan_headers_dir/registry/vkconventions.py",
-  "$vulkan_headers_dir/registry/vk.xml",
-]
-
 # Fuchsia has non-upstream changes to the vulkan loader, so we don't want
 # to build it from upstream sources.
 assert(!is_fuchsia)
@@ -38,125 +29,6 @@ if (is_win) {
   ]
 }
 
-vulkan_gen_dir = "$target_gen_dir/$vulkan_gen_subdir"
-raw_vulkan_gen_dir = rebase_path(vulkan_gen_dir, root_build_dir)
-
-# Vulkan helper scripts
-# ---------------------
-
-helper_script_and_deps = [
-  [
-    "vulkan_gen_dispatch_table_helper_h",
-    "vk_dispatch_table_helper.h",
-    "dispatch_table_helper_generator.py",
-  ],
-  [
-    "vulkan_gen_enum_string_helper",
-    "vk_enum_string_helper.h",
-    "helper_file_generator.py",
-  ],
-  [
-    "vulkan_gen_extension_helper",
-    "vk_extension_helper.h",
-    "helper_file_generator.py",
-  ],
-  [
-    "vulkan_gen_layer_dispatch_table_h",
-    "vk_layer_dispatch_table.h",
-    "loader_extension_generator.py",
-  ],
-  [
-    "vulkan_gen_loader_extensions_c",
-    "vk_loader_extensions.c",
-    "loader_extension_generator.py",
-  ],
-  [
-    "vulkan_gen_loader_extensions_h",
-    "vk_loader_extensions.h",
-    "loader_extension_generator.py",
-  ],
-  [
-    "vulkan_gen_object_types_h",
-    "vk_object_types.h",
-    "helper_file_generator.py",
-  ],
-  [
-    "vulkan_gen_safe_struct_cpp",
-    "vk_safe_struct.cpp",
-    "helper_file_generator.py",
-  ],
-  [
-    "vulkan_gen_safe_struct_h",
-    "vk_safe_struct.h",
-    "helper_file_generator.py",
-  ],
-  [
-    "vulkan_gen_typemap_helper",
-    "vk_typemap_helper.h",
-    "helper_file_generator.py",
-  ],
-]
-
-# Python scripts needed for codegen, copy them to a temp dir
-# so that all dependencies are together. The reg.py script from
-# the headers repo is required input to loader_genvk.py.
-copy("python_gen_deps") {
-  sources = vulkan_registry_script_files + [
-              "scripts/common_codegen.py",
-              "scripts/dispatch_table_helper_generator.py",
-              "scripts/helper_file_generator.py",
-              "scripts/loader_extension_generator.py",
-              "scripts/loader_genvk.py",
-            ]
-  outputs = [
-    "$vulkan_gen_dir/{{source_file_part}}",
-  ]
-}
-
-foreach(script_and_dep, helper_script_and_deps) {
-  target_name = script_and_dep[0]
-  file = script_and_dep[1]
-  dep = script_and_dep[2]
-  target("action", target_name) {
-    public_deps = [
-      ":python_gen_deps",
-    ]
-    script = "$vulkan_gen_dir/loader_genvk.py"
-    inputs = [
-      "$vulkan_gen_dir/$dep",
-      "$vulkan_gen_dir/common_codegen.py",
-    ]
-    outputs = [
-      "$vulkan_gen_dir/$file",
-    ]
-    args = [
-      "-o",
-      raw_vulkan_gen_dir,
-      "-registry",
-      "$raw_vulkan_gen_dir/vk.xml",
-      "-scripts",
-      raw_vulkan_gen_dir,
-      "$file",
-      "-quiet",
-    ]
-  }
-}
-
-config("vulkan_generated_files_config") {
-  include_dirs = [ vulkan_gen_dir ]
-}
-
-group("vulkan_generate_helper_files") {
-  public_deps = [
-    "$vulkan_headers_dir:vulkan_headers",
-  ]
-  public_configs = [ ":vulkan_generated_files_config" ]
-  foreach(script_and_dep, helper_script_and_deps) {
-    target_name = script_and_dep[0]
-    public_deps += [ ":$target_name" ]
-  }
-}
-
 config("vulkan_internal_config") {
   defines = [ "VULKAN_NON_CMAKE_BUILD" ]
   if (is_clang || !is_win) {
@@ -176,7 +48,7 @@ config("vulkan_internal_config") {
 
 config("vulkan_loader_config") {
   include_dirs = [
-    vulkan_gen_dir,
+    "loader/generated",
     "loader",
   ]
   defines = [ "API_NAME=\"Vulkan\"" ] + vulkan_loader_extra_defines
@@ -241,9 +113,6 @@ if (!is_android) {
         ]
       }
     }
-    deps = [
-      ":vulkan_generate_helper_files",
-    ]
     public_deps = [
       "$vulkan_headers_dir:vulkan_headers",
     ]