BUILD.gn: Fix standalone GN builds (#4765)

Standalone projects that depend on both SPIRV-Tools and SwiftShader
failed to have Ninja build files generated because `build_with_chromium`
is false for both of them and cause the executables to be declared
twice.

This change causes `build_with_chromium` builds to declare the
executables, but only for the copy in `//third_party`. The path for that
was also corrected to include the `vulkan-deps` and `src`
subdirectories.

Builds from the Fuchsia tree also declare the executable targets.

This change was tested with a Chromium build and a "standalone" Dawn
build.

Bug: b/158002593
This commit is contained in:
Nicolas Capens 2022-03-28 10:22:33 -04:00 committed by GitHub
parent 05745cc9d4
commit 7841afd98e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -20,10 +20,15 @@ if (build_with_chromium) {
}
# SPIRV-Tools may be part of multiple projects in the Chromium tree.
# Only enable building executables if this is the main copy, or standalone.
# Only enable building executables if this is the main copy.
abspath = get_path_info(".", "abspath")
spvtools_chromium_third_party = (abspath == "//third_party/SPIRV-Tools/")
spvtools_build_executables = !build_with_chromium || spvtools_chromium_third_party
spvtools_chromium_third_party = (abspath == "//third_party/vulkan-deps/spirv-tools/src/")
spvtools_build_executables = build_with_chromium && spvtools_chromium_third_party
# Fuchsia also requires building the executables.
# TODO(b/158002593): Avoid the use of dependent-specific variables.
if (defined(is_fuchsia_tree) && is_fuchsia_tree) {
spvtools_build_executables = true
}
spirv_headers = spirv_tools_spirv_headers_dir
spirv_is_winuwp = is_win && target_os == "winuwp"