From e2200e84358b49ae618c9fe6f55a7e455db25563 Mon Sep 17 00:00:00 2001 From: Adrian <78108584+AdrianCassar@users.noreply.github.com> Date: Thu, 23 Apr 2026 01:01:34 +0100 Subject: [PATCH] [BUILD] Fixed clang format selecting wrong binary architecture --- xenia-build.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/xenia-build.py b/xenia-build.py index d7fbaee53..8cdd2135f 100755 --- a/xenia-build.py +++ b/xenia-build.py @@ -659,8 +659,11 @@ def get_clang_format_binary(): # Add Windows-specific paths if sys.platform == "win32": if "VCINSTALLDIR" in os.environ: - all_binaries.append(os.path.join(os.environ["VCINSTALLDIR"], "Tools", "Llvm", "x64", "bin", "clang-format.exe")) - all_binaries.append(os.path.join(os.environ["VCINSTALLDIR"], "Tools", "Llvm", "arm64", "bin", "clang-format.exe")) + if is_amd64(): + all_binaries.append(os.path.join(os.environ["VCINSTALLDIR"], "Tools", "Llvm", "x64", "bin", "clang-format.exe")) + elif is_arm(): + all_binaries.append(os.path.join(os.environ["VCINSTALLDIR"], "Tools", "Llvm", "arm64", "bin", "clang-format.exe")) + all_binaries.append(os.path.join(os.environ["ProgramFiles"], "LLVM", "bin", "clang-format.exe")) # Find the highest version available @@ -697,6 +700,11 @@ def normalize_target_arch(value): raise ArgumentTypeError( f"unknown architecture '{value}' (expected: arm64, aarch64, a64, x64, amd64, x86_64, x86)") +def is_amd64(): + return normalize_target_arch(platform.machine()) in ("x64", "x86_64", "amd64", "x86") + +def is_arm(): + return normalize_target_arch(platform.machine()) in ("x64", "x86_64", "amd64", "x86") def get_build_dir(target_arch=None): """Returns the Ninja build directory for the given target architecture.