From 05de7626385b366b71e3a3430a73dcfc15a2c954 Mon Sep 17 00:00:00 2001 From: stuartmorgan Date: Wed, 10 Apr 2019 15:18:34 -0700 Subject: [PATCH] Add an option to build the GLFW shell on macOS (flutter/engine#8531) Since the GLFW shell is likely to continue to exist in at least the medium term, it is useful for maintenance to be able to build and use it on any desktop platform. Includes a buildroot roll to pick up the macOS build suppport for third_party/glfw. --- DEPS | 2 +- .../flutter/shell/platform/darwin/BUILD.gn | 2 +- .../shell/platform/darwin/macos/BUILD.gn | 25 +++++++++++++++++++ .../flutter/shell/platform/glfw/config.gni | 13 ++++++++++ 4 files changed, 40 insertions(+), 2 deletions(-) create mode 100644 engine/src/flutter/shell/platform/glfw/config.gni diff --git a/DEPS b/DEPS index 44e48a3b45..738b8ba796 100644 --- a/DEPS +++ b/DEPS @@ -120,7 +120,7 @@ allowed_hosts = [ ] deps = { - 'src': 'https://github.com/flutter/buildroot.git' + '@' + '5311c632822d0d2d4e4cf8cba3053cde5183c89c', + 'src': 'https://github.com/flutter/buildroot.git' + '@' + '94695026d9a1d8963089a470eef26470312c5b00', # Fuchsia compatibility # diff --git a/engine/src/flutter/shell/platform/darwin/BUILD.gn b/engine/src/flutter/shell/platform/darwin/BUILD.gn index 672ea4537e..71cccb6932 100644 --- a/engine/src/flutter/shell/platform/darwin/BUILD.gn +++ b/engine/src/flutter/shell/platform/darwin/BUILD.gn @@ -14,7 +14,7 @@ group("darwin") { } if (is_mac) { deps = [ - "macos:flutter_framework", + "macos", ] } } diff --git a/engine/src/flutter/shell/platform/darwin/macos/BUILD.gn b/engine/src/flutter/shell/platform/darwin/macos/BUILD.gn index 87c055bbda..5a9547639e 100644 --- a/engine/src/flutter/shell/platform/darwin/macos/BUILD.gn +++ b/engine/src/flutter/shell/platform/darwin/macos/BUILD.gn @@ -7,6 +7,21 @@ assert(is_mac) import("//build/config/mac/mac_sdk.gni") import("$flutter_root/common/config.gni") import("$flutter_root/shell/platform/darwin/framework_shared.gni") +import("$flutter_root/shell/platform/glfw/config.gni") + +group("macos") { + deps = [ + ":flutter_framework", + ] + if (build_glfw_shell) { + deps += [ + ":flutter_macos_glfw", + "$flutter_root/shell/platform/common/cpp/client_wrapper:publish_wrapper", + "$flutter_root/shell/platform/glfw:publish_headers_glfw", + "$flutter_root/shell/platform/glfw/client_wrapper:publish_wrapper_glfw", + ] + } +} _flutter_framework_name = "FlutterMacOS" _flutter_framework_filename = "$_flutter_framework_name.framework" @@ -194,3 +209,13 @@ group("flutter_framework") { ":_generate_symlinks", ] } + +if (build_glfw_shell) { + shared_library("flutter_macos_glfw") { + deps = [ + "$flutter_root/shell/platform/glfw:flutter_glfw", + ] + + public_configs = [ "$flutter_root:config" ] + } +} diff --git a/engine/src/flutter/shell/platform/glfw/config.gni b/engine/src/flutter/shell/platform/glfw/config.gni new file mode 100644 index 0000000000..8ac933d8dc --- /dev/null +++ b/engine/src/flutter/shell/platform/glfw/config.gni @@ -0,0 +1,13 @@ +# 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() { + # Whether to build the GLFW shell for the host platform, if available. + # + # By default, the GLFW shell is not built if there is a native toolkit shell, + # but it can be enabled for supported platforms (Windows, macOS, and Linux) + # as an extra build artifact with this flag. The native toolkit shell will + # still be built as well. + build_glfw_shell = is_linux || is_win +}