[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 <jkummerow@chromium.org>
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Auto-Submit: Camillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/main@{#85621}
This commit is contained in:
Camillo Bruni 2023-02-02 14:02:52 +01:00 committed by V8 LUCI CQ
parent 4001e14901
commit 87ab6f5500

View File

@ -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()