[Lldb-commits] [lldb] b3c978e - [lldb] Make SWIG an auto-detected dependency

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Tue Nov 29 09:07:20 PST 2022


Author: Jonas Devlieghere
Date: 2022-11-29T09:07:11-08:00
New Revision: b3c978e850d374438697f8b79b5e28ab51310068

URL: https://github.com/llvm/llvm-project/commit/b3c978e850d374438697f8b79b5e28ab51310068
DIFF: https://github.com/llvm/llvm-project/commit/b3c978e850d374438697f8b79b5e28ab51310068.diff

LOG: [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

Added: 
    

Modified: 
    lldb/cmake/modules/FindLuaAndSwig.cmake
    lldb/cmake/modules/FindPythonAndSwig.cmake
    lldb/cmake/modules/LLDBConfig.cmake

Removed: 
    


################################################################################
diff  --git a/lldb/cmake/modules/FindLuaAndSwig.cmake b/lldb/cmake/modules/FindLuaAndSwig.cmake
index 982616169a05e..dd51ea1ef4c18 100644
--- a/lldb/cmake/modules/FindLuaAndSwig.cmake
+++ b/lldb/cmake/modules/FindLuaAndSwig.cmake
@@ -7,8 +7,7 @@
 if(LUA_LIBRARIES AND LUA_INCLUDE_DIR AND SWIG_EXECUTABLE)
   set(LUAANDSWIG_FOUND TRUE)
 else()
-  find_package(SWIG 3.0)
-  if (SWIG_FOUND)
+  if (LLDB_ENABLE_SWIG)
     find_package(Lua 5.3 EXACT)
     if(LUA_FOUND AND SWIG_FOUND)
       mark_as_advanced(
@@ -20,6 +19,7 @@ else()
     message(STATUS "SWIG 3 or later is required for Lua support in LLDB but could not be found")
   endif()
 
+
   include(FindPackageHandleStandardArgs)
   find_package_handle_standard_args(LuaAndSwig
                                     FOUND_VAR
@@ -27,5 +27,5 @@ else()
                                     REQUIRED_VARS
                                       LUA_LIBRARIES
                                       LUA_INCLUDE_DIR
-                                      SWIG_EXECUTABLE)
+                                      LLDB_ENABLE_SWIG)
 endif()

diff  --git a/lldb/cmake/modules/FindPythonAndSwig.cmake b/lldb/cmake/modules/FindPythonAndSwig.cmake
index 3535b548c45f2..1b7e1657e364b 100644
--- a/lldb/cmake/modules/FindPythonAndSwig.cmake
+++ b/lldb/cmake/modules/FindPythonAndSwig.cmake
@@ -38,9 +38,8 @@ endmacro()
 if(Python3_LIBRARIES AND Python3_INCLUDE_DIRS AND Python3_EXECUTABLE AND SWIG_EXECUTABLE)
   set(PYTHONANDSWIG_FOUND TRUE)
 else()
-  find_package(SWIG 3.0)
-  if (SWIG_FOUND)
-      FindPython3()
+  if (LLDB_ENABLE_SWIG)
+    FindPython3()
   else()
     message(STATUS "SWIG 3 or later is required for Python support in LLDB but could not be found")
   endif()
@@ -64,5 +63,5 @@ else()
                                       Python3_LIBRARIES
                                       Python3_INCLUDE_DIRS
                                       Python3_EXECUTABLE
-                                      SWIG_EXECUTABLE)
+                                      LLDB_ENABLE_SWIG)
 endif()

diff  --git a/lldb/cmake/modules/LLDBConfig.cmake b/lldb/cmake/modules/LLDBConfig.cmake
index 1079e4b2def17..f3f1103d244f6 100644
--- a/lldb/cmake/modules/LLDBConfig.cmake
+++ b/lldb/cmake/modules/LLDBConfig.cmake
@@ -56,6 +56,7 @@ macro(add_optional_dependency variable description package found)
   message(STATUS "${description}: ${${variable}}")
 endmacro()
 
+add_optional_dependency(LLDB_ENABLE_SWIG "Enable SWIG to generate LLDB bindings" SWIG SWIG_FOUND VERSION 3)
 add_optional_dependency(LLDB_ENABLE_LIBEDIT "Enable editline support in LLDB" LibEdit LibEdit_FOUND)
 add_optional_dependency(LLDB_ENABLE_CURSES "Enable curses support in LLDB" CursesAndPanel CURSESANDPANEL_FOUND)
 add_optional_dependency(LLDB_ENABLE_LZMA "Enable LZMA compression support in LLDB" LibLZMA LIBLZMA_FOUND)


        


More information about the lldb-commits mailing list