mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-07 16:49:54 +00:00
Meta: Support Swift_Release preset in ladybird.py
This commit is contained in:
parent
a0173b342f
commit
ab661467e7
Notes:
github-actions[bot]
2025-06-11 17:56:04 +00:00
Author: https://github.com/ADKaster
Commit: ab661467e7
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5047
2 changed files with 35 additions and 1 deletions
|
@ -168,6 +168,32 @@ def pick_host_compiler(platform: Platform, cc: str, cxx: str) -> tuple[str, str]
|
|||
sys.exit(1)
|
||||
|
||||
|
||||
def pick_swift_compilers(platform: Platform, project_root: Path) -> tuple[Path, Path, Path]:
|
||||
if platform.host_system == HostSystem.Windows:
|
||||
print("Swift builds are not supported on Windows", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
if not shutil.which("swiftly"):
|
||||
print("swiftly is required to manage Swift toolchains", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
swiftly_toolchain_path = run_command(["swiftly", "use", "--print-location"], return_output=True, cwd=project_root)
|
||||
if not swiftly_toolchain_path:
|
||||
run_command(["swiftly", "install"], exit_on_failure=True, cwd=project_root)
|
||||
swiftly_toolchain_path = run_command(
|
||||
["swiftly", "use", "--print-location"], return_output=True, exit_on_failure=True, cwd=project_root
|
||||
)
|
||||
|
||||
swiftly_toolchain_path = Path(swiftly_toolchain_path.strip())
|
||||
swiftly_bin_dir = swiftly_toolchain_path.joinpath("usr", "bin")
|
||||
|
||||
if not swiftly_toolchain_path.exists() or not swiftly_bin_dir.exists():
|
||||
print(f"swiftly toolchain path {swiftly_toolchain_path} does not exist", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
return swiftly_bin_dir / "clang", swiftly_bin_dir / "clang++", swiftly_bin_dir / "swiftc"
|
||||
|
||||
|
||||
def main():
|
||||
platform = Platform()
|
||||
(default_cc, default_cxx) = platform.default_compiler()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue