https://github.com/Nerixyz updated https://github.com/llvm/llvm-project/pull/197185
>From edd857999eef0ac7a5e6181318ec7c54d36d30f2 Mon Sep 17 00:00:00 2001 From: Nerixyz <[email protected]> Date: Mon, 11 May 2026 22:35:57 +0200 Subject: [PATCH 1/2] [lldb][Python] Include limited ABI library directory --- .../Plugins/ScriptInterpreter/Python/CMakeLists.txt | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/CMakeLists.txt b/lldb/source/Plugins/ScriptInterpreter/Python/CMakeLists.txt index 3bf70bf51f1e0..3c3c5a8a966e2 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Python/CMakeLists.txt +++ b/lldb/source/Plugins/ScriptInterpreter/Python/CMakeLists.txt @@ -69,6 +69,13 @@ if (LLDB_ENABLE_DYNAMIC_SCRIPTINTERPRETERS) ) target_include_directories(lldbStaticScriptInterpreterPython PUBLIC ${Python3_INCLUDE_DIRS}) + + if (WIN32) + # Add the library directories to allow Python to use #pragma comment(lib, "python3.lib"). + # FIXME: We should use Python3_SABI_LIBRARY_DIRS here, but this requires CMake 3.26. + target_link_directories(lldbPluginScriptInterpreterPython PRIVATE ${Python3_LIBRARY_DIRS}) + target_link_directories(lldbStaticScriptInterpreterPython PUBLIC ${Python3_LIBRARY_DIRS}) + endif() else() add_lldb_library(lldbPluginScriptInterpreterPython PLUGIN ${python_plugin_sources} @@ -85,6 +92,11 @@ else() ${Python3_LIBRARIES} ${LLDB_LIBEDIT_LIBS} ) + if (WIN32) + # Add the library directories to allow Python to use #pragma comment(lib, "python3.lib"). + # FIXME: We should use Python3_SABI_LIBRARY_DIRS here, but this requires CMake 3.26. + target_link_directories(lldbPluginScriptInterpreterPython PUBLIC ${Python3_LIBRARY_DIRS}) + endif() endif() target_include_directories(lldbPluginScriptInterpreterPython >From 10c86f0bda378172d9a567f8578ccbb57e9d358b Mon Sep 17 00:00:00 2001 From: Nerixyz <[email protected]> Date: Wed, 13 May 2026 14:00:37 +0200 Subject: [PATCH 2/2] fix: use variable for directory --- .../ScriptInterpreter/Python/CMakeLists.txt | 20 +++++++++---------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/CMakeLists.txt b/lldb/source/Plugins/ScriptInterpreter/Python/CMakeLists.txt index 3c3c5a8a966e2..574dcdf874ada 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Python/CMakeLists.txt +++ b/lldb/source/Plugins/ScriptInterpreter/Python/CMakeLists.txt @@ -37,6 +37,12 @@ set(python_plugin_sources Interfaces/ScriptedThreadPythonInterface.cpp ) +if (WIN32) + # Add the library directories to allow Python to use #pragma comment(lib, "python3.lib"). + # FIXME: We should use Python3_SABI_LIBRARY_DIRS here, but this requires CMake 3.26. + set(PYTHON_SABI_LIBRARY_DIRS ${Python3_LIBRARY_DIRS}) +endif() + if (LLDB_ENABLE_DYNAMIC_SCRIPTINTERPRETERS) # Shared library loaded at runtime by PluginManager. Private lldb symbols are # resolved via liblldb's re-exports, so lldb_private libs aren't linked here. @@ -70,12 +76,8 @@ if (LLDB_ENABLE_DYNAMIC_SCRIPTINTERPRETERS) target_include_directories(lldbStaticScriptInterpreterPython PUBLIC ${Python3_INCLUDE_DIRS}) - if (WIN32) - # Add the library directories to allow Python to use #pragma comment(lib, "python3.lib"). - # FIXME: We should use Python3_SABI_LIBRARY_DIRS here, but this requires CMake 3.26. - target_link_directories(lldbPluginScriptInterpreterPython PRIVATE ${Python3_LIBRARY_DIRS}) - target_link_directories(lldbStaticScriptInterpreterPython PUBLIC ${Python3_LIBRARY_DIRS}) - endif() + target_link_directories(lldbPluginScriptInterpreterPython PRIVATE ${PYTHON_SABI_LIBRARY_DIRS}) + target_link_directories(lldbStaticScriptInterpreterPython PUBLIC ${PYTHON_SABI_LIBRARY_DIRS}) else() add_lldb_library(lldbPluginScriptInterpreterPython PLUGIN ${python_plugin_sources} @@ -92,11 +94,7 @@ else() ${Python3_LIBRARIES} ${LLDB_LIBEDIT_LIBS} ) - if (WIN32) - # Add the library directories to allow Python to use #pragma comment(lib, "python3.lib"). - # FIXME: We should use Python3_SABI_LIBRARY_DIRS here, but this requires CMake 3.26. - target_link_directories(lldbPluginScriptInterpreterPython PUBLIC ${Python3_LIBRARY_DIRS}) - endif() + target_link_directories(lldbPluginScriptInterpreterPython PUBLIC ${PYTHON_SABI_LIBRARY_DIRS}) endif() target_include_directories(lldbPluginScriptInterpreterPython _______________________________________________ lldb-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
