aboutsummaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorMaksim Levental <maksim.levental@gmail.com>2025-10-06 13:17:04 -0400
committerGitHub <noreply@github.com>2025-10-06 17:17:04 +0000
commit84a214856ad989f37af19f5e8aaa9ec2346dde6f (patch)
tree5d27623df5613fff2bd0abb2a362b9d44e5c6e4a /utils
parent2f3bb7678182182e47b0ab5e23fa09edaa390414 (diff)
downloadllvm-84a214856ad989f37af19f5e8aaa9ec2346dde6f.tar.gz
llvm-84a214856ad989f37af19f5e8aaa9ec2346dde6f.tar.bz2
llvm-84a214856ad989f37af19f5e8aaa9ec2346dde6f.zip
[MLIR][Python] use `FetchContent_Declare` for nanobind and remove pybind (#161230)
Inspired by this comment https://github.com/llvm/llvm-project/pull/157930#issuecomment-3346634290 (and long-standing issues related to finding nanobind/pybind in the right place), this PR moves to using `FetchContent_Declare` to get the nanobind dependency. This is pretty standard (see e.g., [IREE](https://github.com/iree-org/iree/blob/cf60359b7443b0e92e15fb6ffc011525dc40e772/CMakeLists.txt#L842-L848)). This PR also removes pybind which has been deprecated for almost a year (https://github.com/llvm/llvm-project/pull/117922) and which isn't compatible (for whatever reason) with `FetchContent_Declare`. --------- Co-authored-by: Jacques Pienaar <jpienaar@google.com>
Diffstat (limited to 'utils')
-rw-r--r--utils/bazel/llvm-project-overlay/mlir/BUILD.bazel54
1 files changed, 19 insertions, 35 deletions
diff --git a/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel b/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel
index 422c29fc9c4d..0c77a1e62723 100644
--- a/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel
@@ -1049,32 +1049,6 @@ filegroup(
)
cc_library(
- name = "MLIRBindingsPythonHeaders",
- includes = [
- "include",
- ],
- textual_hdrs = [":MLIRBindingsPythonHeaderFiles"],
- deps = [
- ":CAPIIRHeaders",
- "@pybind11",
- "@rules_python//python/cc:current_py_cc_headers",
- ],
-)
-
-cc_library(
- name = "MLIRBindingsPythonHeadersAndDeps",
- includes = [
- "include",
- ],
- textual_hdrs = [":MLIRBindingsPythonHeaderFiles"],
- deps = [
- ":CAPIIR",
- "@pybind11",
- "@rules_python//python/cc:current_py_cc_headers",
- ],
-)
-
-cc_library(
name = "MLIRBindingsPythonNanobindHeaders",
includes = [
"include",
@@ -1087,6 +1061,11 @@ cc_library(
],
)
+alias(
+ name = "MLIRBindingsPythonHeaders",
+ actual = ":MLIRBindingsPythonNanobindHeaders",
+)
+
cc_library(
name = "MLIRBindingsPythonNanobindHeadersAndDeps",
includes = [
@@ -1100,6 +1079,11 @@ cc_library(
],
)
+alias(
+ name = "MLIRBindingsPythonHeadersAndDeps",
+ actual = ":MLIRBindingsPythonNanobindHeadersAndDeps",
+)
+
# These flags are needed for pybind11 to work.
PYBIND11_COPTS = [
"-fexceptions",
@@ -1147,7 +1131,7 @@ cc_library(
":CAPIIR",
":CAPIInterfaces",
":CAPITransforms",
- ":MLIRBindingsPythonNanobindHeadersAndDeps",
+ ":MLIRBindingsPythonHeadersAndDeps",
":Support",
":config",
"//llvm:Support",
@@ -1170,7 +1154,7 @@ cc_library(
":CAPIDebugHeaders",
":CAPIIRHeaders",
":CAPITransformsHeaders",
- ":MLIRBindingsPythonNanobindHeaders",
+ ":MLIRBindingsPythonHeaders",
":Support",
":config",
"//llvm:Support",
@@ -1220,7 +1204,7 @@ cc_binary(
linkstatic = 0,
deps = [
":CAPIIR",
- ":MLIRBindingsPythonNanobindHeadersAndDeps",
+ ":MLIRBindingsPythonHeadersAndDeps",
"@nanobind",
],
)
@@ -1238,7 +1222,7 @@ cc_binary(
deps = [
":CAPIIR",
":CAPILinalg",
- ":MLIRBindingsPythonNanobindHeadersAndDeps",
+ ":MLIRBindingsPythonHeadersAndDeps",
"@nanobind",
],
)
@@ -1253,7 +1237,7 @@ cc_binary(
deps = [
":CAPIIR",
":CAPILLVM",
- ":MLIRBindingsPythonNanobindHeadersAndDeps",
+ ":MLIRBindingsPythonHeadersAndDeps",
"@nanobind",
],
)
@@ -1268,7 +1252,7 @@ cc_binary(
deps = [
":CAPIIR",
":CAPIQuant",
- ":MLIRBindingsPythonNanobindHeadersAndDeps",
+ ":MLIRBindingsPythonHeadersAndDeps",
"@nanobind",
],
)
@@ -1283,7 +1267,7 @@ cc_binary(
deps = [
":CAPIIR",
":CAPISparseTensor",
- ":MLIRBindingsPythonNanobindHeadersAndDeps",
+ ":MLIRBindingsPythonHeadersAndDeps",
"@nanobind",
],
)
@@ -1298,7 +1282,7 @@ cc_binary(
linkstatic = 0,
deps = [
":CAPIExecutionEngine",
- ":MLIRBindingsPythonNanobindHeadersAndDeps",
+ ":MLIRBindingsPythonHeadersAndDeps",
"@nanobind",
"@rules_python//python/cc:current_py_cc_headers",
],
@@ -1314,7 +1298,7 @@ cc_binary(
linkstatic = 0,
deps = [
":CAPILinalg",
- ":MLIRBindingsPythonNanobindHeadersAndDeps",
+ ":MLIRBindingsPythonHeadersAndDeps",
"@nanobind",
"@rules_python//python/cc:current_py_cc_headers",
],