Commit 949b4f07 by Jamie Madill Committed by Commit Bot

Vulkan: Allow for no .git directory in build.

The SPIRV-Tools 'external revision generate' script is coded such that it assumes a .git folder is present. This causes a problem for the tarball build. We can fix this by using the same tooling we use for ANGLE's commit id script to check if the .git directory is present before running the generator. If it is missing, we insert a hard-coded dummy header. Also use the 'DEPS' file as a placeholder for .git/HEAD to check if the current revision needs updating. Bug: chromium:799620 Bug: angleproject:2237 Change-Id: Icea8e9c66f1600df7dca2aaa45fe449f687f5b55 Reviewed-on: https://chromium-review.googlesource.com/854255Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
parent eeda03b6
...@@ -23,6 +23,9 @@ if operation == 'check': ...@@ -23,6 +23,9 @@ if operation == 'check':
print("0") print("0")
sys.exit(0) sys.exit(0)
if len(sys.argv) < 4 or operation != 'gen':
sys.exit(usage)
output_file = sys.argv[3] output_file = sys.argv[3]
commit_id_size = 12 commit_id_size = 12
......
...@@ -145,21 +145,40 @@ foreach(script_and_dep, helper_script_and_deps) { ...@@ -145,21 +145,40 @@ foreach(script_and_dep, helper_script_and_deps) {
} }
} }
# This could be generalized to a foreach if other revisions are added. spirv_git_is_present = exec_script("$angle_root/src/commit_id.py",
action("spirv_tools_external_revision_generate") { [
script = "$vulkan_layers_dir/scripts/external_revision_generator.py" "check",
inputs = [ raw_spirv_tools_dir,
"$spirv_tools_dir/.git/HEAD", ],
"$spirv_tools_dir/.git/index", "value")
]
outputs = [ spirv_use_commit_id = spirv_git_is_present == 1
"$vulkan_gen_dir/spirv_tools_commit_id.h",
] if (spirv_use_commit_id) {
args = [ # This could be generalized to a foreach if other revisions are added.
"$raw_spirv_tools_dir", action("spirv_tools_external_revision_generate") {
"SPIRV_TOOLS_COMMIT_ID", script = "$vulkan_layers_dir/scripts/external_revision_generator.py"
"$raw_vulkan_gen_dir/spirv_tools_commit_id.h", inputs = [
] "$angle_root/DEPS",
]
outputs = [
"$vulkan_gen_dir/spirv_tools_commit_id.h",
]
args = [
"$raw_spirv_tools_dir",
"SPIRV_TOOLS_COMMIT_ID",
"$raw_vulkan_gen_dir/spirv_tools_commit_id.h",
]
}
} else {
copy("spirv_tools_external_revision_generate") {
sources = [
"dummy_spirv_tools_commit_id.h",
]
outputs = [
"$vulkan_gen_dir/spirv_tools_commit_id.h",
]
}
} }
config("vulkan_generate_helper_files_config") { config("vulkan_generate_helper_files_config") {
...@@ -864,7 +883,7 @@ foreach(layer_info, layers) { ...@@ -864,7 +883,7 @@ foreach(layer_info, layers) {
sources += [ "$vulkan_layers_dir/layers/VkLayer_$name.def" ] sources += [ "$vulkan_layers_dir/layers/VkLayer_$name.def" ]
} }
if (is_linux) { if (is_linux) {
ldflags = [ "-Wl,-Bsymbolic,--exclude-libs,ALL" ] ldflags = [ "-Wl,-Bsymbolic,--exclude-libs,ALL" ]
} }
} }
} }
......
//
// Copyright 2018 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// This file is a dummy file to enable building SPIRV tools when git is absent.
#pragma once
#define SPIRV_TOOLS_COMMIT_ID "0000000000000000000000000000000000000000"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment