Skip to content

Commit

Permalink
Move the secondary build tree into the engine.
Browse files Browse the repository at this point in the history
Now, both the DEPS and the custom GN rules for them are in the same repo and
won't need a buildroot sibling patch + roll.

Part of flutter/flutter#67373. Pending landing of the buildroot patch in
flutter/buildroot#781 (the DEPS will be updated before landing and after the
presubs pass).
  • Loading branch information
chinmaygarde committed Oct 17, 2023
1 parent a34e1bd commit 81c1a8e
Show file tree
Hide file tree
Showing 50 changed files with 4,440 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -130,3 +130,4 @@ app.*.symbols

# Prebuilt binaries.
/prebuilts/
/build/secondary/third_party/protobuf
4 changes: 2 additions & 2 deletions DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ allowed_hosts = [
]

deps = {
'src': 'https://github.com/flutter/buildroot.git' + '@' + '60415e4cb48742a60ba3859d92bbdcb7d14841b0',
'src': 'https://github.com/flutter/buildroot.git' + '@' + '6f31be56e1058997feac2e93ff67fef21ae25eaf',

# Fuchsia compatibility
#
Expand Down Expand Up @@ -325,7 +325,7 @@ deps = {
'src/third_party/protobuf':
Var('fuchsia_git') + '/third_party/protobuf' + '@' + Var('dart_libprotobuf_rev'),

'src/build/secondary/third_party/protobuf':
'src/flutter/build/secondary/third_party/protobuf':
Var('fuchsia_git') + '/protobuf-gn' + '@' + Var('dart_protobuf_gn_rev'),

'src/third_party/dart':
Expand Down
125 changes: 125 additions & 0 deletions build/secondary/flutter/third_party/glfw/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
# Copyright 2013 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.

import("glfw_args.gni")

_checkout_dir = "//flutter/third_party/glfw"

config("relative_glfw_headers") {
include_dirs = [
"$_checkout_dir/include",
"$_checkout_dir/include/GLFW",
]
}

source_set("glfw") {
public = [
"$_checkout_dir/include/GLFW/glfw3.h",
"$_checkout_dir/include/GLFW/glfw3native.h",
]

sources = [
"$_checkout_dir/src/context.c",
"$_checkout_dir/src/egl_context.c",
"$_checkout_dir/src/init.c",
"$_checkout_dir/src/input.c",
"$_checkout_dir/src/monitor.c",
"$_checkout_dir/src/null_init.c",
"$_checkout_dir/src/null_joystick.c",
"$_checkout_dir/src/null_joystick.h",
"$_checkout_dir/src/null_monitor.c",
"$_checkout_dir/src/null_platform.h",
"$_checkout_dir/src/null_window.c",
"$_checkout_dir/src/osmesa_context.c",
"$_checkout_dir/src/platform.c",
"$_checkout_dir/src/vulkan.c",
"$_checkout_dir/src/window.c",
]

include_dirs = [ "$_checkout_dir/src" ]

public_configs = [ ":relative_glfw_headers" ]

if (is_win) {
sources += [
"$_checkout_dir/src/wgl_context.c",
"$_checkout_dir/src/win32_init.c",
"$_checkout_dir/src/win32_joystick.c",
"$_checkout_dir/src/win32_joystick.h",
"$_checkout_dir/src/win32_module.c",
"$_checkout_dir/src/win32_monitor.c",
"$_checkout_dir/src/win32_platform.h",
"$_checkout_dir/src/win32_thread.c",
"$_checkout_dir/src/win32_time.c",
"$_checkout_dir/src/win32_window.c",
]

defines = [ "_GLFW_WIN32" ]
} else if (is_linux) {
sources += [
"$_checkout_dir/src/glx_context.c",
"$_checkout_dir/src/linux_joystick.c",
"$_checkout_dir/src/linux_joystick.h",
"$_checkout_dir/src/posix_module.c",
"$_checkout_dir/src/posix_poll.c",
"$_checkout_dir/src/posix_poll.h",
"$_checkout_dir/src/posix_thread.c",
"$_checkout_dir/src/posix_thread.h",
"$_checkout_dir/src/posix_time.c",
"$_checkout_dir/src/posix_time.h",
"$_checkout_dir/src/x11_init.c",
"$_checkout_dir/src/x11_monitor.c",
"$_checkout_dir/src/x11_platform.h",
"$_checkout_dir/src/x11_window.c",
"$_checkout_dir/src/xkb_unicode.c",
"$_checkout_dir/src/xkb_unicode.h",
]

defines = [
"_GLFW_X11",
"_GLFW_HAS_XF86VM",
]

libs = [
"X11",
"Xcursor",
"Xinerama",
"Xrandr",
"Xxf86vm",
]
} else if (is_mac) {
sources += [
"$_checkout_dir/src/cocoa_init.m",
"$_checkout_dir/src/cocoa_joystick.h",
"$_checkout_dir/src/cocoa_joystick.m",
"$_checkout_dir/src/cocoa_monitor.m",
"$_checkout_dir/src/cocoa_platform.h",
"$_checkout_dir/src/cocoa_time.c",
"$_checkout_dir/src/cocoa_window.m",
"$_checkout_dir/src/nsgl_context.m",
"$_checkout_dir/src/posix_module.c",
"$_checkout_dir/src/posix_thread.c",
"$_checkout_dir/src/posix_thread.h",
]

defines = [ "_GLFW_COCOA" ]

cflags = [
"-Wno-deprecated-declarations",
"-Wno-objc-multiple-method-names",
]

frameworks = [
"CoreVideo.framework",
"IOKit.framework",
]
}

if (glfw_vulkan_library != "") {
defines += [ "_GLFW_VULKAN_LIBRARY=" + glfw_vulkan_library ]
}

configs -= [ "//build/config/compiler:chromium_code" ]
configs += [ "//build/config/compiler:no_chromium_code" ]
}
13 changes: 13 additions & 0 deletions build/secondary/flutter/third_party/glfw/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Name: GLFW
License: zlib/libpng (BSD-like)
Upstream Git: https://github.com/glfw/glfw
Version: 3.2.1
Description:

GLFW is an Open Source, multi-platform library for OpenGL, OpenGL ES and
Vulkan development on the desktop.

To update:
- Advance the pinned hash in DEPS, which should map the repository to
//third_party/glfw
- Update BUILD.gn if necessary for changes.
7 changes: 7 additions & 0 deletions build/secondary/flutter/third_party/glfw/glfw_args.gni
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Copyright 2013 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.

declare_args() {
glfw_vulkan_library = ""
}
50 changes: 50 additions & 0 deletions build/secondary/testing/gmock/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Copyright 2014 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.

config("gmock_config") {
# Gmock headers need to be able to find themselves.
include_dirs = [ "include" ]
}

static_library("gmock") {
# TODO http://crbug.com/412064 enable this flag all the time.
testonly = !is_component_build
sources = [
# Sources based on files in r173 of gmock.
"include/gmock/gmock-actions.h",
"include/gmock/gmock-cardinalities.h",
"include/gmock/gmock-generated-actions.h",
"include/gmock/gmock-generated-function-mockers.h",
"include/gmock/gmock-generated-matchers.h",
"include/gmock/gmock-generated-nice-strict.h",
"include/gmock/gmock-matchers.h",
"include/gmock/gmock-spec-builders.h",
"include/gmock/gmock.h",
"include/gmock/internal/gmock-generated-internal-utils.h",
"include/gmock/internal/gmock-internal-utils.h",
"include/gmock/internal/gmock-port.h",

#"src/gmock-all.cc", # Not needed by our build.
"src/gmock-cardinalities.cc",
"src/gmock-internal-utils.cc",
"src/gmock-matchers.cc",
"src/gmock-spec-builders.cc",
"src/gmock.cc",
]

# This project includes some stuff form gtest's guts.
include_dirs = [ "../gtest/include" ]

public_configs = [
":gmock_config",
"//testing/gtest:gtest_config",
]
}

static_library("gmock_main") {
# TODO http://crbug.com/412064 enable this flag all the time.
testonly = !is_component_build
sources = [ "src/gmock_main.cc" ]
deps = [ ":gmock" ]
}
132 changes: 132 additions & 0 deletions build/secondary/testing/gtest/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
# Copyright 2014 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.

config("gtest_config") {
visibility = [
":*",
"//testing/gmock:*", # gmock also shares this config.
]

defines = [
# In order to allow regex matches in gtest to be shared between Windows
# and other systems, we tell gtest to always use it's internal engine.
"GTEST_HAS_POSIX_RE=0",

# Chrome doesn't support / require C++11, yet.
"GTEST_LANG_CXX11=0",
]

# Gtest headers need to be able to find themselves.
include_dirs = [ "include" ]

if (is_win) {
cflags = [ "/wd4800" ] # Unused variable warning.
}

if (is_posix) {
defines += [
# gtest isn't able to figure out when RTTI is disabled for gcc
# versions older than 4.3.2, and assumes it's enabled. Our Mac
# and Linux builds disable RTTI, and cannot guarantee that the
# compiler will be 4.3.2. or newer. The Mac, for example, uses
# 4.2.1 as that is the latest available on that platform. gtest
# must be instructed that RTTI is disabled here, and for any
# direct dependents that might include gtest headers.
"GTEST_HAS_RTTI=0",
]
}

if (is_android) {
defines += [
# We want gtest features that use tr1::tuple, but we currently
# don't support the variadic templates used by libstdc++'s
# implementation. gtest supports this scenario by providing its
# own implementation but we must opt in to it.
"GTEST_USE_OWN_TR1_TUPLE=1",

# GTEST_USE_OWN_TR1_TUPLE only works if GTEST_HAS_TR1_TUPLE is set.
# gtest r625 made it so that GTEST_HAS_TR1_TUPLE is set to 0
# automatically on android, so it has to be set explicitly here.
"GTEST_HAS_TR1_TUPLE=1",
]
}
}

config("gtest_direct_config") {
visibility = [ ":*" ]
defines = [ "UNIT_TEST" ]
}

config("gtest_warnings") {
visibility = [ ":*" ]
if (is_win && is_clang) {
# The Mutex constructor initializer list in gtest-port.cc is incorrectly
# ordered. See
# https://groups.google.com/d/msg/googletestframework/S5uSV8L2TX8/U1FaTDa6J6sJ.
cflags = [ "-Wno-reorder" ]
}
}

static_library("gtest") {
# TODO http://crbug.com/412064 enable this flag all the time.
testonly = !is_component_build
sources = [
"include/gtest/gtest-death-test.h",
"include/gtest/gtest-message.h",
"include/gtest/gtest-param-test.h",
"include/gtest/gtest-printers.h",
"include/gtest/gtest-spi.h",
"include/gtest/gtest-test-part.h",
"include/gtest/gtest-typed-test.h",
"include/gtest/gtest.h",
"include/gtest/gtest_pred_impl.h",
"include/gtest/internal/gtest-death-test-internal.h",
"include/gtest/internal/gtest-filepath.h",
"include/gtest/internal/gtest-internal.h",
"include/gtest/internal/gtest-linked_ptr.h",
"include/gtest/internal/gtest-param-util-generated.h",
"include/gtest/internal/gtest-param-util.h",
"include/gtest/internal/gtest-port.h",
"include/gtest/internal/gtest-string.h",
"include/gtest/internal/gtest-tuple.h",
"include/gtest/internal/gtest-type-util.h",

#"gtest/src/gtest-all.cc", # Not needed by our build.
"../multiprocess_func_list.cc",
"../multiprocess_func_list.h",
"../platform_test.h",
"src/gtest-death-test.cc",
"src/gtest-filepath.cc",
"src/gtest-internal-inl.h",
"src/gtest-port.cc",
"src/gtest-printers.cc",
"src/gtest-test-part.cc",
"src/gtest-typed-test.cc",
"src/gtest.cc",
]

if (is_mac) {
sources += [
"../gtest_mac.h",
"../gtest_mac.mm",
"../platform_test_mac.mm",
]
}

include_dirs = [ "." ]

all_dependent_configs = [ ":gtest_config" ]
public_configs = [ ":gtest_direct_config" ]

configs -= [ "//build/config/compiler:chromium_code" ]
configs += [ "//build/config/compiler:no_chromium_code" ]
configs += [ ":gtest_warnings" ]
}

source_set("gtest_main") {
# TODO http://crbug.com/412064 enable this flag all the time.
testonly = !is_component_build
sources = [ "src/gtest_main.cc" ]
deps = [ ":gtest" ]
}
11 changes: 11 additions & 0 deletions build/secondary/testing/libfuzzer/fuzzer_test.gni
Original file line number Diff line number Diff line change
@@ -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) {
}
}
6 changes: 6 additions & 0 deletions build/secondary/testing/test.gni
Original file line number Diff line number Diff line change
@@ -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.
9 changes: 9 additions & 0 deletions build/secondary/third_party/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Copyright 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.

source_set("fontconfig") {
if (is_linux) {
libs = [ "fontconfig" ]
}
}
8 changes: 8 additions & 0 deletions build/secondary/third_party/android_ndk/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Copyright 2013 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.

source_set("cpu_features") {
public_configs = [ "//third_party/android_tools:cpu_features_include" ]
deps = [ "//third_party/android_tools:cpu_features" ]
}
Loading

0 comments on commit 81c1a8e

Please sign in to comment.