Make GN //src/common target easier to use when Vulkan is enabled.

Ensure that //src/common exports the appropriate config settings
when vulkan is enabled. This CL tries to address several issues
at once:

- A target that depends on //src/common and wants to find
  "common/vulkan_platform.h" needs to have "${dawn_root}/src"
  in its include_dir.

- Same target needs to have DAWN_ENABLE_VULKAN macro to avoid
  a compile #error message when including "common/vulkan_platform.h"

- Same target needs to be able to find <vulkan/vulkan.h> which
  is included by "common/vulkan_platform.h".

This is achieved by ensuring that the "dawn_internal" config,
is provided as a public_config by the GN ":common" target.
And by adding third_party/vulkan_headers as a public_deps
if |dawn_enable_vulkan| is true.

Note that "dawn_internal" is used by several other targets
in Dawn BUILD.gn files, hence why it was not renamed to something
else like "dawn_common_config" here.

+ Simplify targets that currently depend on ":common" so they
  no longer need to add vulkan_headers as an explicit dependency.

Change-Id: I2030c1e209a8186c141d4c06a0d52fb21695bb51
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8962
Commit-Queue: David Turner <digit@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
This commit is contained in:
David 'Digit' Turner 2019-07-17 08:54:18 +00:00 committed by Commit Bot service account
parent cf20678c0d
commit 56a21a6151
2 changed files with 6 additions and 3 deletions

View File

@ -411,7 +411,6 @@ dawn_component("libdawn_native") {
} }
if (dawn_enable_vulkan) { if (dawn_enable_vulkan) {
sources += [ "src/dawn_native/vulkan/VulkanBackend.cpp" ] sources += [ "src/dawn_native/vulkan/VulkanBackend.cpp" ]
deps += [ "third_party:vulkan_headers" ]
} }
} }
@ -540,7 +539,6 @@ static_library("dawn_utils") {
if (dawn_enable_vulkan) { if (dawn_enable_vulkan) {
sources += [ "src/utils/VulkanBinding.cpp" ] sources += [ "src/utils/VulkanBinding.cpp" ]
deps += [ "third_party:vulkan_headers" ]
} }
} }

View File

@ -96,9 +96,14 @@ if (is_win || is_linux || is_mac) {
"windows_with_undefs.h", "windows_with_undefs.h",
] ]
configs += [ ":dawn_internal" ] public_configs = [ ":dawn_internal" ]
deps = [ deps = [
"${dawn_root}/src/dawn:dawn_headers", "${dawn_root}/src/dawn:dawn_headers",
] ]
if (dawn_enable_vulkan) {
public_deps = [
"../../third_party:vulkan_headers",
]
}
} }
} }