Skip to content

Commit ee1744e

Browse files
committed
[lldb] Make SWIG an auto-detected dependency
This patch makes SWIG itself an auto-detected dependency. This allows us to look for SWIG once in a centralized place and makes it easier downstream to detect whether to use the static bindings. Differential revision: https://reviews.llvm.org/D138879
1 parent cc6344a commit ee1744e

File tree

3 files changed

+7
-13
lines changed

3 files changed

+7
-13
lines changed

lldb/cmake/modules/FindLuaAndSwig.cmake

Lines changed: 3 additions & 6 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,13 @@ 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
3229
LUA_INCLUDE_DIR
33-
SWIG_EXECUTABLE)
30+
LLDB_ENABLE_SWIG)
3431
endif()

lldb/cmake/modules/FindPythonAndSwig.cmake

Lines changed: 3 additions & 7 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()
@@ -67,5 +63,5 @@ else()
6763
Python3_LIBRARIES
6864
Python3_INCLUDE_DIRS
6965
Python3_EXECUTABLE
70-
SWIG_EXECUTABLE)
66+
LLDB_ENABLE_SWIG)
7167
endif()

lldb/cmake/modules/LLDBConfig.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ 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)
5960
add_optional_dependency(LLDB_ENABLE_LIBEDIT "Enable editline support in LLDB" LibEdit LibEdit_FOUND)
6061
add_optional_dependency(LLDB_ENABLE_CURSES "Enable curses support in LLDB" CursesAndPanel CURSESANDPANEL_FOUND)
6162
add_optional_dependency(LLDB_ENABLE_LZMA "Enable LZMA compression support in LLDB" LibLZMA LIBLZMA_FOUND)

0 commit comments

Comments
 (0)