Skip to content

Commit 2eb010d

Browse files
authored
[bazel] Restrict libpfm to linux (#86565)
This target doesn't build on macOS (even with the upstream make based build system) so this encodes that in the build without requiring non-linux users to disable it manually with the starlark flag. The flag is still respected for linux users.
1 parent 540bbe1 commit 2eb010d

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

utils/bazel/llvm-project-overlay/llvm/BUILD.bazel

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3161,8 +3161,10 @@ cc_library(
31613161
":Support",
31623162
":Target",
31633163
":config",
3164-
":maybe_pfm",
3165-
],
3164+
] + select({
3165+
"@platforms//os:linux": [":maybe_pfm"],
3166+
"//conditions:default": [],
3167+
}),
31663168
)
31673169

31683170
################################################################################

utils/bazel/third_party_build/pfm.BUILD

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,12 @@ make_variant(
1414
copts = ["-w"],
1515
lib_name = "libpfm",
1616
lib_source = ":sources",
17+
target_compatible_with = select({
18+
"@platforms//os:linux": [],
19+
"//conditions:default": ["@platforms//:incompatible"],
20+
}),
1721
toolchain = "@rules_foreign_cc//toolchains:preinstalled_autoconf_toolchain",
18-
visibility = ["//visibility:public"],
22+
visibility = ["//visibility:private"],
1923
)
2024

2125
alias(
@@ -27,5 +31,9 @@ alias(
2731
cc_library(
2832
name = "pfm_system",
2933
linkopts = ["-lpfm"],
30-
visibility = ["//visibility:public"],
34+
target_compatible_with = select({
35+
"@platforms//os:linux": [],
36+
"//conditions:default": ["@platforms//:incompatible"],
37+
}),
38+
visibility = ["//visibility:private"],
3139
)

0 commit comments

Comments
 (0)