diff --git a/Tools/build.py b/Tools/build.py index ee3dbac8..e1eb815e 100755 --- a/Tools/build.py +++ b/Tools/build.py @@ -14,7 +14,7 @@ from typing import Tuple from pathlib import Path import macos_sign import build_godot -from util import sha256, cd_repo_root_path, repo_root_path, zipdir, run, get_vs_env_dict, get_latest_git_tag, parse_semver, semver_to_string +from util import sha256, cd_repo_root_path, repo_root_path, zipdir, run, get_vs_env_dict, get_latest_git_tag, parse_semver, semver_to_string, check_universal_binary from sys import stdout stdout.reconfigure(encoding='utf-8') @@ -218,6 +218,8 @@ def package(build_config: BuildConfig): build_bin_dir=build_bin_dir, app="ScreenPlayWallpaper"), cwd=cwd) run(cmd=cmd_raw.format(qt_bin_path=qt_bin_path, repo_root_path=source_path, build_bin_dir=build_bin_dir, app="ScreenPlayWidget"), cwd=cwd) + + check_universal_binary() if platform.system() == "Windows": print("Executing deploy commands...") @@ -301,6 +303,7 @@ def package(build_config: BuildConfig): if file.is_file(): print("Remove: %s" % file.resolve()) file.unlink() + def build_installer(build_config: BuildConfig, build_result: BuildResult): diff --git a/Tools/util.py b/Tools/util.py index 0f00b965..bf7d6fcb 100644 --- a/Tools/util.py +++ b/Tools/util.py @@ -177,4 +177,39 @@ def unzip(zip_path: str, destination_path: str, specific_file: str = None): if specific_file: zip_ref.extract(specific_file, path=destination_path) else: - zip_ref.extractall(path=destination_path) \ No newline at end of file + zip_ref.extractall(path=destination_path) + + +def listfiles(path): + files = [] + extensions = ('.dylib', '.so','') + ignored = ('qmldir') + print(f"WALK: {path}") + for dirName, subdirList, fileList in os.walk(path): + dir = dirName.replace(path, '') + for fname in fileList: + if Path(fname).suffix in extensions and not fname in ignored: + file = path + os.path.join(dir, fname) + if(os.path.isfile(file)): + files.append(file) + if os.path.islink(file): + print(f"Warning: file {file} is a symlink!") + print("Symlink target: ", os.readlink(file)) + return files + + +def check_universal_binary(): + dir = 'build-64-osx-universal-release/bin/ScreenPlay.app/Contents' + path = Path.joinpath(repo_root_path(), dir).absolute() + print(f"Checking files at: {path}") + files = listfiles(str(path)) + none_fat_found = False + for file in files: + out = run_and_capture_output(f"lipo -info {file}") + if out.startswith('Non-fat'): + print(out) + none_fat_found = True + if none_fat_found: + print("✅ All files are a universal binaries") + else: + print("❌ None universal binaries found") \ No newline at end of file