From 87ab6f5500be32c3ed7de465027561bd2e20ca00 Mon Sep 17 00:00:00 2001 From: Camillo Bruni Date: Thu, 2 Feb 2023 14:02:52 +0100 Subject: [PATCH] [tools] Better arm64 support for update-compile-commands.py - Mac Arm64 doesn't like cross-compiling to 32bit platforms - Build the language server and torque files for the host platform (x64, arm64) by default No-Try: true Change-Id: I4df68d416c58f58335fecc52b802c4bfe4ce2f24 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4218352 Commit-Queue: Jakob Kummerow Reviewed-by: Jakob Kummerow Auto-Submit: Camillo Bruni Cr-Commit-Position: refs/heads/main@{#85621} --- tools/dev/update-compile-commands.py | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/tools/dev/update-compile-commands.py b/tools/dev/update-compile-commands.py index 26e6be2c25..cf24ad6261 100755 --- a/tools/dev/update-compile-commands.py +++ b/tools/dev/update-compile-commands.py @@ -13,6 +13,11 @@ import json import os import subprocess import sys +import platform + +DEFAULT_ARCH = "x64" +if platform.machine() == "arm64": + DEFAULT_ARCH = "arm64" PYLIB_PATH = 'tools/clang/pylib' GM_PATH = 'tools/dev' @@ -73,9 +78,11 @@ def UpdateCompileCommands(): print(">>> Updating compile_commands.json...") combined = {} AddTargetsForArch("x64", combined) - AddTargetsForArch("ia32", combined) - AddTargetsForArch("arm", combined) AddTargetsForArch("arm64", combined) + if DEFAULT_ARCH != "arm64": + # Mac arm64 doesn't like 32bit platforms: + AddTargetsForArch("ia32", combined) + AddTargetsForArch("arm", combined) commands = [] for key in combined: commands.append(combined[key]) @@ -83,14 +90,16 @@ def UpdateCompileCommands(): def CompileLanguageServer(): print(">>> Compiling Torque Language Server...") - PrepareBuildDir("x64", "release") - _Call("autoninja -C out/x64.release torque-language-server") + PrepareBuildDir(DEFAULT_ARCH, "release") + _Call(f"autoninja -C out/{DEFAULT_ARCH}.release torque-language-server") + def GenerateCCFiles(): print(">>> Generating generated C++ source files...") # This must be called after UpdateCompileCommands(). - assert os.path.exists("out/x64.debug/build.ninja") - _Call("autoninja -C out/x64.debug v8_generated_cc_files") + assert os.path.exists(f"out/{DEFAULT_ARCH}.debug/build.ninja") + _Call(f"autoninja -C out/{DEFAULT_ARCH}.debug v8_generated_cc_files") + def StartGoma(): gomadir = gm.DetectGoma()