[llvm] [bazel] Add filegroups for MLIR bindings sources (PR #98396)
Keith Smiley via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 10 14:46:47 PDT 2024
https://github.com/keith created https://github.com/llvm/llvm-project/pull/98396
This can be useful if downstream projects configure their pybind differently, similar to how local_config_python isn't defined here.
>From 3d3c6af927acab28b11a34ffb796eeb56a80718d Mon Sep 17 00:00:00 2001
From: Keith Smiley <keithbsmiley at gmail.com>
Date: Wed, 10 Jul 2024 21:44:06 +0000
Subject: [PATCH] [bazel] Add filegroups for MLIR bindings sources
This can be useful if downstream projects configure their pybind
differently, similar to how local_config_python isn't defined here.
---
.../llvm-project-overlay/mlir/BUILD.bazel | 46 +++++++++++--------
1 file changed, 26 insertions(+), 20 deletions(-)
diff --git a/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel b/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel
index 2543ed8113f37..9fd82fa21f566 100644
--- a/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel
@@ -930,11 +930,14 @@ exports_files(
# Some out-of-tree projects alias @python_runtime//:headers to
# @local_config_python//:python_headers.
-MLIR_BINDINGS_PYTHON_HEADERS = [
- "lib/Bindings/Python/*.h",
- "include/mlir-c/Bindings/Python/*.h",
- "include/mlir/Bindings/Python/*.h",
-]
+filegroup(
+ name = "MLIRBindingsPythonHeaderFiles",
+ srcs = glob([
+ "lib/Bindings/Python/*.h",
+ "include/mlir-c/Bindings/Python/*.h",
+ "include/mlir/Bindings/Python/*.h",
+ ]),
+)
cc_library(
name = "MLIRBindingsPythonHeaders",
@@ -946,7 +949,7 @@ cc_library(
"manual", # External dependency
"nobuildkite", # TODO(gcmn): Add support for this target
],
- textual_hdrs = glob(MLIR_BINDINGS_PYTHON_HEADERS),
+ textual_hdrs = [":MLIRBindingsPythonHeaderFiles"],
deps = [
":CAPIIRHeaders",
":CAPITransformsHeaders",
@@ -965,7 +968,7 @@ cc_library(
"manual", # External dependency
"nobuildkite", # TODO(gcmn): Add support for this target
],
- textual_hdrs = glob(MLIR_BINDINGS_PYTHON_HEADERS),
+ textual_hdrs = [":MLIRBindingsPythonHeaderFiles"],
deps = [
":CAPIIR",
":CAPITransforms",
@@ -985,20 +988,23 @@ PYBIND11_FEATURES = [
"-use_header_modules",
]
-MLIR_PYTHON_BINDINGS_SOURCES = [
- "lib/Bindings/Python/IRAffine.cpp",
- "lib/Bindings/Python/IRAttributes.cpp",
- "lib/Bindings/Python/IRCore.cpp",
- "lib/Bindings/Python/IRInterfaces.cpp",
- "lib/Bindings/Python/IRModule.cpp",
- "lib/Bindings/Python/IRTypes.cpp",
- "lib/Bindings/Python/Pass.cpp",
- "lib/Bindings/Python/Rewrite.cpp",
-]
+filegroup(
+ name = "MLIRBindingsPythonSourceFiles",
+ srcs = [
+ "lib/Bindings/Python/IRAffine.cpp",
+ "lib/Bindings/Python/IRAttributes.cpp",
+ "lib/Bindings/Python/IRCore.cpp",
+ "lib/Bindings/Python/IRInterfaces.cpp",
+ "lib/Bindings/Python/IRModule.cpp",
+ "lib/Bindings/Python/IRTypes.cpp",
+ "lib/Bindings/Python/Pass.cpp",
+ "lib/Bindings/Python/Rewrite.cpp",
+ ],
+)
cc_library(
name = "MLIRBindingsPythonCore",
- srcs = MLIR_PYTHON_BINDINGS_SOURCES,
+ srcs = [":MLIRBindingsPythonSourceFiles"],
copts = PYBIND11_COPTS,
features = PYBIND11_FEATURES,
tags = [
@@ -1021,7 +1027,7 @@ cc_library(
cc_library(
name = "MLIRBindingsPythonCoreNoCAPI",
- srcs = MLIR_PYTHON_BINDINGS_SOURCES,
+ srcs = [":MLIRBindingsPythonSourceFiles"],
copts = PYBIND11_COPTS,
features = PYBIND11_FEATURES,
tags = [
@@ -1032,9 +1038,9 @@ cc_library(
":CAPIAsyncHeaders",
":CAPIDebugHeaders",
":CAPIIRHeaders",
- ":config",
":MLIRBindingsPythonHeaders",
":Support",
+ ":config",
"//llvm:Support",
"@local_config_python//:python_headers",
"@pybind11",
More information about the llvm-commits
mailing list