CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
76 lines
2.4 KiB
Python
Executable File
76 lines
2.4 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
"""Calls `gn` with the right --dotfile= and --root= arguments for LLVM."""
|
|
|
|
# GN normally expects a file called '.gn' at the root of the repository.
|
|
# Since LLVM's GN build isn't supported, putting that file at the root
|
|
# is deemed inappropriate, which requires passing --dotfile= and -root= to GN.
|
|
# Since that gets old fast, this script automatically passes these arguments.
|
|
|
|
import os
|
|
import subprocess
|
|
import sys
|
|
|
|
|
|
THIS_DIR = os.path.dirname(__file__)
|
|
ROOT_DIR = os.path.join(THIS_DIR, "..", "..", "..")
|
|
|
|
|
|
def get_platform():
|
|
import platform
|
|
|
|
if sys.platform == "darwin":
|
|
return "mac-amd64" if platform.machine() != "arm64" else "mac-arm64"
|
|
if platform.machine() not in ("AMD64", "x86_64"):
|
|
return None
|
|
if sys.platform.startswith("linux"):
|
|
return "linux-amd64"
|
|
if sys.platform == "win32":
|
|
return "windows-amd64"
|
|
|
|
|
|
def print_no_gn(mention_get):
|
|
print("gn binary not found in PATH")
|
|
if mention_get:
|
|
print("run llvm/utils/gn/get.py to download a binary and try again, or")
|
|
print("follow https://gn.googlesource.com/gn/#getting-started")
|
|
return 1
|
|
|
|
|
|
def main():
|
|
# Find real gn executable.
|
|
gn = "gn"
|
|
if (
|
|
subprocess.call(
|
|
"gn --version",
|
|
stdout=subprocess.DEVNULL,
|
|
stderr=subprocess.STDOUT,
|
|
shell=True,
|
|
)
|
|
!= 0
|
|
):
|
|
# Not on path. See if get.py downloaded a prebuilt binary and run that
|
|
# if it's there, or suggest to run get.py if it isn't.
|
|
platform = get_platform()
|
|
if not platform:
|
|
return print_no_gn(mention_get=False)
|
|
gn = os.path.join(os.path.dirname(__file__), "bin", platform, "gn")
|
|
if not os.path.exists(gn + (".exe" if sys.platform == "win32" else "")):
|
|
return print_no_gn(mention_get=True)
|
|
|
|
# Compute --dotfile= and --root= args to add.
|
|
extra_args = []
|
|
gn_main_arg = next((x for x in sys.argv[1:] if not x.startswith("-")), None)
|
|
if gn_main_arg != "help": # `gn help` gets confused by the switches.
|
|
cwd = os.getcwd()
|
|
dotfile = os.path.relpath(os.path.join(THIS_DIR, ".gn"), cwd)
|
|
root = os.path.relpath(ROOT_DIR, cwd)
|
|
extra_args = ["--dotfile=" + dotfile, "--root=" + root]
|
|
|
|
# Run GN command with --dotfile= and --root= added.
|
|
cmd = [gn] + extra_args + sys.argv[1:]
|
|
sys.exit(subprocess.call(cmd))
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|