Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[mlir] [test] Fix missing SHLIB definition in standalone builds #120907

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mgorny
Copy link
Member

@mgorny mgorny commented Dec 22, 2024

Define the LLVM_SHLIB_OUTPUT_INTDIR variable that is used by configure_lit_site_cfg to fill SHLIBDIR. This fixes tool tests that would otherwise be unable to find MLIR's runtime shared libraries (e.g. libmlir_runner_utils.so). The logic is copied verbatim from Clang.

Define the `LLVM_SHLIB_OUTPUT_INTDIR` variable that is used
by `configure_lit_site_cfg` to fill `SHLIBDIR`.  This fixes tool tests
that would otherwise be unable to find MLIR's runtime shared libraries
(e.g. `libmlir_runner_utils.so`).  The logic is copied verbatim from
Clang.
@llvmbot llvmbot added the mlir label Dec 22, 2024
@llvmbot
Copy link
Member

llvmbot commented Dec 22, 2024

@llvm/pr-subscribers-mlir

Author: Michał Górny (mgorny)

Changes

Define the LLVM_SHLIB_OUTPUT_INTDIR variable that is used by configure_lit_site_cfg to fill SHLIBDIR. This fixes tool tests that would otherwise be unable to find MLIR's runtime shared libraries (e.g. libmlir_runner_utils.so). The logic is copied verbatim from Clang.


Full diff: https://github.com/llvm/llvm-project/pull/120907.diff

1 Files Affected:

  • (modified) mlir/CMakeLists.txt (+9)
diff --git a/mlir/CMakeLists.txt b/mlir/CMakeLists.txt
index 0608eef15c5a4b..99ea1b70fbc4d2 100644
--- a/mlir/CMakeLists.txt
+++ b/mlir/CMakeLists.txt
@@ -36,6 +36,15 @@ if(MLIR_STANDALONE_BUILD)
     "${CMAKE_CURRENT_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}")
   set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin")
 
+  # These definitions are needed to fill SHLIBDIR in tests.
+  set(LLVM_RUNTIME_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin)
+  set(LLVM_LIBRARY_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib${LLVM_LIBDIR_SUFFIX})
+  if(WIN32 OR CYGWIN)
+    # DLL platform -- put DLLs into bin.
+    set(LLVM_SHLIB_OUTPUT_INTDIR ${LLVM_RUNTIME_OUTPUT_INTDIR})
+  else()
+    set(LLVM_SHLIB_OUTPUT_INTDIR ${LLVM_LIBRARY_OUTPUT_INTDIR})
+  endif()
   set(LLVM_LIT_ARGS "-sv" CACHE STRING "Default options for lit")
 endif()
 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants