[llvm] [mlir] [mlir][Python] create MLIRPythonSupport (PR #171775)

Maksim Levental via llvm-commits llvm-commits at lists.llvm.org
Sat Dec 27 10:26:37 PST 2025


================
@@ -356,8 +443,36 @@ function(add_mlir_python_modules name)
   # Build the modules target.
   add_custom_target(${name} ALL)
   _flatten_mlir_python_targets(_flat_targets ${ARG_DECLARED_SOURCES})
+
+  # Build all support libs first.
+  set(_mlir_python_support_libs)
+  foreach(sources_target ${_flat_targets})
+    get_target_property(_source_type ${sources_target} mlir_python_SOURCES_TYPE)
+    if(_source_type STREQUAL "support")
+      get_target_property(_module_name ${sources_target} mlir_python_EXTENSION_MODULE_NAME)
+      # Use a similar mechanism as nanobind to help the runtime loader pick the correct lib.
+      set(_module_name "${_module_name}-${ARG_MLIR_BINDINGS_PYTHON_NB_DOMAIN}")
+      set(_extension_target "${name}.extension.${_module_name}.dso")
----------------
makslevental wrote:

done

https://github.com/llvm/llvm-project/pull/171775


More information about the llvm-commits mailing list