Fixes to be able to build Dawn inside Skia

Add a dawn_has_build override similarly to angle_has_build that makes
Dawn not depend on Chromium //build if it can avoid it. (this was
previously used for mac_sdk.gni).

Only load the Vulkan Validation Layers' gni if it is enable via
dawn_enable_vulkan_validation_layers.

Fix a GN build warning where the source of dawn_components would be
built twice: for example libdawn_native.MetalBackend.o would be built
once for libdawn_native static and once for libdawn_native shared. Fix
this by making libdawn_native as a static library libdawn_native_static.

Change-Id: Ib8fb72282435eb475d7a11dae0d5a9977572fd57
Bug: chromium:1064305
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/18963
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
This commit is contained in:
Corentin Wallez 2020-04-07 19:35:47 +00:00 committed by Commit Bot service account
parent 73ea1f1106
commit 30ec4fc626
4 changed files with 17 additions and 3 deletions

View File

@ -20,6 +20,9 @@
# MUST be unset in other projects (will default to false).
dawn_standalone = true
# True if Dawn can access build/, testing/ and other Chrome folders.
dawn_has_build = true
# Defaults for these are set again in dawn_overrides_with_defaults.gni so that
# users of Dawn don't have to set dirs if they happen to use the same as Dawn.

View File

@ -107,7 +107,7 @@ template("dawn_component") {
}
static_library("${libname}_static") {
output_name = libname
output_name = libname + "_static"
complete_static_lib = dawn_complete_static_libs

View File

@ -24,6 +24,10 @@ if (!defined(dawn_standalone)) {
dawn_standalone = false
}
if (!defined(dawn_has_build)) {
dawn_has_build = true
}
if (!defined(dawn_root)) {
dawn_root = get_path_info("..", "abspath")
}

View File

@ -15,14 +15,21 @@
import("../../scripts/dawn_overrides_with_defaults.gni")
import("//build_overrides/build.gni")
import("//build_overrides/vulkan_validation_layers.gni")
import("${dawn_root}/generator/dawn_generator.gni")
import("${dawn_root}/scripts/dawn_component.gni")
import("${dawn_root}/scripts/dawn_features.gni")
# Import mac_min_system_version
if (is_mac) {
import("//build/config/mac/mac_sdk.gni")
if (dawn_has_build) {
import("//build/config/mac/mac_sdk.gni")
} else {
mac_min_system_version = "10.11.0"
}
}
if (dawn_enable_vulkan_validation_layers) {
import("//build_overrides/vulkan_validation_layers.gni")
}
# Swiftshader is an optional dependency of Dawn so we only use it if the path