Skip to content

Commit 5f935c5

Browse files
committed
Diagnose unsupported configurations
1 parent a400ac0 commit 5f935c5

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

lldb/cmake/modules/LLDBConfig.cmake

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,15 +180,29 @@ if (LLDB_ENABLE_PYTHON)
180180
"Path to use as PYTHONHOME in lldb. If a relative path is specified, it will be resolved at runtime relative to liblldb directory.")
181181
endif()
182182

183-
if (SWIG_VERSION VERSION_GREATER_EQUAL "4.2"
184-
AND Python3_VERSION VERSION_GREATER_EQUAL "3.11"
183+
set(python_limited_api_swig_version "4.2")
184+
set(python_limited_api_python_version "3.11")
185+
186+
if (SWIG_VERSION VERSION_GREATER_EQUAL python_limited_api_swig_version
187+
AND Python3_VERSION VERSION_GREATER_EQUAL python_limited_api_python_version
185188
AND NOT LLDB_EMBED_PYTHON_HOME)
186189
set(default_enable_python_limited_api ON)
187190
else()
188191
set(default_enable_python_limited_api OFF)
189192
endif()
190193
option(LLDB_ENABLE_PYTHON_LIMITED_API "Only use the Python Limited API (requires at least Python 3.11 and SWIG 4.2)"
191194
${default_enable_python_limited_api})
195+
196+
# Diagnose unsupported configurations.
197+
if (LLDB_ENABLE_PYTHON_LIMITED_API AND LLDB_EMBED_PYTHON_HOME)
198+
message(SEND_ERROR "LLDB_ENABLE_PYTHON_LIMITED_API is not compatible with LLDB_EMBED_PYTHON_HOME")
199+
endif()
200+
if (LLDB_ENABLE_PYTHON_LIMITED_API AND Python3_VERSION VERSION_LESS python_limited_api_python_version)
201+
message(SEND_ERROR "LLDB_ENABLE_PYTHON_LIMITED_API is not compatible with Python ${Python3_VERSION} (requires Python ${python_limited_api_python_version})")
202+
endif()
203+
if (LLDB_ENABLE_PYTHON_LIMITED_API AND SWIG_VERSION VERSION_LESS python_limited_api_swig_version)
204+
message(SEND_ERROR "LLDB_ENABLE_PYTHON_LIMITED_API is not compatible with SWIG ${SWIG_VERSION} (requires SWIG ${python_limited_api_swig_version})")
205+
endif()
192206
else()
193207
# Even if Python scripting is disabled, we still need a Python interpreter to
194208
# build, for example to generate SBLanguages.h.

0 commit comments

Comments
 (0)