Skip to content

Commit e3846c0

Browse files
authored
[mlir] [test] Fix missing SHLIB definition in standalone builds (#120907)
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.
1 parent 32962f2 commit e3846c0

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

mlir/CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,15 @@ if(MLIR_STANDALONE_BUILD)
3636
"${CMAKE_CURRENT_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}")
3737
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin")
3838

39+
# These definitions are needed to fill SHLIBDIR in tests.
40+
set(LLVM_RUNTIME_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin)
41+
set(LLVM_LIBRARY_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib${LLVM_LIBDIR_SUFFIX})
42+
if(WIN32 OR CYGWIN)
43+
# DLL platform -- put DLLs into bin.
44+
set(LLVM_SHLIB_OUTPUT_INTDIR ${LLVM_RUNTIME_OUTPUT_INTDIR})
45+
else()
46+
set(LLVM_SHLIB_OUTPUT_INTDIR ${LLVM_LIBRARY_OUTPUT_INTDIR})
47+
endif()
3948
set(LLVM_LIT_ARGS "-sv" CACHE STRING "Default options for lit")
4049
endif()
4150

0 commit comments

Comments
 (0)