Skip to content

Conversation

makslevental
Copy link
Contributor

@makslevental makslevental commented Sep 9, 2025

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

@makslevental makslevental marked this pull request as ready for review September 9, 2025 16:04
@llvmbot llvmbot added the mlir label Sep 9, 2025
@llvmbot
Copy link
Member

llvmbot commented Sep 9, 2025

@llvm/pr-subscribers-mlir

Author: Maksim Levental (makslevental)

Changes

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


Full diff: https://github.com/llvm/llvm-project/pull/157697.diff

1 Files Affected:

  • (modified) mlir/cmake/modules/AddMLIRPython.cmake (+4-3)
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}"
         )

Copy link
Collaborator

@joker-eph joker-eph left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the quick fix!

@makslevental makslevental enabled auto-merge (squash) September 9, 2025 16:08
@makslevental makslevental merged commit 53bcfe2 into main Sep 9, 2025
12 checks passed
@makslevental makslevental deleted the users/makslevental/move-type-stubs branch September 9, 2025 16:12
ftynse added a commit that referenced this pull request Sep 10, 2025
ftynse added a commit that referenced this pull request Sep 10, 2025
Despite several hotfixes, things remain broken, in particular:

- installation/distribution (`ninja install / install-distribution`);
- downstream projects with bindings exposed.

See
#157583 (comment)
for more details.

Reverts #155741, #157583, #157697. Let's make sure things are fixed and
re-land as a unit.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants