From 54e5072f5b82deb8ba4f49a768ad990da5fa21be Mon Sep 17 00:00:00 2001 From: Corentin Wallez Date: Tue, 19 Nov 2019 18:58:50 +0000 Subject: [PATCH] BUILD.gn: Only build dawn_bindings in standalone The BackendBinding that implement correct interactions between Dawn and GLFW windows is only needed when compiling the Dawn samples. This only happen in standalone so move the dawn_bindings there. This fixes an issue where the ChromeOS build would discover the Dawn BUILD.gn file and try to build dawn_bindings that depended on a fake GLFW target, making the GLFW #includes fail. With dawn_binding moved in dawn_standalone, all targets discoverable by a Chromium build that use GLFW do so behind the dawn_enable_opengl flag, which is always false on ChromeOS. Also reverts https://dawn-review.googlesource.com/c/dawn/+/13620 because we want to allow building dawn_end2end_tests on ChromeOS even if the browser doesn't use_dawn. BUG=1025326 Change-Id: I8ab965c5da68ca422912b21f87f65e32e789ee8a Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13820 Reviewed-by: Austin Eng Reviewed-by: Brian Ho Reviewed-by: Corentin Wallez Commit-Queue: Corentin Wallez --- BUILD.gn | 106 ++++++++++++++++++++++++++----------------------------- 1 file changed, 50 insertions(+), 56 deletions(-) diff --git a/BUILD.gn b/BUILD.gn index fb11705a0b..ca6a8c02ec 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -21,13 +21,6 @@ import("scripts/dawn_overrides_with_defaults.gni") import("//testing/test.gni") -if (build_with_chromium) { - # Chromium build targets may not depend on dawn unless use_dawn is set. This - # assertion helps avoid accidental dependencies creeping into chromium. - import("//ui/gl/features.gni") - assert(use_dawn) -} - ############################################################################### # dawn_platform ############################################################################### @@ -717,55 +710,6 @@ static_library("dawn_utils") { ] } -static_library("dawn_bindings") { - configs += [ "${dawn_root}/src/common:dawn_internal" ] - - sources = [ - "src/utils/BackendBinding.cpp", - "src/utils/BackendBinding.h", - ] - - public_deps = [ - "${dawn_root}/src/dawn:dawn_headers", - ] - - deps = [ - ":dawn_glfw", - ":libdawn_native", - "${dawn_root}/src/common", - ] - libs = [] - - if (dawn_enable_d3d12) { - sources += [ "src/utils/D3D12Binding.cpp" ] - } - - if (dawn_enable_metal) { - sources += [ "src/utils/MetalBinding.mm" ] - libs += [ - "Metal.framework", - "QuartzCore.framework", - ] - - # Suppress warnings that Metal isn't in the deployment target of Chrome - if (is_mac) { - cflags_objcc = [ "-Wno-unguarded-availability" ] - } - } - - if (dawn_enable_null) { - sources += [ "src/utils/NullBinding.cpp" ] - } - - if (dawn_enable_opengl) { - sources += [ "src/utils/OpenGLBinding.cpp" ] - } - - if (dawn_enable_vulkan) { - sources += [ "src/utils/VulkanBinding.cpp" ] - } -} - ############################################################################### # Dawn test targets ############################################################################### @@ -1103,6 +1047,56 @@ group("dawn_perf_tests_temp_group") { ############################################################################### if (dawn_standalone) { + # Library to handle the interaction of Dawn with GLFW windows in samples + static_library("dawn_bindings") { + configs += [ "${dawn_root}/src/common:dawn_internal" ] + + sources = [ + "src/utils/BackendBinding.cpp", + "src/utils/BackendBinding.h", + ] + + public_deps = [ + "${dawn_root}/src/dawn:dawn_headers", + ] + + deps = [ + ":dawn_glfw", + ":libdawn_native", + "${dawn_root}/src/common", + ] + libs = [] + + if (dawn_enable_d3d12) { + sources += [ "src/utils/D3D12Binding.cpp" ] + } + + if (dawn_enable_metal) { + sources += [ "src/utils/MetalBinding.mm" ] + libs += [ + "Metal.framework", + "QuartzCore.framework", + ] + + # Suppress warnings that Metal isn't in the deployment target of Chrome + if (is_mac) { + cflags_objcc = [ "-Wno-unguarded-availability" ] + } + } + + if (dawn_enable_null) { + sources += [ "src/utils/NullBinding.cpp" ] + } + + if (dawn_enable_opengl) { + sources += [ "src/utils/OpenGLBinding.cpp" ] + } + + if (dawn_enable_vulkan) { + sources += [ "src/utils/VulkanBinding.cpp" ] + } + } + # Static library to contain code and dependencies common to all samples static_library("dawn_sample_utils") { sources = [