From 56a21a615134495484f1b76a3496b563a7c4302b Mon Sep 17 00:00:00 2001 From: David 'Digit' Turner Date: Wed, 17 Jul 2019 08:54:18 +0000 Subject: [PATCH] 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 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 Reviewed-by: Corentin Wallez Reviewed-by: Austin Eng --- BUILD.gn | 2 -- src/common/BUILD.gn | 7 ++++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/BUILD.gn b/BUILD.gn index 2e31a90a81..3c76769b31 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -411,7 +411,6 @@ dawn_component("libdawn_native") { } if (dawn_enable_vulkan) { sources += [ "src/dawn_native/vulkan/VulkanBackend.cpp" ] - deps += [ "third_party:vulkan_headers" ] } } @@ -540,7 +539,6 @@ static_library("dawn_utils") { 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 c61f872210..71ecbe7ff3 100644 --- a/src/common/BUILD.gn +++ b/src/common/BUILD.gn @@ -96,9 +96,14 @@ if (is_win || is_linux || is_mac) { "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", + ] + } } }