[Mlir-commits] [mlir] [MLIR][Python] move generated type stubs to build directory (PR #157697)
Maksim Levental
llvmlistbot at llvm.org
Tue Sep 9 09:03:12 PDT 2025
https://github.com/makslevental updated https://github.com/llvm/llvm-project/pull/157697
>From a8a04b000176d0e51ef551fb26cc7895cc44c088 Mon Sep 17 00:00:00 2001
From: makslevental <maksim.levental at gmail.com>
Date: Tue, 9 Sep 2025 08:52:59 -0700
Subject: [PATCH 1/2] [MLIR][Python] move generated type stubs to build
directory
---
mlir/cmake/modules/AddMLIRPython.cmake | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/mlir/cmake/modules/AddMLIRPython.cmake b/mlir/cmake/modules/AddMLIRPython.cmake
index 85c80276c1bcf..c066aff56f53d 100644
--- a/mlir/cmake/modules/AddMLIRPython.cmake
+++ b/mlir/cmake/modules/AddMLIRPython.cmake
@@ -307,14 +307,14 @@ function(add_mlir_python_modules name)
${_module_name}
${_extension_target}
${name}
- "${CMAKE_CURRENT_SOURCE_DIR}/mlir/_mlir_libs"
+ "${CMAKE_CURRENT_BINARY_DIR}/_mlir_libs"
OUTPUTS "${_generate_type_stubs}"
)
add_dependencies("${modules_target}" "${NB_STUBGEN_CUSTOM_TARGET}")
set(_stubgen_target "${MLIR_PYTHON_PACKAGE_PREFIX}.${_module_name}_type_stub_gen")
declare_mlir_python_sources(
${_stubgen_target}
- ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/mlir/_mlir_libs"
+ ROOT_DIR "${CMAKE_CURRENT_BINARY_DIR}/_mlir_libs"
ADD_TO_PARENT "${sources_target}"
SOURCES "${_generate_type_stubs}"
)
>From 02b2141de65f021917e15058af0b9d275d176de5 Mon Sep 17 00:00:00 2001
From: Maksim Levental <maksim.levental at gmail.com>
Date: Tue, 9 Sep 2025 09:03:04 -0700
Subject: [PATCH 2/2] Update AddMLIRPython.cmake
---
mlir/cmake/modules/AddMLIRPython.cmake | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/mlir/cmake/modules/AddMLIRPython.cmake b/mlir/cmake/modules/AddMLIRPython.cmake
index c066aff56f53d..ee6c87a8b635e 100644
--- a/mlir/cmake/modules/AddMLIRPython.cmake
+++ b/mlir/cmake/modules/AddMLIRPython.cmake
@@ -138,7 +138,8 @@ function(generate_type_stubs MODULE_NAME DEPENDS_TARGET MLIR_DEPENDS_TARGET OUTP
--recursive
--include-private
--output-dir
- "${OUTPUT_DIR}")
+ "${OUTPUT_DIR}"
+ --quiet)
list(TRANSFORM ARG_OUTPUTS PREPEND "${OUTPUT_DIR}/" OUTPUT_VARIABLE _generated_type_stubs)
add_custom_command(
More information about the Mlir-commits
mailing list