Skip to content
This repository was archived by the owner on Sep 7, 2022. It is now read-only.
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion engine/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ artifacts
build
obj
*.gen.*
third_party/skia
third_party/skia
libs
47 changes: 40 additions & 7 deletions engine/Build.bee.cs
Original file line number Diff line number Diff line change
Expand Up @@ -223,12 +223,22 @@ static void DeployIOS()

static void Main()
{
flutterRoot = Environment.GetEnvironmentVariable("FLUTTER_ROOT_PATH");
if (string.IsNullOrEmpty(flutterRoot))
preBuildLibRoot = Environment.GetEnvironmentVariable("PREBUILD_LIB_ROOT_PATH");
if(preBuildLibRoot != null && preBuildLibRoot.Length > 0)
{
flutterRoot = Environment.GetEnvironmentVariable("USERPROFILE") + "/engine/src";
cachedHeader = Path.Combine(preBuildLibRoot, "windows");
flutterRoot = Path.Combine(preBuildLibRoot, "headerout");
skiaRoot = flutterRoot + "/third_party/skia";
useLocal = true;
}
else {
flutterRoot = Environment.GetEnvironmentVariable("FLUTTER_ROOT_PATH");
if (string.IsNullOrEmpty(flutterRoot))
{
flutterRoot = Environment.GetEnvironmentVariable("USERPROFILE") + "/engine/src";
}
skiaRoot = flutterRoot + "/third_party/skia";
}
skiaRoot = flutterRoot + "/third_party/skia";

try
{
Expand Down Expand Up @@ -279,6 +289,9 @@ static void Main()

private static string skiaRoot;
private static string flutterRoot;
private static string preBuildLibRoot;
private static string cachedHeader;
private static bool useLocal;
private static bool buildArm64;

//this setting is disabled by default, don't change it unless you know what you are doing
Expand Down Expand Up @@ -625,9 +638,13 @@ static NativeProgram SetupLibUIWidgets(UIWidgetsBuildTargetPlatform platform, ou
np.Sources.Add(c => IsAndroid(c), androidSource);

np.Libraries.Add(c => IsWindows(c), new BagOfObjectFilesLibrary(
useLocal? new NPath[]{
Path.Combine(preBuildLibRoot, "windows/icudtl.o")
} :
new NPath[]{
flutterRoot + "/third_party/icu/flutter/icudtl.o"
}));
}
));
np.CompilerSettings().Add(c => c.WithCppLanguageVersion(CppLanguageVersion.Cpp17));
np.CompilerSettings().Add(c => IsMac(c) || IsIosOrTvos(c), c => c.WithCustomFlags(new []{"-Wno-c++11-narrowing"}));

Expand Down Expand Up @@ -1299,7 +1316,15 @@ static void SetupDependency(NativeProgram np)
return IsWindows(c) && c.CodeGen == CodeGen.Debug;
}, c =>
{
return new PrecompiledLibrary[]
return useLocal ? new PrecompiledLibrary[]
{
new StaticLibrary(Path.Combine(preBuildLibRoot, "windows/debug/txt_lib.lib")),
new StaticLibrary(Path.Combine(preBuildLibRoot, "windows/debug/angle_lib.lib")),
new StaticLibrary(Path.Combine(preBuildLibRoot, "windows/debug/libEGL_static.lib")),
new StaticLibrary(Path.Combine(preBuildLibRoot, "windows/debug/libGLESv2_static.lib")),
new SystemLibrary("dxguid.lib"),
}
: new PrecompiledLibrary[]
{
new StaticLibrary(flutterRoot+"/out/host_debug_unopt/obj/flutter/third_party/txt/txt_lib.lib"),
new StaticLibrary(flutterRoot+"/out/host_debug_unopt/obj/third_party/angle/angle_lib.lib"),
Expand All @@ -1313,7 +1338,15 @@ static void SetupDependency(NativeProgram np)
return IsWindows(c) && c.CodeGen == CodeGen.Release;
}, c =>
{
return new PrecompiledLibrary[]
return useLocal ? new PrecompiledLibrary[]
{
new StaticLibrary(Path.Combine(preBuildLibRoot, "windows/release/txt_lib.lib")),
new StaticLibrary(Path.Combine(preBuildLibRoot, "windows/release/angle_lib.lib")),
new StaticLibrary(Path.Combine(preBuildLibRoot, "windows/release/libEGL_static.lib")),
new StaticLibrary(Path.Combine(preBuildLibRoot, "windows/release/libGLESv2_static.lib")),
new SystemLibrary("dxguid.lib"),
}
: new PrecompiledLibrary[]
{
new StaticLibrary(flutterRoot+"/out/host_release/obj/flutter/third_party/txt/txt_lib.lib"),
new StaticLibrary(flutterRoot+"/out/host_release/obj/third_party/angle/angle_lib.lib"),
Expand Down
13 changes: 13 additions & 0 deletions engine/Scripts/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
## build windows lib using prebuild libs
1. copy windows prebuilds under `engine/libs`
1. copy and unzip `headerout.zip` under `engine/libs`
2. build command

build release
```
.\local_build_win.ps1
```
build debug
```
.\local_build_win.ps1 -mode debug
```
36 changes: 26 additions & 10 deletions engine/Scripts/lib_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
flutter_root_path=""
visual_studio_path=""
architecture=""
localLibPath=False

def get_opts():
# get intput agrs
Expand All @@ -31,12 +32,15 @@ def get_opts():
global visual_studio_path
global platform
global architecture
global localLibPath

if len(sys.argv) < 2:
show_help()
sys.exit()
options, args = getopt.getopt(sys.argv[1:], 'r:p:m:v:eh',["arm64","help"])
options, args = getopt.getopt(sys.argv[1:], 'l:r:p:m:v:eh',["arm64","help"])
for opt, arg in options:
if opt == '-l':
localLibPath = arg
if opt == '-r':
engine_path = arg # set engine_path, depot_tools and flutter engine folder will be put into this path
elif opt == '-p':
Expand Down Expand Up @@ -137,6 +141,9 @@ def set_params():
def set_env_verb():
global platform
global flutter_root_path
global localLibPath

os.environ["PREBUILD_LIB_ROOT_PATH"] = localLibPath
flutter_root_path = os.getenv('FLUTTER_ROOT_PATH', 'null')
if flutter_root_path == 'null':
os.environ["FLUTTER_ROOT_PATH"] = os.path.join(engine_path, "engine","src")
Expand Down Expand Up @@ -505,6 +512,8 @@ def show_help():

required parameters:

-l build use local prebuild lib

-p Target platform, available values: android, windows, mac, ios

-m Build mode, available values: debug, release
Expand All @@ -523,16 +532,23 @@ def show_help():


def main():
global localLibPath

get_opts()
engine_path_check()
bitcode_conf()
set_params()
set_env_verb()
get_depot_tools()
get_flutter_engine()
compile_engine()
build_engine()
revert_patches()
if localLibPath == False:
engine_path_check()
bitcode_conf()
set_params()
set_env_verb()
get_depot_tools()
get_flutter_engine()
compile_engine()
build_engine()
revert_patches()
else:
bitcode_conf()
set_env_verb()
build_engine()

if __name__=="__main__":
main()
8 changes: 8 additions & 0 deletions engine/Scripts/local_build_win.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
param(
[Parameter()]
[String]$mode= "release"
)
$current_dir = Get-Location
$localLibsPath = Join-Path -Path $current_dir -ChildPath "../libs"

python3 lib_build.py -m $mode -p windows -l $localLibsPath