Skip to content
This repository was archived by the owner on Sep 7, 2022. It is now read-only.

windows prebuild #341

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
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. download `engine_dependencies` under `engine/libs`
2. copy and unzip `headerout.zip` under `engine\libs\engine_dependencies\src`
3. build command

build release
```
.\local_build_win.ps1
```
build debug
```
.\local_build_win.ps1 -mode debug
```
66 changes: 42 additions & 24 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 = True
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,22 +141,27 @@ def set_params():
def set_env_verb():
global platform
global flutter_root_path
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")
flutter_root_path = os.getenv('FLUTTER_ROOT_PATH')
else:
print("This environment variable has been set, skip")
env_path = os.getenv('PATH')
path_strings = re.split("[;:]", env_path)
for path in path_strings:
if path.endswith("depot_tools"):
global localLibPath

if localLibPath == False:
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")
flutter_root_path = os.getenv('FLUTTER_ROOT_PATH')
else:
print("This environment variable has been set, skip")
return
if platform == "windows":
os.environ["PATH"] = engine_path + "/depot_tools;" + os.environ["PATH"]
env_path = os.getenv('PATH')
path_strings = re.split("[;:]", env_path)
for path in path_strings:
if path.endswith("depot_tools"):
print("This environment variable has been set, skip")
return
if platform == "windows":
os.environ["PATH"] = engine_path + "/depot_tools;" + os.environ["PATH"]
else:
os.environ["PATH"] = engine_path + "/depot_tools:" + os.environ["PATH"]
else:
os.environ["PATH"] = engine_path + "/depot_tools:" + os.environ["PATH"]
os.environ["FLUTTER_ROOT_PATH"] = os.path.join(engine_path, "src")

def get_depot_tools():
print("\nGetting Depot Tools...")
Expand Down Expand Up @@ -505,6 +514,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 +534,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/engine_dependencies"

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