[llvm] [bazel] Make compiler-rt analyze on macOS (PR #86001)

Keith Smiley via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 20 13:14:57 PDT 2024


https://github.com/keith created https://github.com/llvm/llvm-project/pull/86001

Previously the select above would fail for non-linux platforms if you did a `bazel build @llvm-project//...`, now this target specifies that it's only supported on the linux platform through bazel's `target_compatible_with` feature. This makes all targets in the tree be ignored when building on incompatible platforms (and fail if built directly)

>From 728316c4266b54282693101763886fc57ba64f64 Mon Sep 17 00:00:00 2001
From: Keith Smiley <keithbsmiley at gmail.com>
Date: Wed, 20 Mar 2024 13:05:39 -0700
Subject: [PATCH] [bazel] Make compiler-rt analyze on macOS

Previously the select above would fail for non-linux platforms if you
did a `bazel build @llvm-project//...`, now this target specifies that
it's only supported on the linux platform through bazel's
`target_compatible_with` feature. This makes all targets in the tree be
ignored when building on incompatible platforms (and fail if built
directly)
---
 utils/bazel/llvm-project-overlay/compiler-rt/BUILD.bazel | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/utils/bazel/llvm-project-overlay/compiler-rt/BUILD.bazel b/utils/bazel/llvm-project-overlay/compiler-rt/BUILD.bazel
index 9bdd454e1e3641..577e6c033b4e81 100644
--- a/utils/bazel/llvm-project-overlay/compiler-rt/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/compiler-rt/BUILD.bazel
@@ -19,6 +19,10 @@ cc_library(
         ],
         # Will raise error unless supported platforms.
     }),
+    target_compatible_with = select({
+        "@platforms//os:linux": [],
+        "//conditions:default": ["@platforms//:incompatible"],
+    }),
 )
 
 WIN32_ONLY_FILES = [



More information about the llvm-commits mailing list