From e79d54cbca83aaf1744e01f4574ae8a73de8c571 Mon Sep 17 00:00:00 2001 From: Stuart Morgan Date: Wed, 7 Aug 2019 12:09:57 -0700 Subject: [PATCH] Reland: Add support for ANGLE using upstream build rules This adds minimal (in some cases dummy) files sufficient to allow building ANGLE in this buildroot using the build_with_chromium option. This relanded version uses the new swiftshader_ prefixed versions of the DLL names in the swiftshader build, which are loaded preferentially if available. This ensures that the swiftshader tests will use those, rather than the potentially incompatible ANGLE versions. In local testing, this resolved the ShellTest failures that led to the previous revert. --- build/config/BUILD.gn | 4 +--- build/config/dcheck_always_on.gni | 11 +++++++++++ build/config/sanitizers/sanitizers.gni | 2 ++ build/config/ui.gni | 6 ++++++ build/secondary/testing/libfuzzer/fuzzer_test.gni | 11 +++++++++++ build/secondary/testing/test.gni | 6 ++++++ build/secondary/third_party/jsoncpp/BUILD.gn | 11 +++++++++++ .../third_party/swiftshader_flutter/BUILD.gn | 4 ++-- build/secondary/ui/ozone/ozone.gni | 7 +++++++ build_overrides/angle.gni | 12 ++++++++++++ build_overrides/build.gni | 8 ++++++++ 11 files changed, 77 insertions(+), 5 deletions(-) create mode 100644 build/config/dcheck_always_on.gni create mode 100644 build/secondary/testing/libfuzzer/fuzzer_test.gni create mode 100644 build/secondary/testing/test.gni create mode 100644 build/secondary/third_party/jsoncpp/BUILD.gn create mode 100644 build/secondary/ui/ozone/ozone.gni create mode 100644 build_overrides/angle.gni create mode 100644 build_overrides/build.gni diff --git a/build/config/BUILD.gn b/build/config/BUILD.gn index 355ef38cb0..85f1faaf93 100644 --- a/build/config/BUILD.gn +++ b/build/config/BUILD.gn @@ -6,6 +6,7 @@ import("//build/config/allocator.gni") import("//build/config/crypto.gni") import("//build/config/features.gni") import("//build/config/ui.gni") +import("//build/config/dcheck_always_on.gni") declare_args() { # When set, turns off the (normally-on) iterator debugging and related stuff @@ -13,9 +14,6 @@ declare_args() { # catching bugs but in some cases may cause conflicts or excessive slowness. disable_iterator_debugging = false - # Set to true to enable dcheck in Release builds. - dcheck_always_on = false - # Set to true to compile with the OpenGL ES 2.0 conformance tests. internal_gles2_conform_tests = false } diff --git a/build/config/dcheck_always_on.gni b/build/config/dcheck_always_on.gni new file mode 100644 index 0000000000..20118f4790 --- /dev/null +++ b/build/config/dcheck_always_on.gni @@ -0,0 +1,11 @@ +# Copyright (c) 2016 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# Needed for ANGLE build. +dcheck_is_configurable = false + +declare_args() { + # Set to true to enable dcheck in Release builds. + dcheck_always_on = false +} diff --git a/build/config/sanitizers/sanitizers.gni b/build/config/sanitizers/sanitizers.gni index a7b965824a..2d58f9fd5d 100644 --- a/build/config/sanitizers/sanitizers.gni +++ b/build/config/sanitizers/sanitizers.gni @@ -18,3 +18,5 @@ declare_args() { # GCS. use_prebuilt_instrumented_libraries = false } + +use_fuzzing_engine = false diff --git a/build/config/ui.gni b/build/config/ui.gni index ec95ce4cf7..d533be9a4e 100644 --- a/build/config/ui.gni +++ b/build/config/ui.gni @@ -18,3 +18,9 @@ declare_args() { # window system events and input. use_glfw = false } + +# For ANGLE build. It's a build option there, but hard-coded here. +use_x11 = false + +# For ANGLE build. It's a build option there, but hard-coded here. +use_ozone = false diff --git a/build/secondary/testing/libfuzzer/fuzzer_test.gni b/build/secondary/testing/libfuzzer/fuzzer_test.gni new file mode 100644 index 0000000000..8f8f3e750f --- /dev/null +++ b/build/secondary/testing/libfuzzer/fuzzer_test.gni @@ -0,0 +1,11 @@ +# Copyright 2019 The Flutter Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# This is a dummy implementation to satisfy the ANGLE build, using the no-op +# implementation from the real (Chromium) fuzzer_test.gni. +template("fuzzer_test") { + not_needed(invoker, "*") + group(target_name) { + } +} diff --git a/build/secondary/testing/test.gni b/build/secondary/testing/test.gni new file mode 100644 index 0000000000..ff724df089 --- /dev/null +++ b/build/secondary/testing/test.gni @@ -0,0 +1,6 @@ +# Copyright 2019 The Flutter Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# This is a dummy file to satisfy the ANGLE build. Flutter's use of ANGLE +# doesn't actually require any of the real content. diff --git a/build/secondary/third_party/jsoncpp/BUILD.gn b/build/secondary/third_party/jsoncpp/BUILD.gn new file mode 100644 index 0000000000..ff255b0add --- /dev/null +++ b/build/secondary/third_party/jsoncpp/BUILD.gn @@ -0,0 +1,11 @@ +# Copyright 2019 The Flutter Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# The ANGLE build rules have a target that depends on jsoncpp, but the Flutter +# engine never actually builds that target, so just this provides empty dummy +# dependencies to satisfy the generation-time resolution. +config("jsoncpp_config") { +} +group("jsoncpp") { +} diff --git a/build/secondary/third_party/swiftshader_flutter/BUILD.gn b/build/secondary/third_party/swiftshader_flutter/BUILD.gn index 5c6e6c3dd9..92fce32b6d 100644 --- a/build/secondary/third_party/swiftshader_flutter/BUILD.gn +++ b/build/secondary/third_party/swiftshader_flutter/BUILD.gn @@ -587,7 +587,7 @@ source_set("main") { shared_library("egl") { if (is_win) { - output_name = "libEGL" + output_name = "libswiftshader_libEGL" } else { output_name = "EGL" } @@ -645,7 +645,7 @@ shared_library("egl") { shared_library("gles") { if (is_win) { - output_name = "libGLESv2" + output_name = "libswiftshader_libGLESv2" } else { output_name = "GLESv2" } diff --git a/build/secondary/ui/ozone/ozone.gni b/build/secondary/ui/ozone/ozone.gni new file mode 100644 index 0000000000..5231439ad6 --- /dev/null +++ b/build/secondary/ui/ozone/ozone.gni @@ -0,0 +1,7 @@ +# Copyright 2019 The Flutter Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# ANGLE requires this variable, but it doesn't need to be configurable for +# Flutter so just unconditionally set it to false. +ozone_platform_gbm = false diff --git a/build_overrides/angle.gni b/build_overrides/angle.gni new file mode 100644 index 0000000000..cf0faacacb --- /dev/null +++ b/build_overrides/angle.gni @@ -0,0 +1,12 @@ +# Copyright 2019 The Flutter Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# The ANGLE build requires this file to point to the location of third-party +# dependencies. + +angle_googletest_dir = "//third_party/googletest/src" +angle_libpng_dir = "//third_party/libpng" +# Note: This path doesn't actually exist; see +# //build/secondary/third_party/jsoncpp/BUILD.gn +angle_jsoncpp_dir = "//third_party/jsoncpp" diff --git a/build_overrides/build.gni b/build_overrides/build.gni new file mode 100644 index 0000000000..dd18cef4fa --- /dev/null +++ b/build_overrides/build.gni @@ -0,0 +1,8 @@ +# Copyright 2019 The Flutter Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# Set for ANGLE. This buildroot is close enough to Chromium's buildroot +# (with the addition of some dummy files) to allow building in this mode; the +# non-Chromium build mode for ANGLE is far too different. +build_with_chromium = true