[Mlir-commits] [mlir] [MLIR] Fix MLIR shared library installation (PR #152195)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Tue Aug 5 13:15:35 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-mlir
Author: Boyana Norris (brnorris03)
<details>
<summary>Changes</summary>
When `LLVM_INSTALL_TOOLCHAIN_ONLY=ON`, the MLIR shared library (`libMLIR*`) is not installed even though it is built with the `INSTALL_WITH_TOOLCHAIN` argument to the `add_mlir_library(
` cmake function. This patch ensures that `libMLIR*` is installed when `LLVM_INSTALL_TOOLCHAIN_ONLY=ON`.
Patch verified [here](https://github.com/llvm/llvm-project/issues/151247#issuecomment-3156387055).
Closes #<!-- -->151247
---
Full diff: https://github.com/llvm/llvm-project/pull/152195.diff
1 Files Affected:
- (modified) mlir/cmake/modules/AddMLIR.cmake (+5-1)
``````````diff
diff --git a/mlir/cmake/modules/AddMLIR.cmake b/mlir/cmake/modules/AddMLIR.cmake
index ff4269ed7acd2..93b5b4766146b 100644
--- a/mlir/cmake/modules/AddMLIR.cmake
+++ b/mlir/cmake/modules/AddMLIR.cmake
@@ -388,6 +388,9 @@ function(add_mlir_library name)
if(TARGET ${name})
target_link_libraries(${name} INTERFACE ${LLVM_COMMON_LIBS})
+ if(ARG_INSTALL_WITH_TOOLCHAIN)
+ set_target_properties(${name} PROPERTIES MLIR_INSTALL_WITH_TOOLCHAIN TRUE)
+ endif()
if(NOT ARG_DISABLE_INSTALL)
add_mlir_library_install(${name})
endif()
@@ -617,7 +620,8 @@ endfunction(add_mlir_aggregate)
# This is usually done as part of add_mlir_library but is broken out for cases
# where non-standard library builds can be installed.
function(add_mlir_library_install name)
- if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+ get_target_property(_install_with_toolchain ${name} MLIR_INSTALL_WITH_TOOLCHAIN)
+ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY OR _install_with_toolchain)
get_target_export_arg(${name} MLIR export_to_mlirtargets UMBRELLA mlir-libraries)
install(TARGETS ${name}
COMPONENT ${name}
``````````
</details>
https://github.com/llvm/llvm-project/pull/152195
More information about the Mlir-commits
mailing list