Skip to content

Commit 4383eef

Browse files
authored
Merge pull request #5636 from apple/jdevlieghere/autodetect-static-bindings
[lldb] Auto-detect whether to use the static bindings
2 parents 100124b + 0c8b637 commit 4383eef

File tree

4 files changed

+19
-16
lines changed

4 files changed

+19
-16
lines changed

lldb/bindings/python/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,8 @@ function(finish_swig_python swig_target lldb_python_bindings_dir lldb_python_tar
189189
COMMAND ${CMAKE_COMMAND} -E copy ${PYTHON_DLL_NATIVE_PATH} ${LLDB_BIN_DIR} VERBATIM
190190
COMMENT "Copying Python DLL to LLDB binaries directory.")
191191
endif()
192+
193+
192194
endfunction()
193195

194196
if(${LLDB_USE_STATIC_BINDINGS})

lldb/cmake/modules/FindLuaAndSwig.cmake

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,7 @@
77
if(LUA_LIBRARIES AND LUA_INCLUDE_DIR AND SWIG_EXECUTABLE)
88
set(LUAANDSWIG_FOUND TRUE)
99
else()
10-
find_package(SWIG 3.0 QUIET)
11-
if (SWIG_FOUND OR LLDB_USE_STATIC_BINDINGS)
12-
if (LLDB_USE_STATIC_BINDINGS)
13-
set(SWIG_EXECUTABLE "/not/found")
14-
endif()
10+
if (LLDB_ENABLE_SWIG OR LLDB_USE_STATIC_BINDINGS)
1511
find_package(Lua 5.3 EXACT)
1612
if(LUA_FOUND AND SWIG_FOUND)
1713
mark_as_advanced(
@@ -23,12 +19,12 @@ else()
2319
message(STATUS "SWIG 3 or later is required for Lua support in LLDB but could not be found")
2420
endif()
2521

22+
2623
include(FindPackageHandleStandardArgs)
2724
find_package_handle_standard_args(LuaAndSwig
2825
FOUND_VAR
2926
LUAANDSWIG_FOUND
3027
REQUIRED_VARS
3128
LUA_LIBRARIES
32-
LUA_INCLUDE_DIR
33-
SWIG_EXECUTABLE)
29+
LUA_INCLUDE_DIR)
3430
endif()

lldb/cmake/modules/FindPythonAndSwig.cmake

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,8 @@ endmacro()
3838
if(Python3_LIBRARIES AND Python3_INCLUDE_DIRS AND Python3_EXECUTABLE AND SWIG_EXECUTABLE)
3939
set(PYTHONANDSWIG_FOUND TRUE)
4040
else()
41-
find_package(SWIG 3.0)
42-
if (SWIG_FOUND OR LLDB_USE_STATIC_BINDINGS)
43-
if (LLDB_USE_STATIC_BINDINGS)
44-
set(SWIG_EXECUTABLE "/not/found")
45-
endif()
46-
FindPython3()
41+
if (LLDB_ENABLE_SWIG OR LLDB_USE_STATIC_BINDINGS)
42+
FindPython3()
4743
else()
4844
message(STATUS "SWIG 3 or later is required for Python support in LLDB but could not be found")
4945
endif()
@@ -66,6 +62,5 @@ else()
6662
REQUIRED_VARS
6763
Python3_LIBRARIES
6864
Python3_INCLUDE_DIRS
69-
Python3_EXECUTABLE
70-
SWIG_EXECUTABLE)
65+
Python3_EXECUTABLE)
7166
endif()

lldb/cmake/modules/LLDBConfig.cmake

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,17 @@ macro(add_optional_dependency variable description package found)
5656
message(STATUS "${description}: ${${variable}}")
5757
endmacro()
5858

59+
add_optional_dependency(LLDB_ENABLE_SWIG "Enable SWIG to generate LLDB bindings" SWIG SWIG_FOUND VERSION 3)
60+
61+
# BEGIN SWIFT MOD
62+
if (LLDB_ENABLE_SWIG)
63+
set(LLDB_ENABLE_STATIC_BINDINGS FALSE)
64+
else()
65+
set(LLDB_ENABLE_STATIC_BINDINGS TRUE)
66+
endif()
67+
option(LLDB_USE_STATIC_BINDINGS "Use the static Python bindings." ${LLDB_ENABLE_STATIC_BINDINGS})
68+
# END SWIFT MOD
69+
5970
add_optional_dependency(LLDB_ENABLE_LIBEDIT "Enable editline support in LLDB" LibEdit LibEdit_FOUND)
6071
add_optional_dependency(LLDB_ENABLE_CURSES "Enable curses support in LLDB" CursesAndPanel CURSESANDPANEL_FOUND)
6172
add_optional_dependency(LLDB_ENABLE_LZMA "Enable LZMA compression support in LLDB" LibLZMA LIBLZMA_FOUND)
@@ -74,7 +85,6 @@ option(LLDB_SKIP_DSYM "Whether to skip generating a dSYM when installing lldb."
7485

7586
# BEGIN SWIFT MOD
7687
option(LLDB_ENABLE_SWIFT_SUPPORT "Enable swift support" ON)
77-
option(LLDB_USE_STATIC_BINDINGS "Use the static Python bindings." OFF)
7888
option(LLDB_ENABLE_WERROR "Fail and stop if a warning is triggered." ${LLVM_ENABLE_WERROR})
7989
if(LLDB_ENABLE_SWIFT_SUPPORT)
8090
add_definitions( -DLLDB_ENABLE_SWIFT )

0 commit comments

Comments
 (0)