aboutsummaryrefslogtreecommitdiff
path: root/lldb/cmake
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/cmake')
-rw-r--r--lldb/cmake/modules/AddLLDB.cmake1
-rw-r--r--lldb/cmake/modules/FindLuaAndSwig.cmake1
-rw-r--r--lldb/cmake/modules/LLDBConfig.cmake24
3 files changed, 25 insertions, 1 deletions
diff --git a/lldb/cmake/modules/AddLLDB.cmake b/lldb/cmake/modules/AddLLDB.cmake
index 5d58abf..6493df2 100644
--- a/lldb/cmake/modules/AddLLDB.cmake
+++ b/lldb/cmake/modules/AddLLDB.cmake
@@ -172,6 +172,7 @@ function(add_lldb_executable name)
if(NOT LIBLLDB_INDEX EQUAL -1)
if (MSVC)
target_link_options(${name} PRIVATE "/DELAYLOAD:$<TARGET_FILE_NAME:liblldb>")
+ target_link_libraries(${name} PRIVATE delayimp)
elseif (MINGW AND LINKER_IS_LLD)
# LLD can delay load just by passing a --delayload flag, as long as the import
# library is a short type import library (which LLD and MS link.exe produce).
diff --git a/lldb/cmake/modules/FindLuaAndSwig.cmake b/lldb/cmake/modules/FindLuaAndSwig.cmake
index 33fadb2..c5df29e 100644
--- a/lldb/cmake/modules/FindLuaAndSwig.cmake
+++ b/lldb/cmake/modules/FindLuaAndSwig.cmake
@@ -34,6 +34,7 @@ else()
FOUND_VAR
LUAANDSWIG_FOUND
REQUIRED_VARS
+ LUA_EXECUTABLE
LUA_LIBRARIES
LUA_INCLUDE_DIR
LUA_VERSION_MINOR
diff --git a/lldb/cmake/modules/LLDBConfig.cmake b/lldb/cmake/modules/LLDBConfig.cmake
index 4b568d2..0d62c32 100644
--- a/lldb/cmake/modules/LLDBConfig.cmake
+++ b/lldb/cmake/modules/LLDBConfig.cmake
@@ -180,13 +180,35 @@ if (LLDB_ENABLE_PYTHON)
"Path to use as PYTHONHOME in lldb. If a relative path is specified, it will be resolved at runtime relative to liblldb directory.")
endif()
- if (SWIG_VERSION VERSION_GREATER_EQUAL "4.2" AND NOT LLDB_EMBED_PYTHON_HOME)
+ # Enable targeting the Python Limited C API.
+ set(PYTHON_LIMITED_API_MIN_SWIG_VERSION "4.2")
+ if (SWIG_VERSION VERSION_EQUAL "4.4.0" AND Python3_VERSION VERSION_GREATER_EQUAL "3.13")
+ set(AFFECTED_BY_SWIG_BUG TRUE)
+ else()
+ set(AFFECTED_BY_SWIG_BUG FALSE)
+ endif()
+
+ if (SWIG_VERSION VERSION_GREATER_EQUAL PYTHON_LIMITED_API_MIN_SWIG_VERSION
+ AND NOT LLDB_EMBED_PYTHON_HOME AND NOT AFFECTED_BY_SWIG_BUG)
set(default_enable_python_limited_api ON)
else()
set(default_enable_python_limited_api OFF)
endif()
+
option(LLDB_ENABLE_PYTHON_LIMITED_API "Force LLDB to only use the Python Limited API (requires SWIG 4.2 or later)"
${default_enable_python_limited_api})
+
+ # Diagnose unsupported configurations.
+ if (LLDB_ENABLE_PYTHON_LIMITED_API AND AFFECTED_BY_SWIG_BUG)
+ message(SEND_ERROR "LLDB_ENABLE_PYTHON_LIMITED_API is not compatible with SWIG 4.4.0 and Python >= 3.13 due to a bug in SWIG: https://github.com/swig/swig/issues/3283")
+ endif()
+ if (LLDB_ENABLE_PYTHON_LIMITED_API AND LLDB_EMBED_PYTHON_HOME)
+ message(SEND_ERROR "LLDB_ENABLE_PYTHON_LIMITED_API is not compatible with LLDB_EMBED_PYTHON_HOME")
+ endif()
+ if (LLDB_ENABLE_PYTHON_LIMITED_API AND SWIG_VERSION VERSION_LESS PYTHON_LIMITED_API_MIN_SWIG_VERSION)
+ message(SEND_ERROR "LLDB_ENABLE_PYTHON_LIMITED_API is not compatible with SWIG ${SWIG_VERSION} (requires SWIG ${PYTHON_LIMITED_API_MIN_SWIG_VERSION})")
+ endif()
+
else()
# Even if Python scripting is disabled, we still need a Python interpreter to
# build, for example to generate SBLanguages.h.