Skip to content

Commit c14ca45

Browse files
authored
[lldb] Use the Python limited API with SWIG 4.2 or later (#153119)
Use the Python limited API when building with SWIG 4.2 or later.
1 parent 8c27d88 commit c14ca45

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

lldb/cmake/modules/LLDBConfig.cmake

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ add_optional_dependency(LLDB_ENABLE_FBSDVMCORE "Enable libfbsdvmcore support in
6868
option(LLDB_USE_ENTITLEMENTS "When codesigning, use entitlements if available" ON)
6969
option(LLDB_BUILD_FRAMEWORK "Build LLDB.framework (Darwin only)" OFF)
7070
option(LLDB_ENABLE_PROTOCOL_SERVERS "Enable protocol servers (e.g. MCP) in LLDB" ON)
71-
option(LLDB_ENABLE_PYTHON_LIMITED_API "Force LLDB to only use the Python Limited API (requires SWIG 4.2 or later)" OFF)
7271
option(LLDB_NO_INSTALL_DEFAULT_RPATH "Disable default RPATH settings in binaries" OFF)
7372
option(LLDB_USE_SYSTEM_DEBUGSERVER "Use the system's debugserver for testing (Darwin only)." OFF)
7473
option(LLDB_SKIP_STRIP "Whether to skip stripping of binaries when installing lldb." OFF)
@@ -173,6 +172,14 @@ if (LLDB_ENABLE_PYTHON)
173172
"Embed PYTHONHOME in the binary. If set to OFF, PYTHONHOME environment variable will be used to to locate Python."
174173
${default_embed_python_home})
175174

175+
if (SWIG_VERSION VERSION_GREATER_EQUAL "4.2")
176+
set(default_enable_python_limited_api ON)
177+
else()
178+
set(default_enable_python_limited_api OFF)
179+
endif()
180+
option(LLDB_ENABLE_PYTHON_LIMITED_API "Force LLDB to only use the Python Limited API (requires SWIG 4.2 or later)"
181+
${default_enable_python_limited_api})
182+
176183
include_directories(${Python3_INCLUDE_DIRS})
177184
if (LLDB_EMBED_PYTHON_HOME)
178185
get_filename_component(PYTHON_HOME "${Python3_EXECUTABLE}" DIRECTORY)

0 commit comments

Comments
 (0)