diff --git a/engine/.gitignore b/engine/.gitignore index 526d64dc..9cd8c3e1 100644 --- a/engine/.gitignore +++ b/engine/.gitignore @@ -4,4 +4,5 @@ artifacts build obj *.gen.* -third_party/skia \ No newline at end of file +third_party/skia +libs \ No newline at end of file diff --git a/engine/Scripts/Readme.md b/engine/Scripts/Readme.md new file mode 100644 index 00000000..1f5de4ea --- /dev/null +++ b/engine/Scripts/Readme.md @@ -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 + ``` \ No newline at end of file diff --git a/engine/Scripts/lib_build.py b/engine/Scripts/lib_build.py index 2193f998..6fc024fb 100644 --- a/engine/Scripts/lib_build.py +++ b/engine/Scripts/lib_build.py @@ -21,6 +21,7 @@ flutter_root_path="" visual_studio_path="" architecture="" +localLibPath=False def get_opts(): # get intput agrs @@ -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': @@ -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...") @@ -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 @@ -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() \ No newline at end of file diff --git a/engine/Scripts/local_build_win.ps1 b/engine/Scripts/local_build_win.ps1 new file mode 100644 index 00000000..427090db --- /dev/null +++ b/engine/Scripts/local_build_win.ps1 @@ -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 \ No newline at end of file