Skip to content

Commit 66a6fd2

Browse files
[lldb] Fix deps loading for lldb-python on Windows and Python3.8+
1 parent d7f3d78 commit 66a6fd2

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

lldb/bindings/python/CMakeLists.txt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,24 @@ function(finish_swig_python swig_target lldb_python_bindings_dir lldb_python_tar
196196
COMMENT "Copying Python DLL to LLDB binaries directory.")
197197
endif()
198198

199+
# Since Python3.8 the Windows runtime loads dependent DLLs only from the directory of the binary
200+
# itself (and not Path). Windows has no RPATHs, so we must copy all DLLs that we depend on into
201+
# the Python package.
202+
if (WIN32)
203+
# TARGET_RUNTIME_DLLS is supported in CMake 3.21+
204+
if ("${CMAKE_VERSION}" VERSION_LESS "3.21.0")
205+
if (LLDB_INCLUDE_TESTS)
206+
message(SEND_ERROR
207+
"Your CMake version is ${CMAKE_VERSION}. In order to run LLDB tests "
208+
"on Windows please upgrade to 3.21.0 at least (or disable tests with "
209+
"LLDB_INCLUDE_TESTS=Off)")
210+
endif()
211+
else()
212+
add_custom_command(TARGET ${swig_target} POST_BUILD
213+
COMMAND ${CMAKE_COMMAND} -E copy -t ${lldb_python_target_dir} $<TARGET_RUNTIME_DLLS:liblldb>
214+
COMMAND_EXPAND_LISTS)
215+
endif()
216+
endif()
199217

200218
endfunction()
201219

0 commit comments

Comments
 (0)