You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[lldb] Diagnose unsupported configurations when targeting the Limited C API (#168145)
Diagnose unsupported configurations when targeting the Python Limited C
API. I used SEND_ERROR so that if there's multiple issues, you don't
need to keep reconfiguring.
Copy file name to clipboardExpand all lines: lldb/cmake/modules/LLDBConfig.cmake
+13-1Lines changed: 13 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -180,13 +180,25 @@ if (LLDB_ENABLE_PYTHON)
180
180
"Path to use as PYTHONHOME in lldb. If a relative path is specified, it will be resolved at runtime relative to liblldb directory.")
181
181
endif()
182
182
183
-
if (SWIG_VERSION VERSION_GREATER_EQUAL"4.2"ANDNOT LLDB_EMBED_PYTHON_HOME)
183
+
# Enable targeting the Python Limited C API.
184
+
set(PYTHON_LIMITED_API_MIN_SWIG_VERSION "4.2")
185
+
if (SWIG_VERSION VERSION_GREATER_EQUAL PYTHON_LIMITED_API_MIN_SWIG_VERSION
186
+
ANDNOT LLDB_EMBED_PYTHON_HOME)
184
187
set(default_enable_python_limited_api ON)
185
188
else()
186
189
set(default_enable_python_limited_api OFF)
187
190
endif()
188
191
option(LLDB_ENABLE_PYTHON_LIMITED_API "Force LLDB to only use the Python Limited API (requires SWIG 4.2 or later)"
189
192
${default_enable_python_limited_api})
193
+
194
+
# Diagnose unsupported configurations.
195
+
if (LLDB_ENABLE_PYTHON_LIMITED_API AND LLDB_EMBED_PYTHON_HOME)
196
+
message(SEND_ERROR "LLDB_ENABLE_PYTHON_LIMITED_API is not compatible with LLDB_EMBED_PYTHON_HOME")
197
+
endif()
198
+
if (LLDB_ENABLE_PYTHON_LIMITED_API AND SWIG_VERSION VERSION_LESS PYTHON_LIMITED_API_MIN_SWIG_VERSION)
199
+
message(SEND_ERROR "LLDB_ENABLE_PYTHON_LIMITED_API is not compatible with SWIG ${SWIG_VERSION} (requires SWIG ${PYTHON_LIMITED_API_MIN_SWIG_VERSION})")
200
+
endif()
201
+
190
202
else()
191
203
# Even if Python scripting is disabled, we still need a Python interpreter to
0 commit comments