From 0192ebe94ba8fc2969f349e0e85322f84469cf55 Mon Sep 17 00:00:00 2001 From: Jinjie Liu Date: Mon, 30 Mar 2026 17:07:53 +0800 Subject: [PATCH] cache torch_mlir prefix as a cmake var Signed-off-by: Jinjie Liu --- CMakeLists.txt | 2 ++ python/CMakeLists.txt | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5413da9d9bab..97071cfd71b4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,6 +33,8 @@ include(CMakeDependentOption) option(TORCH_MLIR_ENABLE_WERROR_FLAG "Enable `-Werror` flag on supported directories, treat warning as error" OFF) option(TORCH_MLIR_USE_INSTALLED_PYTORCH "If depending on PyTorch use it as installed in the current Python environment" ON) +set(TORCH_MLIR_PYTHON_PACKAGE_PREFIX "torch_mlir." CACHE STRING + "Python package prefix used for MLIR python bindings in torch-mlir") option(TORCH_MLIR_ENABLE_REFBACKEND "Enable reference backend" ON) diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index 27fbe6930559..28e6b050dd94 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -9,7 +9,7 @@ set(TORCH_MLIR_PYTHON_ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/torch_mlir") # We vendor our own MLIR instance in the `torch_mlir` namespace. -add_compile_definitions("MLIR_PYTHON_PACKAGE_PREFIX=torch_mlir.") +add_compile_definitions("MLIR_PYTHON_PACKAGE_PREFIX=${TORCH_MLIR_PYTHON_PACKAGE_PREFIX}") ################################################################################ # Sources