[Mlir-commits] [mlir] 53bcfe2 - [MLIR][Python] move generated type stubs to build directory (#157697)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Tue Sep 9 09:12:04 PDT 2025


Author: Maksim Levental
Date: 2025-09-09T16:12:00Z
New Revision: 53bcfe2a6ad4ea64837028caeab52c98f1ef3a43

URL: https://github.com/llvm/llvm-project/commit/53bcfe2a6ad4ea64837028caeab52c98f1ef3a43
DIFF: https://github.com/llvm/llvm-project/commit/53bcfe2a6ad4ea64837028caeab52c98f1ef3a43.diff

LOG: [MLIR][Python] move generated type stubs to build directory (#157697)

This PR moves generated type stubs to build directory and also quiets
stdout output.

Added: 
    

Modified: 
    mlir/cmake/modules/AddMLIRPython.cmake

Removed: 
    


################################################################################
diff  --git a/mlir/cmake/modules/AddMLIRPython.cmake b/mlir/cmake/modules/AddMLIRPython.cmake
index 85c80276c1bcf..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(
@@ -307,14 +308,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}"
         )


        


More information about the Mlir-commits mailing list