Skip to content

Commit 0dc58fc

Browse files
committed
fix windows
1 parent abc6f96 commit 0dc58fc

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

mlir/cmake/modules/AddMLIRPython.cmake

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,19 +103,23 @@ function(generate_type_stubs module_name depends_target mlir_depends_target outp
103103
if(EXISTS ${nanobind_DIR}/../src/stubgen.py)
104104
set(NB_STUBGEN "${nanobind_DIR}/../src/stubgen.py")
105105
elseif(EXISTS ${nanobind_DIR}/../stubgen.py)
106-
set(NB_STUBGEN "${nanobind_DIR}/../stubgen.py")
106+
set(NB_STUBGEN "${nanobind_DIR}/../stubgen.py")
107107
else()
108-
message(FATAL_ERROR "generate_type_stubs(): could not locate 'stubgen.py'!")
108+
message(FATAL_ERROR "generate_type_stubs(): could not locate 'stubgen.py'!")
109109
endif()
110+
file(REAL_PATH "${NB_STUBGEN}" NB_STUBGEN)
110111

111112
set(_module "${MLIR_PYTHON_PACKAGE_PREFIX}._mlir_libs.${module_name}")
113+
file(REAL_PATH "${MLIR_BINARY_DIR}/${MLIR_BINDINGS_PYTHON_INSTALL_PREFIX}/.." _import_path)
114+
# file(TO_NATIVE_PATH ${_import_path} _import_path)
115+
112116
set(NB_STUBGEN_CMD
113117
"${Python_EXECUTABLE}"
114118
"${NB_STUBGEN}"
115119
--module
116120
"${_module}"
117121
-i
118-
"${MLIR_BINARY_DIR}/${MLIR_BINDINGS_PYTHON_INSTALL_PREFIX}/.."
122+
"${_import_path}"
119123
--recursive
120124
--include-private
121125
--output-dir
@@ -125,7 +129,7 @@ function(generate_type_stubs module_name depends_target mlir_depends_target outp
125129
add_custom_command(
126130
OUTPUT ${NB_STUBGEN_OUTPUT}
127131
COMMAND ${NB_STUBGEN_CMD}
128-
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
132+
WORKING_DIRECTORY "${CMAKE_CURRENT_FUNCTION_LIST_DIR}"
129133
DEPENDS "${mlir_depends_target}" "${depends_target}")
130134
set(_name "MLIRPythonModuleStubs_${_module}")
131135
add_custom_target("${_name}" ALL DEPENDS ${NB_STUBGEN_OUTPUT})

0 commit comments

Comments
 (0)