您最多选择25个主题 主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 
 
 
xingwei.zhu 1c25a3e9 Merge branch 'zxw/dev_mac_update_engine' of github.com:Unity-Technologies/com.unity.uiwidgets into zxw/dev_ios_update_engine 4 年前
..
src Merge branch 'zxw/dev_mac_update_engine' of github.com:Unity-Technologies/com.unity.uiwidgets into zxw/dev_ios_update_engine 4 年前
third_party/Unity Merge pull request #62 from Unity-Technologies/dev_1.17.5_merge_mac 4 年前
.gitignore pr fix 4 年前
Build.bee.cs compile engine for ios 4 年前
README.md Merge branch 'zxw/dev_mac_update_engine' of github.com:Unity-Technologies/com.unity.uiwidgets into zxw/dev_ios_update_engine 4 年前
bee.exe draft 4 年前
bee.pdb draft 4 年前

README.md

UIWidgets Engine

Introduction

This is the engine code of UIWidgets.

How to Build (Windows)

Build Skia

  1. Install depot_tools
git clone 'https://chromium.googlesource.com/chromium/tools/depot_tools.git'

Add ${PWD}/depot_tools to PATH

  1. Clone the skia Repo
git clone https://skia.googlesource.com/skia.git
cd skia
git checkout chrome/m85
python2 tools/git-sync-deps
  1. Install LLVM

https://clang.llvm.org/get_started.html

  1. Build skia
bin/gn gen out/Debug

Update out/Debug/args.gn with the following content:

clang_win = "C:\Program Files\LLVM"
win_vc = "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC"
cc = "clang"
cxx = "clang++"
is_debug = true
skia_use_angle = true
skia_use_egl = true
extra_cflags = [
  "/MTd",
  "-I../../third_party/externals/angle2/include",
]
ninja -C out/Debug -k 0

Ignore this error: "lld-link: error: could not open 'EGL': no such file or directory"

convert icudtl.dat to object file in skia

cd SkiaRoot/third_party/externals/icu/flutter/
ld -r -b binary -o icudtl.o icudtl.dat

Build flutter fml

  1. Setting up the Engine development environment

Follow https://github.com/flutter/flutter/wiki/Setting-up-the-Engine-development-environment

  1. Compiling for Windows

Follow https://github.com/flutter/flutter/wiki/Compiling-the-engine#compiling-for-windows

  1. Checkout flutter-1.17-candidate.5
cd engine/src/flutter
git checkout flutter-1.17-candidate.5
gclient sync -D

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",
   ]
 }
+
+static_library("fml_lib") {
+  complete_static_lib = true
+  deps = [
+    "//flutter/fml",
+  ]
+}

cmd

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

Create symbolic

cmd

cd <uiwidigets_dir>\engine
cd third_party   \\ create the directory if not exists
mklink /D skia <SKIA_ROOT>

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

cd <uiwidigets_dir>\engine
bee

How to Build (Mac)

Build Dependencies

Setting up the Engine development environment

Please follow https://github.com/flutter/flutter/wiki/Setting-up-the-Engine-development-environment.

Check out repo and update dependencies:

cd $FLUTTER_ROOT/flutter
git checkout flutter-1.17-candidate.5
gclient sync -D

Apply following to end of flutter/third_party/txt/BUILD.gn

diff --git a/third_party/txt/BUILD.gn b/third_party/txt/BUILD.gn
index 56b73a020..d42e88045 100644
--- 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("txt_lib") {
+  complete_static_lib = true
+  deps = [
+    ":txt",
+  ]
+}

Comiple engine:

cd $FLUTTER_ROOT
./flutter/tools/gn --unoptimized

add this line to the end of out/host_debug_unopt/args.gn:

icu_use_data_file=false

finally run ninja:

ninja -C out/host_debug_unopt/ flutter/third_party/txt:txt_lib

If the compilation fails because "no available Mac SDK is found" (in flutter-1.17 the build tool will only try to find Mac 10.XX SDKs), please modify the file "/src/build/Mac/find_sdk.py" under flutter root by setting "sdks" as your current sdk, e.g., ['11.0'].

Creat symbolic

Create symbolic as follows. 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.

cmd

cd <uiwidigets_dir>\engine
cd third_party   \\ create the directory if not exists
ln -s <SKIA_ROOT> skia

Build Engine

cd <uiwidigets_dir>\engine
mono bee.exe mac

How to Build (IOS)

The UIWidgets engine for iOS can only be built on Mac.

Preliminaries

There is a special settings, namely "Enable bitcode" we need set properly when building an ios native plugin. Generally, the program is possible to run faster when "Enable bitcode" is true while the size of the plugin will also become bigger.

You can choose to build the library with enabled or disabled "Enable bitcode" using different build commands as shown in the following two sections.

You can also build UIWidgets engine with enabled or disabled "Enable bitcode" by changing the value of "ios_bitcode_enabled" in "Build.bee.cs". Note that the value is set to false by default.

You can also change the setting of "Enable bitcode" in the XCode project generated by Unity. Specifically, you can find this setting in "Build Settings/Build Options/Enable Bitcode". This value is true by default.

You should always keep the "Enable bitcode" settings the same in the built library, the UIWidgets engine and the XCode project generated by your UIWidget project.

Build Dependencies

Setting up the Engine development environment

Please follow https://github.com/flutter/flutter/wiki/Setting-up-the-Engine-development-environment.

Check out repo and update dependencies:

cd $FLUTTER_ROOT/flutter
git checkout flutter-1.17-candidate.5
gclient sync -D

Apply following to end of flutter/third_party/txt/BUILD.gn

diff --git a/third_party/txt/BUILD.gn b/third_party/txt/BUILD.gn
index 56b73a020..d42e88045 100644
--- 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("txt_lib") {
+  complete_static_lib = true
+  deps = [
+    ":txt",
+  ]
+}

Comiple engine:

cd $FLUTTER_ROOT
./flutter/tools/gn --unoptimized --ios            //disable bitcode
./flutter/tools/gn --unoptimized --ios --bitcode  //enable bitcode
ninja -C out/ios_debug_unopt/ flutter/third_party/txt:txt_lib

If the compilation fails because "no available Mac SDK is found" (in flutter-1.17 the build tool will only try to find Mac 10.XX SDKs), please modify the file "/src/build/Mac/find_sdk.py" under flutter root by setting "sdks" as your current sdk, e.g., ['11.0'].

If the compilation fails because "'Foundation/NSURLHandle.h' file not found" (flutter-1.17 assumes that you are using some low iphone SDK (e.g., older than 12.2), in which some platform-dependent Macros are defined differently from new SDKs like 12.2), please modify the file "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/include/TargetConditionals.h" in your system by making "TARGET_OS_EMBEDDED = 1" and "TARGET_OS_MACCATALYST = 0" for arm64-iphone architecture. You can also work-around this issue by checking out a new version of flutter (e.g., "flutter-1.18-candidate.6") and run "gclient sync -D" to get dependencies on newer iphone SDKs. Then switch back and build.

Prepare icu data (TODO: try to build it into the library directly!)

move the built icu data file from $FLUTTER_ROOT/out/ios_debug_unopt/icudtl.dat to the StreamingAssets path

Creat symbolic

Create symbolic as follows. 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.

cmd

cd <uiwidigets_dir>\engine
cd third_party   \\ create the directory if not exists
ln -s <SKIA_ROOT> skia

Build Engine

cd <uiwidigets_dir>\engine
mono bee.exe ios