Skip to content

Commit 907c7b6

Browse files
committed
[MLIR][Python] fix stubgen for FetchContent users
1 parent d3c09c4 commit 907c7b6

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

mlir/cmake/modules/AddMLIRPython.cmake

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,16 @@ function(generate_type_stubs MODULE_NAME DEPENDS_TARGET MLIR_DEPENDS_TARGET OUTP
116116
""
117117
"OUTPUTS"
118118
${ARGN})
119+
# for people doing find_package(nanobind)
119120
if(EXISTS ${nanobind_DIR}/../src/stubgen.py)
120121
set(NB_STUBGEN "${nanobind_DIR}/../src/stubgen.py")
121122
elseif(EXISTS ${nanobind_DIR}/../stubgen.py)
122123
set(NB_STUBGEN "${nanobind_DIR}/../stubgen.py")
124+
# for people using FetchContent_Declare and FetchContent_MakeAvailable
125+
elseif(EXISTS ${nanobind_SOURCE_DIR}/src/stubgen.py)
126+
set(NB_STUBGEN "${nanobind_SOURCE_DIR}/src/stubgen.py")
127+
elseif(EXISTS ${nanobind_SOURCE_DIR}/stubgen.py)
128+
set(NB_STUBGEN "${nanobind_SOURCE_DIR}/stubgen.py")
123129
else()
124130
message(FATAL_ERROR "generate_type_stubs(): could not locate 'stubgen.py'!")
125131
endif()

0 commit comments

Comments
 (0)