[llvm] [Bazel] Generate LLVM_HAS_XYZ_TARGET macros in llvm config (PR #94476)
Adam Paszke via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 5 07:34:50 PDT 2024
https://github.com/apaszke created https://github.com/llvm/llvm-project/pull/94476
Otherwise code that depends on those targets being enabled might not get compiled correctly even if the targets are explicitly included in the configuration (in my case NVVM target for MLIR).
>From 2137a80125e388c965c3ac1850a9ded04805843e Mon Sep 17 00:00:00 2001
From: Adam Paszke <adam.paszke at gmail.com>
Date: Wed, 5 Jun 2024 14:31:45 +0000
Subject: [PATCH] [Bazel] Generate LLVM_HAS_XYZ_TARGET macros in llvm config
Otherwise code that depends on those targets being enabled might not
get compiled correctly even if the targets are explicitly included
in the configuration (in my case NVVM target for MLIR).
---
utils/bazel/llvm-project-overlay/llvm/BUILD.bazel | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/utils/bazel/llvm-project-overlay/llvm/BUILD.bazel b/utils/bazel/llvm-project-overlay/llvm/BUILD.bazel
index a67f20533ae22..7fb284a1ee6a5 100644
--- a/utils/bazel/llvm-project-overlay/llvm/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/llvm/BUILD.bazel
@@ -164,6 +164,10 @@ td_library(
includes = ["include"],
)
+llvm_config_target_defines = [
+ "LLVM_HAS_{}_TARGET=1".format(t) for t in llvm_targets
+]
+
cc_library(
name = "config",
hdrs = [
@@ -171,7 +175,7 @@ cc_library(
"include/llvm/Config/llvm-config.h",
],
copts = llvm_copts,
- defines = llvm_config_defines,
+ defines = llvm_config_defines + llvm_config_target_defines,
includes = ["include"],
textual_hdrs = [
"include/llvm/Config/AsmParsers.def",
More information about the llvm-commits
mailing list