From 08b7d32c6896382085e685610b17ce744901b9c2 Mon Sep 17 00:00:00 2001 From: Duncan Ogilvie Date: Tue, 12 May 2026 13:13:53 +0200 Subject: [PATCH] Add support for experimental LLVM.dll --- cmake/FindLLVM-Wrapper.cmake | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/cmake/FindLLVM-Wrapper.cmake b/cmake/FindLLVM-Wrapper.cmake index 8831405..5ed8e04 100644 --- a/cmake/FindLLVM-Wrapper.cmake +++ b/cmake/FindLLVM-Wrapper.cmake @@ -90,6 +90,17 @@ endif() # Split the definitions properly (https://weliveindetail.github.io/blog/post/2017/07/17/notes-setup.html) separate_arguments(LLVM_DEFINITIONS) +# Support dynamically-linked LLVM.dll (experimental) +if(WIN32 AND EXISTS "${LLVM_TOOLS_BINARY_DIR}/LLVM.dll" AND NOT TARGET LLVM) + find_library(LLVM_LIB LLVM PATHS ${LLVM_LIBRARY_DIRS} NO_DEFAULT_PATH NO_CACHE REQUIRED) + add_library(LLVM SHARED IMPORTED) + set_target_properties(LLVM PROPERTIES + IMPORTED_IMPLIB "${LLVM_LIB}" + IMPORTED_LOCATION "${LLVM_TOOLS_BINARY_DIR}/LLVM.dll" + ) + # set(LLVM_LINK_LLVM_DYLIB ON) # TODO: this does not work +endif() + # https://github.com/JonathanSalwan/Triton/issues/1082#issuecomment-1030826696 if(LLVM_LINK_LLVM_DYLIB) set(LLVM-Wrapper_LIBS LLVM)