mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-14 15:46:32 +00:00
[mlir][python][cmake] Allows for specifying NB_DOMAIN
in add_mlir_python_extension
(#122865)
This PR allows the users to specify the `NB_DOMAIN` for `add_mlir_python_extension`. This allows users to avoid nanobind domain conflicts, when python bindings from multiple `mlir` projects were imported. (https://nanobind.readthedocs.io/en/latest/faq.html#how-can-i-avoid-conflicts-with-other-projects-using-nanobind)
This commit is contained in:
parent
77803e461c
commit
9e863cd449
@ -174,6 +174,8 @@ configure_file(
|
||||
# disable all package setup and control it themselves.
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
set(MLIR_BINDINGS_PYTHON_NB_DOMAIN "mlir"
|
||||
CACHE STRING "nanobind domain for MLIR python bindings.")
|
||||
set(MLIR_ENABLE_BINDINGS_PYTHON 0 CACHE BOOL
|
||||
"Enables building of Python bindings.")
|
||||
set(MLIR_DETECT_PYTHON_ENV_PRIME_SEARCH 1 CACHE BOOL
|
||||
|
@ -667,7 +667,7 @@ function(add_mlir_python_extension libname extname)
|
||||
)
|
||||
elseif(ARG_PYTHON_BINDINGS_LIBRARY STREQUAL "nanobind")
|
||||
nanobind_add_module(${libname}
|
||||
NB_DOMAIN mlir
|
||||
NB_DOMAIN ${MLIR_BINDINGS_PYTHON_NB_DOMAIN}
|
||||
FREE_THREADED
|
||||
${ARG_SOURCES}
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user