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>
diff --git a/BUILD.gn b/BUILD.gn
index 2e31a90..3c76769 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -411,7 +411,6 @@
}
if (dawn_enable_vulkan) {
sources += [ "src/dawn_native/vulkan/VulkanBackend.cpp" ]
- deps += [ "third_party:vulkan_headers" ]
}
}
@@ -540,7 +539,6 @@
if (dawn_enable_vulkan) {
sources += [ "src/utils/VulkanBinding.cpp" ]
- deps += [ "third_party:vulkan_headers" ]
}
}
diff --git a/src/common/BUILD.gn b/src/common/BUILD.gn
index c61f872..71ecbe7 100644
--- a/src/common/BUILD.gn
+++ b/src/common/BUILD.gn
@@ -96,9 +96,14 @@
"windows_with_undefs.h",
]
- configs += [ ":dawn_internal" ]
+ public_configs = [ ":dawn_internal" ]
deps = [
"${dawn_root}/src/dawn:dawn_headers",
]
+ if (dawn_enable_vulkan) {
+ public_deps = [
+ "../../third_party:vulkan_headers",
+ ]
+ }
}
}