Skip to content

Commit fbe96b9

Browse files
committed
[CMake] Fix the static bindings workflow.
Rename LLDB_ALLOW_STATIC_BINDINGS to LLDB_USE_STATIC_BINDINGS and make LLDB use the static bindings unconditionally when it's set. The current variable is opaque because it *allows* LLDB to use the static bindings, but only if SWIG is not found. If an incompatible version of swig is found, it reports a fatal error. This serves no purpose other than to confuse the user. This patch simplifies things and makes the variable do what you expect. When enabled, LLDB uses the static bindings. When disabled, we try to generate them with SWIG.
1 parent 3bcca3a commit fbe96b9

File tree

4 files changed

+17
-15
lines changed

4 files changed

+17
-15
lines changed

lldb/cmake/caches/Apple-lldb-Linux.cmake

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
include(${CMAKE_CURRENT_LIST_DIR}/Apple-lldb-base.cmake)
22

3-
# Begin Swift Mods
4-
set(LLDB_ALLOW_STATIC_BINDINGS ON CACHE BOOL "")
5-
# End Swift Mods
6-
73
set(LLVM_DISTRIBUTION_COMPONENTS
84
lldb
95
liblldb

lldb/cmake/caches/Apple-lldb-base.cmake

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,7 @@ set(LLVM_ENABLE_MODULES OFF CACHE BOOL "")
77

88
set(LIBCXX_ENABLE_SHARED OFF CACHE BOOL "")
99
set(LIBCXX_ENABLE_STATIC OFF CACHE BOOL "")
10+
11+
# Begin Swift Mods
12+
set(LLDB_USE_STATIC_BINDINGS ON CACHE BOOL "")
13+
# End Swift Mods

lldb/cmake/modules/LLDBConfig.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ option(LLDB_USE_SYSTEM_DEBUGSERVER "Use the system's debugserver for testing (Da
5454

5555
# BEGIN SWIFT MOD
5656
option(LLDB_ENABLE_SWIFT_SUPPORT "Enable swift support" ON)
57-
option(LLDB_ALLOW_STATIC_BINDINGS "Enable using static/baked language bindings if swig is not present." OFF)
57+
option(LLDB_USE_STATIC_BINDINGS "Use the static Python bindings." OFF)
5858
# END SWIFT CODE
5959

6060
if(LLDB_BUILD_FRAMEWORK)

lldb/scripts/CMakeLists.txt

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,21 @@ if(LLDB_BUILD_FRAMEWORK)
1313
set(framework_arg --framework --target-platform Darwin)
1414
endif()
1515

16-
find_package(SWIG)
17-
if(${SWIG_FOUND})
18-
set(SWIG_MIN_VERSION "2.0.0")
19-
if (${SWIG_VERSION} VERSION_LESS ${SWIG_MIN_VERSION})
20-
message(FATAL_ERROR "LLDB requires swig ${SWIG_MIN_VERSION}, your version is ${SWIG_VERSION}.")
21-
endif()
22-
set(PREPARE_BINDINGS_ARGS
23-
"--swig-executable=${SWIG_EXECUTABLE}")
24-
elseif(${LLDB_ALLOW_STATIC_BINDINGS})
16+
if(${LLDB_USE_STATIC_BINDINGS})
2517
set(PREPARE_BINDINGS_ARGS
2618
--use-static-binding)
2719
else()
28-
message(FATAL_ERROR "swig not found and static bindings not permitted - install swig or specify -DLLDB_ALLOW_STATIC_BINDINGS=1")
20+
find_package(SWIG)
21+
if(${SWIG_FOUND})
22+
set(SWIG_MIN_VERSION "2.0.0")
23+
if (${SWIG_VERSION} VERSION_LESS ${SWIG_MIN_VERSION})
24+
message(FATAL_ERROR "LLDB requires swig ${SWIG_MIN_VERSION}, your version is ${SWIG_VERSION}.")
25+
endif()
26+
set(PREPARE_BINDINGS_ARGS
27+
"--swig-executable=${SWIG_EXECUTABLE}")
28+
else()
29+
message(FATAL_ERROR "LLDB requires swig ${SWIG_MIN_VERSION}. To use the static bindings instead use -DLLDB_USE_STATIC_BINDINGS=ON")
30+
endif()
2931
endif()
3032

3133
add_custom_command(

0 commit comments

Comments
 (0)