Skip to content

Commit 2463be2

Browse files
authored
Merge pull request #9370 from weliveindetail/lldb-python-deps-paths-fix
[lldb] Fix deps loading for lldb-python on Windows and Python3.8+
2 parents 298912a + 6e5ef15 commit 2463be2

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
@@ -198,6 +198,24 @@ function(finish_swig_python swig_target lldb_python_bindings_dir lldb_python_tar
198198
COMMENT "Copying Python DLL to LLDB binaries directory.")
199199
endif()
200200

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

202220
endfunction()
203221

0 commit comments

Comments
 (0)