浏览代码

windows build

/siyaoH-1.17-PlatformMessage
siyao 4 年前
当前提交
44c3b9d9
共有 3 个文件被更改,包括 202 次插入99 次删除
  1. 234
      engine/Build.bee.cs
  2. 63
      engine/README.md
  3. 4
      engine/src/shell/platform/unity/windows/unity_surface_manager.cc

234
engine/Build.bee.cs


np.Libraries.Add(c => IsWindows(c), new BagOfObjectFilesLibrary(
new NPath[]{
skiaRoot + "/third_party/externals/icu/flutter/icudtl.o"
flutterRoot + "/third_party/icu/flutter/icudtl.o"
}));
np.CompilerSettings().Add(c => c.WithCppLanguageVersion(CppLanguageVersion.Cpp17));
np.CompilerSettings().Add(c => IsMac(c), c => c.WithCustomFlags(new []{"-Wno-c++11-narrowing"}));

return np;
}
static void SetupFml(NativeProgram np)
{
np.Defines.Add(c => IsWindows(c), new[]
{
// gn desc out\host_debug_unopt\ //flutter/fml:fml_lib defines
"USE_OPENSSL=1",
"__STD_C",
"_CRT_RAND_S",
"_CRT_SECURE_NO_DEPRECATE",
"_HAS_EXCEPTIONS=0",
"_SCL_SECURE_NO_DEPRECATE",
"WIN32_LEAN_AND_MEAN",
"NOMINMAX",
"_ATL_NO_OPENGL",
"_WINDOWS",
"CERT_CHAIN_PARA_HAS_EXTRA_FIELDS",
"NTDDI_VERSION=0x06030000",
"PSAPI_VERSION=1",
"WIN32",
"_SECURE_ATL",
"_USING_V110_SDK71_",
"_UNICODE",
"UNICODE",
"_WIN32_WINNT=0x0603",
"WINVER=0x0603",
"_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS",
"_DEBUG",
"FLUTTER_RUNTIME_MODE_DEBUG=1",
"FLUTTER_RUNTIME_MODE_PROFILE=2",
"FLUTTER_RUNTIME_MODE_RELEASE=3",
"FLUTTER_RUNTIME_MODE_JIT_RELEASE=4",
"FLUTTER_RUNTIME_MODE=1",
"FLUTTER_JIT_RUNTIME=1",
});
np.Defines.Add(c => IsMac(c), new []
{
"USE_OPENSSL=1",
"__STDC_CONSTANT_MACROS",
"__STDC_FORMAT_MACROS",
"_FORTIFY_SOURCE=2",
"_LIBCPP_DISABLE_AVAILABILITY=1",
"_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
"_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS",
"_DEBUG",
"FLUTTER_RUNTIME_MODE_DEBUG=1",
"FLUTTER_RUNTIME_MODE_PROFILE=2",
"FLUTTER_RUNTIME_MODE_RELEASE=3",
"FLUTTER_RUNTIME_MODE_JIT_RELEASE=4",
"FLUTTER_RUNTIME_MODE=1",
"FLUTTER_JIT_RUNTIME=1"
});
np.IncludeDirectories.Add(flutterRoot);
var fmlLibPath = flutterRoot + "/out/host_debug_unopt";
np.Libraries.Add(c => IsWindows(c), c => {
return new PrecompiledLibrary[]
{
new StaticLibrary(fmlLibPath + "/obj/flutter/fml/fml_lib.lib"),
new SystemLibrary("Rpcrt4.lib"),
};
});
np.Libraries.Add(c => IsMac(c), c => {
return new PrecompiledLibrary[]
{
new StaticLibrary(fmlLibPath + "/obj/flutter/fml/libfml_lib.a"),
new SystemFramework("Foundation"),
};
});
}
var ignoreWarnigs = new string[] { "4244", "4267", "5030", "4101", "4996", "4359", "4018", "4091", "4722", "4312", "4838", "4172", "4005", "4311", "4477" }; // todo comparing the list with engine
np.CompilerSettings().Add(c => IsWindows(c), s => s.WithWarningPolicies(ignoreWarnigs.Select((code) => new WarningAndPolicy(code, WarningPolicy.Silent)).ToArray()));
np.Defines.Add(c => IsMac(c), new []
{

"ICU_UTIL_DATA_IMPL=ICU_UTIL_DATA_STATIC"
});
np.IncludeDirectories.Add(c => IsWindows(c), new NPath[] {
".",
"third_party",
"src",
flutterRoot,
flutterRoot+"/third_party/rapidjson/include",
flutterRoot +"/third_party/angle/include",
skiaRoot,
flutterRoot+"/flutter/third_party/txt/src",
flutterRoot + "/third_party/harfbuzz/src",
skiaRoot + "/third_party/externals/icu/source/common",
flutterRoot+"/third_party/icu/source/common",
flutterRoot+"/third_party/icu/source/i18n",
});
np.CompilerSettings().Add(c => IsWindows(c), c => c.WithCustomFlags(new [] {
"-D_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING",
"-DUSE_OPENSSL=1",
"-D__STD_C",
"-D_CRT_RAND_S",
"-D_CRT_SECURE_NO_DEPRECATE",
"-D_HAS_EXCEPTIONS=0",
"-D_SCL_SECURE_NO_DEPRECATE",
"-DWIN32_LEAN_AND_MEAN",
"-DNOMINMAX",
"-D_ATL_NO_OPENGL",
"-D_WINDOWS",
"-DCERT_CHAIN_PARA_HAS_EXTRA_FIELDS",
"-DNTDDI_VERSION=0x06030000",
"-DPSAPI_VERSION=1",
"-DWIN32",
"-D_SECURE_ATL",
"-D_USING_V110_SDK71_",
"-D_UNICODE",
"-DUNICODE",
"-D_WIN32_WINNT=0x0603",
"-DWINVER=0x0603",
"-D_DEBUG",
"-DU_USING_ICU_NAMESPACE=0",
"-DU_ENABLE_DYLOAD=0",
"-DUSE_CHROMIUM_ICU=1",
"-DU_STATIC_IMPLEMENTATION",
"-DICU_UTIL_DATA_IMPL=ICU_UTIL_DATA_FILE",
"-DUCHAR_TYPE=wchar_t",
"-DFLUTTER_RUNTIME_MODE_DEBUG=1",
"-DFLUTTER_RUNTIME_MODE_PROFILE=2",
"-DFLUTTER_RUNTIME_MODE_RELEASE=3",
"-DFLUTTER_RUNTIME_MODE_JIT_RELEASE=4",
"-DFLUTTER_RUNTIME_MODE=1",
"-DFLUTTER_JIT_RUNTIME=1",
"-DSK_ENABLE_SPIRV_VALIDATION",
"-D_CRT_SECURE_NO_WARNINGS",
"-D_HAS_EXCEPTIONS=0",
"-DWIN32_LEAN_AND_MEAN",
"-DNOMINMAX",
"-DSK_GAMMA_APPLY_TO_A8",
"-DSK_ALLOW_STATIC_GLOBAL_INITIALIZERS=1",
"-DGR_TEST_UTILS=1",
"-DSKIA_IMPLEMENTATION=1",
"-DSK_GL",
"-DSK_ENABLE_DUMP_GPU",
"-DSK_SUPPORT_PDF",
"-DSK_CODEC_DECODES_JPEG",
"-DSK_ENCODE_JPEG",
"-DSK_SUPPORT_XPS",
"-DSK_ENABLE_ANDROID_UTILS",
"-DSK_USE_LIBGIFCODEC",
"-DSK_HAS_HEIF_LIBRARY",
"-DSK_CODEC_DECODES_PNG",
"-DSK_ENCODE_PNG",
"-DSK_ENABLE_SKSL_INTERPRETER",
"-DSK_CODEC_DECODES_WEBP",
"-DSK_ENCODE_WEBP",
"-DSK_XML",
"-DLIBEGL_IMPLEMENTATION",
"-D_CRT_SECURE_NO_WARNINGS",
"-D_HAS_EXCEPTIONS=0",
"-DWIN32_LEAN_AND_MEAN",
"-DNOMINMAX",
"-DANGLE_ENABLE_ESSL",
"-DANGLE_ENABLE_GLSL",
"-DANGLE_ENABLE_HLSL",
"-DANGLE_ENABLE_OPENGL",
"-DEGL_EGLEXT_PROTOTYPES",
"-DGL_GLEXT_PROTOTYPES",
"-DANGLE_ENABLE_D3D11",
"-DANGLE_ENABLE_D3D9",
"-DGL_APICALL=",
"-DGL_API=",
"-DEGLAPI=",
//"-I../..",
//"-Igen",
//"-I../../third_party/icu/source/common",
//"-I../../third_party/icu/source/i18n",
//"-I../..",
//"-I../../third_party/dart/runtime",
//"-I../../third_party/dart/runtime/include",
"/GS",
"/FS",
//"/wd4091",
//"/wd4722",
//"/wd4312",
//"/wd4838",
//"/wd4172",
//"/wd4005",
//"/wd4311",
//"/wd4477",
"/MTd",
"/Od",
"/Ob0",
"/RTC1",
"/Zi",
"/WX",
"/std:c++17",
"/GR-",
}));
np.CompilerSettings().Add(c => IsMac(c), c => c.WithCustomFlags(new[] {
"-MD",
"-MF",

"-fvisibility-inlines-hidden",
}));
np.Libraries.Add(IsWindows, c =>
{
var basePath = skiaRoot + "/out/Debug";
return new PrecompiledLibrary[]
{
new StaticLibrary(flutterRoot+"/out/host_debug_unopt/obj/flutter/third_party/txt/txt_lib.lib"),
//new StaticLibrary("e:/flutter_engine/src/third_party/swiftshader/third_party/PowerVR_SDK/Builds/Windows/x86_64/Lib/libEGL.lib"),
//new StaticLibrary("e:/flutter_engine/src/third_party/swiftshader/third_party/PowerVR_SDK/Builds/Windows/x86_64/Lib/libGLESv2.lib"),
new StaticLibrary("e:/code/skia_repo/skia/out/Debug/libEGL.dll.lib"),
new StaticLibrary("e:/code/skia_repo/skia/out/Debug/libGLESv2.dll.lib"),
//new StaticLibrary(basePath + "/skia.lib"),
//new StaticLibrary(basePath + "/skottie.lib"),
//new StaticLibrary(basePath + "/sksg.lib"),
//new StaticLibrary(basePath + "/skshaper.lib"),
//new StaticLibrary(basePath + "/harfbuzz.lib"),
//new StaticLibrary(basePath + "/libEGL.dll.lib"),
//new StaticLibrary(basePath + "/libGLESv2.dll.lib"),
new SystemLibrary("Opengl32.lib"),
new SystemLibrary("User32.lib"),
new SystemLibrary("rpcrt4.lib"),
//new SystemLibrary("D3D12.lib"),
//new SystemLibrary("DXGI.lib"),
//new SystemLibrary("d3dcompiler.lib"),
// new SystemLibrary(basePath + "/obj/tools/trace/trace.ChromeTracingTracer.obj"),
// new SystemLibrary(basePath + "/obj/tools/trace/trace.EventTracingPriv.obj"),
// new SystemLibrary(basePath + "/obj/tools/trace/trace.SkDebugfTracer.obj"),
// new SystemLibrary(basePath + "/obj/tools/flags/flags.CommandLineFlags.obj"),
};
});
np.Libraries.Add(IsMac, c => {
return new PrecompiledLibrary[]

63
engine/README.md


```
Ignore this error: "lld-link: error: could not open 'EGL': no such file or directory"
convert icudtl.dat to object file in skia
convert icudtl.dat to object file in flutter
cd SkiaRoot/third_party/externals/icu/flutter/
cd flutterRoot/third_party/icu/flutter/
### Build flutter fml
### Build flutter txt
1. Setting up the Engine development environment

Apply the following diff:
```
diff --git a/fml/BUILD.gn b/fml/BUILD.gn
index 9b5626e78..da1322ce5 100644
--- a/fml/BUILD.gn
+++ b/fml/BUILD.gn
@@ -295,3 +295,10 @@ executable("fml_benchmarks") {
"//flutter/runtime:libdart",
--- a/third_party/txt/BUILD.gn
+++ b/third_party/txt/BUILD.gn
@@ -141,6 +141,7 @@ source_set("txt") {
"//third_party/harfbuzz",
"//third_party/icu",
"//third_party/skia",
+ "//third_party/skia/modules/skottie",
deps = [
@@ -339,3 +340,10 @@ executable("txt_benchmarks") {
deps += [ "//third_party/skia/modules/skparagraph" ]
}
+static_library("fml_lib") {
+static_library("txt_lib") {
+ "//flutter/fml",
+ ":txt",
cmd
#### `optional`
update `out\host_debug_unopt\args.gn`
set GYP_MSVS_OVERRIDE_PATH=C:\Program Files (x86)\Microsoft Visual Studio\2017\Community
cd engine/src
python ./flutter/tools/gn --unoptimized
ninja -C .\out\host_debug_unopt\ flutter/fml:fml_lib
skia_use_angle = true
skia_use_egl = true
### Create symbolic
update skia
```
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -524,6 +524,7 @@ optional("gpu") {
if (skia_use_gl) {
public_defines += [ "SK_GL" ]
+ include_dirs = [ "//third_party/angle/include" ]
if (is_android) {
sources += [ "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp" ]
```
cd <uiwidigets_dir>\engine
cd third_party   \\ create the directory if not exists
mklink /D skia <SKIA_ROOT>
set GYP_MSVS_OVERRIDE_PATH=C:\Program Files (x86)\Microsoft Visual Studio\2017\Community
cd engine/src
python ./flutter/tools/gn --unoptimized
ninja -C out\host_debug_unopt flutter/third_party/txt:txt_lib
Flutter engine txt include skia header in this pattern 'third_party/skia/*', so without symbolic, the txt lib will include skia
header file in flutter engine, instead of headers in skia repo.
### Build Engine

4
engine/src/shell/platform/unity/windows/unity_surface_manager.cc


EGLint displayAttribs[] = {EGL_PLATFORM_ANGLE_TYPE_ANGLE,
EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE,
EGL_PLATFORM_ANGLE_D3D_LUID_HIGH_ANGLE,
// EGL_PLATFORM_ANGLE_D3D_LUID_HIGH_ANGLE,
EGL_PLATFORM_ANGLE_D3D_LUID_LOW_ANGLE,
// EGL_PLATFORM_ANGLE_D3D_LUID_LOW_ANGLE,
adapter_desc.AdapterLuid.LowPart,
EGL_PLATFORM_ANGLE_ENABLE_AUTOMATIC_TRIM_ANGLE,
EGL_TRUE,

正在加载...
取消
保存