未验证 提交 57a401ae 编写于 作者: J James Clarke 提交者: GitHub

Windows: Switch UWP build to using winrt generated headers (#24861)

* Switch build to using generated headers

* Update DEPS to pick up newer buildroot

* Only run hook on Windows
上级 31ec057b
......@@ -97,7 +97,7 @@ allowed_hosts = [
]
deps = {
'src': 'https://github.com/flutter/buildroot.git' + '@' + 'd05290fdfb0b8d2aad3c60bf0b4a76f368616452',
'src': 'https://github.com/flutter/buildroot.git' + '@' + '33358ba597f875f6646522fd4ea86c1b31404d77',
# Fuchsia compatibility
#
......@@ -658,5 +658,16 @@ 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': '.',
'condition': 'download_windows_deps',
'action': [
'python',
'src/build/win/generate_winrt_headers.py',
]
}
]
......@@ -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",
......
......@@ -8,8 +8,8 @@
#include <vector>
#ifdef WINUWP
#include <third_party/cppwinrt/generated/winrt/Windows.UI.Composition.h>
#include <windows.ui.core.h>
#include <winrt/Windows.UI.Composition.h>
#endif
#if defined(WINUWP) && defined(USECOREWINDOW)
......
......@@ -5,14 +5,14 @@
#ifndef FLUTTER_SHELL_PLATFORM_WINDOWS_UWP_FLUTTER_WINDOW_H_
#define FLUTTER_SHELL_PLATFORM_WINDOWS_UWP_FLUTTER_WINDOW_H_
#include <winrt/Windows.Graphics.Display.h>
#include <winrt/Windows.System.Profile.h>
#include <winrt/Windows.UI.Input.h>
#include <winrt/Windows.UI.ViewManagement.Core.h>
#include <third_party/cppwinrt/generated/winrt/Windows.Foundation.Collections.h>
#include <third_party/cppwinrt/generated/winrt/Windows.Graphics.Display.h>
#include <third_party/cppwinrt/generated/winrt/Windows.System.Profile.h>
#include <third_party/cppwinrt/generated/winrt/Windows.UI.Composition.h>
#include <third_party/cppwinrt/generated/winrt/Windows.UI.Core.h>
#include <third_party/cppwinrt/generated/winrt/Windows.UI.Input.h>
#include <third_party/cppwinrt/generated/winrt/Windows.UI.ViewManagement.Core.h>
#include <windows.ui.core.h>
#include <winrt/Windows.UI.Composition.h>
#include <winrt/Windows.UI.Core.h>
#include "flutter/shell/platform/embedder/embedder.h"
#include "flutter/shell/platform/windows/flutter_windows_view.h"
......
......@@ -7,7 +7,7 @@
#include <windows.h>
#include <winrt/Windows.UI.Core.h>
#include <third_party/cppwinrt/generated/winrt/Windows.UI.Core.h>
#include <chrono>
#include <functional>
......
......@@ -15,7 +15,7 @@
#include "flutter/shell/platform/windows/window_binding_handler_delegate.h"
#ifdef WINUWP
#include <winrt/Windows.UI.Composition.h>
#include <third_party/cppwinrt/generated/winrt/Windows.UI.Composition.h>
#endif
namespace flutter {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册