From 6cece67be663c3283a63e6f7c59b5391d566658b Mon Sep 17 00:00:00 2001 From: James Clarke Date: Sat, 6 Mar 2021 05:39:02 -0800 Subject: [PATCH 1/3] Switch build to using generated headers --- DEPS | 14 +++++++++++++- shell/platform/windows/BUILD.gn | 16 ++++++++++++++++ shell/platform/windows/angle_surface_manager.cc | 2 +- shell/platform/windows/flutter_window_winuwp.h | 14 +++++++------- shell/platform/windows/task_runner_winuwp.h | 2 +- shell/platform/windows/window_binding_handler.h | 2 +- 6 files changed, 39 insertions(+), 11 deletions(-) diff --git a/DEPS b/DEPS index 7dbfc2399e520..2fae54ddb543a 100644 --- a/DEPS +++ b/DEPS @@ -98,7 +98,9 @@ allowed_hosts = [ ] deps = { - 'src': 'https://github.com/flutter/buildroot.git' + '@' + 'd05290fdfb0b8d2aad3c60bf0b4a76f368616452', + #remove once https://github.com/flutter/buildroot/pull/442 lands + #'src': 'https://github.com/flutter/buildroot.git' + '@' + 'd05290fdfb0b8d2aad3c60bf0b4a76f368616452', + 'src': 'https://github.com/clarkezone/buildroot.git' + '@' + 'e7d24e56a77178a9fe0a13ee32e2a2ed785628b1', # Fuchsia compatibility # @@ -659,5 +661,15 @@ hooks = [ 'python', 'src/flutter/tools/run_third_party_dart.py', ] + }, + { + # This must run whenever the cppwinrt dependency is updated + # to regenerate winrt headers + 'name': 'Generate winrt headers', + 'pattern': '.', + 'action': [ + 'python', + 'src/build/win/generate_winrt_headers.py', + ] } ] diff --git a/shell/platform/windows/BUILD.gn b/shell/platform/windows/BUILD.gn index b3d5f4f60f433..c023e6d3fb350 100644 --- a/shell/platform/windows/BUILD.gn +++ b/shell/platform/windows/BUILD.gn @@ -21,6 +21,17 @@ config("relative_flutter_windows_headers") { include_dirs = [ "public" ] } +config("cppwinrt_defs") { + # Use winrt headers generated by the cppwinrt tool rather than those shipped in the installed SDK. + # The Windows metadata used to generate the headers does come from the installed SDK, by generating them rather than using the shipped ones + # the latest cppwinrt compatibility fixes can be derived. For example, clang support is broken in the winrt headers shipped in SDK 10.0.19041.0. + # By generating them in the flutter toolchain using the SDK 10.0.19041.0 metadata and the latest version of the cppwinrt tool, that SDK version can be supported. + # + # Generated with command bin\cppwinrt.exe -in sdk -out generated + # by src\build\win\generate_winrt_headers.py + include_dirs = [ "..\..\..\..\third_party\cppwinrt\generated" ] +} + # The headers are a separate source set since the client wrapper is allowed # to depend on the public headers, but none of the rest of the code. source_set("flutter_windows_headers") { @@ -119,6 +130,11 @@ source_set("flutter_windows_source") { ] } + if (target_os == "winuwp") { + configs += [ ":cppwinrt_defs" ] + cflags = [ "/EHsc" ] + } + configs += [ "//flutter/shell/platform/common:desktop_library_implementation", "//third_party/angle:gl_prototypes", diff --git a/shell/platform/windows/angle_surface_manager.cc b/shell/platform/windows/angle_surface_manager.cc index a7c6907faac19..cf952998eee60 100644 --- a/shell/platform/windows/angle_surface_manager.cc +++ b/shell/platform/windows/angle_surface_manager.cc @@ -8,8 +8,8 @@ #include #ifdef WINUWP +#include #include -#include #endif #if defined(WINUWP) && defined(USECOREWINDOW) diff --git a/shell/platform/windows/flutter_window_winuwp.h b/shell/platform/windows/flutter_window_winuwp.h index 5fc9df821f960..927ec98490b23 100644 --- a/shell/platform/windows/flutter_window_winuwp.h +++ b/shell/platform/windows/flutter_window_winuwp.h @@ -5,14 +5,14 @@ #ifndef FLUTTER_SHELL_PLATFORM_WINDOWS_UWP_FLUTTER_WINDOW_H_ #define FLUTTER_SHELL_PLATFORM_WINDOWS_UWP_FLUTTER_WINDOW_H_ -#include -#include -#include -#include - +#include +#include +#include +#include +#include +#include +#include #include -#include -#include #include "flutter/shell/platform/embedder/embedder.h" #include "flutter/shell/platform/windows/flutter_windows_view.h" diff --git a/shell/platform/windows/task_runner_winuwp.h b/shell/platform/windows/task_runner_winuwp.h index 654dd0e54dc97..d411a4c2c383a 100644 --- a/shell/platform/windows/task_runner_winuwp.h +++ b/shell/platform/windows/task_runner_winuwp.h @@ -7,7 +7,7 @@ #include -#include +#include #include #include diff --git a/shell/platform/windows/window_binding_handler.h b/shell/platform/windows/window_binding_handler.h index 0716b55c7c4d8..749fda203f56c 100644 --- a/shell/platform/windows/window_binding_handler.h +++ b/shell/platform/windows/window_binding_handler.h @@ -15,7 +15,7 @@ #include "flutter/shell/platform/windows/window_binding_handler_delegate.h" #ifdef WINUWP -#include +#include #endif namespace flutter { From 6f64de369ffabeaf29d619a8770ce173cbb460db Mon Sep 17 00:00:00 2001 From: James Clarke Date: Thu, 11 Mar 2021 18:48:27 -0800 Subject: [PATCH 2/3] Update DEPS to pick up newer buildroot --- DEPS | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/DEPS b/DEPS index f466056b0082f..653c8871314e2 100644 --- a/DEPS +++ b/DEPS @@ -97,9 +97,7 @@ allowed_hosts = [ ] deps = { - #remove once https://github.com/flutter/buildroot/pull/442 lands - #'src': 'https://github.com/flutter/buildroot.git' + '@' + 'd05290fdfb0b8d2aad3c60bf0b4a76f368616452', - 'src': 'https://github.com/clarkezone/buildroot.git' + '@' + 'e7d24e56a77178a9fe0a13ee32e2a2ed785628b1', + 'src': 'https://github.com/flutter/buildroot.git' + '@' + '33358ba597f875f6646522fd4ea86c1b31404d77', # Fuchsia compatibility # From feed1884f7ddcc1aac97c85bb4c42e256218c60d Mon Sep 17 00:00:00 2001 From: James Clarke Date: Thu, 11 Mar 2021 19:02:05 -0800 Subject: [PATCH 3/3] Only run hook on Windows --- DEPS | 1 + 1 file changed, 1 insertion(+) diff --git a/DEPS b/DEPS index 653c8871314e2..e7d5c75ab1c96 100644 --- a/DEPS +++ b/DEPS @@ -664,6 +664,7 @@ hooks = [ # to regenerate winrt headers 'name': 'Generate winrt headers', 'pattern': '.', + 'condition': 'download_windows_deps', 'action': [ 'python', 'src/build/win/generate_winrt_headers.py',