[Lldb-commits] [PATCH] D138879: [lldb] Make SWIG an autodetected depenency

Jonas Devlieghere via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Nov 28 16:42:35 PST 2022


JDevlieghere created this revision.
JDevlieghere added reviewers: bulbazord, mib, labath.
Herald added a project: All.
JDevlieghere requested review of this revision.

This patch makes SWIG itself an autodetected 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: https://github.com/apple/llvm-project/pull/5636


https://reviews.llvm.org/D138879

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


Index: lldb/cmake/modules/LLDBConfig.cmake
===================================================================
--- lldb/cmake/modules/LLDBConfig.cmake
+++ lldb/cmake/modules/LLDBConfig.cmake
@@ -56,6 +56,7 @@
   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)
Index: lldb/cmake/modules/FindPythonAndSwig.cmake
===================================================================
--- lldb/cmake/modules/FindPythonAndSwig.cmake
+++ lldb/cmake/modules/FindPythonAndSwig.cmake
@@ -38,9 +38,8 @@
 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 @@
                                       Python3_LIBRARIES
                                       Python3_INCLUDE_DIRS
                                       Python3_EXECUTABLE
-                                      SWIG_EXECUTABLE)
+                                      LLDB_ENABLE_SWIG)
 endif()
Index: lldb/cmake/modules/FindLuaAndSwig.cmake
===================================================================
--- lldb/cmake/modules/FindLuaAndSwig.cmake
+++ 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 @@
     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 @@
                                     REQUIRED_VARS
                                       LUA_LIBRARIES
                                       LUA_INCLUDE_DIR
-                                      SWIG_EXECUTABLE)
+                                      LLDB_ENABLE_SWIG)
 endif()


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D138879.478415.patch
Type: text/x-patch
Size: 2660 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20221129/11e77f9a/attachment.bin>


More information about the lldb-commits mailing list