@@ -99,7 +99,7 @@ function(declare_mlir_python_sources name)
99
99
endif ()
100
100
endfunction ()
101
101
102
- function (generate_type_stubs module_name depends_target output_dir )
102
+ function (generate_type_stubs module_name depends_target mlir_depends_target output_dir )
103
103
if (EXISTS ${nanobind_DIR} /../src/stubgen.py )
104
104
set (NB_STUBGEN "${nanobind_DIR} /../src/stubgen.py" )
105
105
elseif (EXISTS ${nanobind_DIR} /../stubgen.py )
@@ -108,11 +108,12 @@ function(generate_type_stubs module_name depends_target output_dir)
108
108
message (FATAL_ERROR "generate_type_stubs(): could not locate 'stubgen.py'!" )
109
109
endif ()
110
110
111
+ set (_module "${MLIR_PYTHON_PACKAGE_PREFIX} ._mlir_libs.${module_name} " )
111
112
set (NB_STUBGEN_CMD
112
113
"${Python_EXECUTABLE} "
113
114
"${NB_STUBGEN} "
114
115
--module
115
- "${MLIR_PYTHON_PACKAGE_PREFIX} ._mlir_libs. ${module_name } "
116
+ "${_module } "
116
117
-i
117
118
"${MLIR_BINARY_DIR} /${MLIR_BINDINGS_PYTHON_INSTALL_PREFIX} /.."
118
119
--recursive
@@ -125,8 +126,8 @@ function(generate_type_stubs module_name depends_target output_dir)
125
126
OUTPUT ${NB_STUBGEN_OUTPUT}
126
127
COMMAND ${NB_STUBGEN_CMD}
127
128
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR} "
128
- DEPENDS ${ depends_target} )
129
- set (_name "MLIRPythonModuleStubs_${module_name } " )
129
+ DEPENDS " ${mlir_depends_target} " " ${ depends_target}" )
130
+ set (_name "MLIRPythonModuleStubs_${_module } " )
130
131
add_custom_target ("${_name} " ALL DEPENDS ${NB_STUBGEN_OUTPUT} )
131
132
set (NB_STUBGEN_CUSTOM_TARGET "${_name} " PARENT_SCOPE )
132
133
endfunction ()
@@ -278,9 +279,11 @@ function(add_mlir_python_modules name)
278
279
generate_type_stubs (
279
280
${_module_name}
280
281
${_extension_target}
282
+ "${modules_target} .extension._mlir.dso"
281
283
"${CMAKE_CURRENT_SOURCE_DIR} /mlir/_mlir_libs/_mlir"
282
284
)
283
- declare_mlir_python_sources ("_${_module_name} _type_stub_gen"
285
+ declare_mlir_python_sources (
286
+ "${MLIR_PYTHON_PACKAGE_PREFIX} .${_module_name} _type_stub_gen"
284
287
ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR} /mlir"
285
288
ADD_TO_PARENT "${sources_target} "
286
289
SOURCES_GLOB "_mlir_libs/${_module_name} /**/*.pyi"
0 commit comments