Skip to content

Commit 653d0d0

Browse files
authored
[mlir][python] add MLIR_BINDINGS_PYTHON_INSTALL_PREFIX to make bindings install dir configurable (#124878)
This PR parameterizes the install directory of the MLIR Python bindings in the final distribution.
1 parent 7bc956d commit 653d0d0

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

mlir/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,8 @@ set(MLIR_BINDINGS_PYTHON_NB_DOMAIN "mlir"
184184
CACHE STRING "nanobind domain for MLIR python bindings.")
185185
set(MLIR_ENABLE_BINDINGS_PYTHON 0 CACHE BOOL
186186
"Enables building of Python bindings.")
187+
set(MLIR_BINDINGS_PYTHON_INSTALL_PREFIX "python_packages/mlir_core/mlir" CACHE STRING
188+
"Prefix under install directory to place python bindings")
187189
set(MLIR_DETECT_PYTHON_ENV_PRIME_SEARCH 1 CACHE BOOL
188190
"Prime the python detection by searching for a full 'Development' \
189191
component first (temporary while diagnosing environment specific Python \

mlir/python/CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ declare_mlir_dialect_python_bindings(
356356
ADD_TO_PARENT MLIRPythonSources.Dialects
357357
ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/mlir"
358358
TD_FILE dialects/EmitC.td
359-
SOURCES
359+
SOURCES
360360
dialects/emitc.py
361361
DIALECT_NAME emitc)
362362

@@ -790,7 +790,7 @@ endif()
790790

791791
add_mlir_python_common_capi_library(MLIRPythonCAPI
792792
INSTALL_COMPONENT MLIRPythonModules
793-
INSTALL_DESTINATION python_packages/mlir_core/mlir/_mlir_libs
793+
INSTALL_DESTINATION "${MLIR_BINDINGS_PYTHON_INSTALL_PREFIX}/_mlir_libs"
794794
OUTPUT_DIRECTORY "${MLIR_BINARY_DIR}/python_packages/mlir_core/mlir/_mlir_libs"
795795
RELATIVE_INSTALL_ROOT "../../../.."
796796
DECLARED_HEADERS
@@ -821,7 +821,7 @@ endif()
821821

822822
add_mlir_python_modules(MLIRPythonModules
823823
ROOT_PREFIX "${MLIR_BINARY_DIR}/python_packages/mlir_core/mlir"
824-
INSTALL_PREFIX "python_packages/mlir_core/mlir"
824+
INSTALL_PREFIX "${MLIR_BINDINGS_PYTHON_INSTALL_PREFIX}"
825825
DECLARED_SOURCES
826826
MLIRPythonSources
827827
MLIRPythonExtension.RegisterEverything

0 commit comments

Comments
 (0)