[Lldb-commits] [PATCH] D74917: [lldb/bindings] Fail configuration when a required dependency is not met.

2020-02-20 Thread Matt Davis via Phabricator via lldb-commits
mattd created this revision.
mattd added reviewers: aadsm, hhb.
mattd added a project: LLDB.
Herald added a subscriber: mgorny.

If the SWIG dependency is required {LLDB_ENABLE_PYTHON, LLDB_ENABLE_LUA}
and SWIG is not available, fail the configuration step.  Terminate the
configure early rather than later with a clear error message.

We could possibly modify:
`llvm-project/lldb/cmake/modules/FindPythonInterpAndLibs.cmake`
However, the patch here seems clear in my opinion.


https://reviews.llvm.org/D74917

Files:
  lldb/bindings/CMakeLists.txt


Index: lldb/bindings/CMakeLists.txt
===
--- lldb/bindings/CMakeLists.txt
+++ lldb/bindings/CMakeLists.txt
@@ -33,6 +33,10 @@
 )
 
 if (LLDB_ENABLE_PYTHON)
+  if (NOT SWIG_FOUND)
+message(FATAL_ERROR
+"The SWIG package is required for Python support in LLDB.")
+  endif()
   add_custom_command(
 OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/LLDBWrapPython.cpp
 OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lldb.py
@@ -57,6 +61,10 @@
 endif()
 
 if (LLDB_ENABLE_LUA)
+  if (NOT SWIG_FOUND)
+message(FATAL_ERROR
+"The SWIG package is required for LUA support in LLDB.")
+  endif()
   add_custom_command(
 OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/LLDBWrapLua.cpp
 DEPENDS ${SWIG_SOURCES}


Index: lldb/bindings/CMakeLists.txt
===
--- lldb/bindings/CMakeLists.txt
+++ lldb/bindings/CMakeLists.txt
@@ -33,6 +33,10 @@
 )
 
 if (LLDB_ENABLE_PYTHON)
+  if (NOT SWIG_FOUND)
+message(FATAL_ERROR
+"The SWIG package is required for Python support in LLDB.")
+  endif()
   add_custom_command(
 OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/LLDBWrapPython.cpp
 OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lldb.py
@@ -57,6 +61,10 @@
 endif()
 
 if (LLDB_ENABLE_LUA)
+  if (NOT SWIG_FOUND)
+message(FATAL_ERROR
+"The SWIG package is required for LUA support in LLDB.")
+  endif()
   add_custom_command(
 OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/LLDBWrapLua.cpp
 DEPENDS ${SWIG_SOURCES}
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D74917: [lldb/bindings] Fail configuration when a required dependency is not met.

2020-02-20 Thread Matt Davis via Phabricator via lldb-commits
mattd added a comment.

In D74917#1885590 , @JDevlieghere 
wrote:

> It should never be possible for `LLDB_ENABLE_PYTHON` to be true but 
> `SWIG_FOUND` to be false. The modules `FindPythonInterpAndLibs.cmake` and 
> `FindLuaAndSwig.cmake` should fail early when SWIG isn't found.


Thanks for taking a look.  Would you be okay with making the status `message()` 
in `FindPythonInterpAndLibs.cmake` and `FindLuaAndSwig.cmake` fatal, that way 
the dependency error is clearer?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D74917/new/

https://reviews.llvm.org/D74917



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D74917: [lldb/cmake] Fail configuration if a required swig dependency is not met.

2020-02-20 Thread Matt Davis via Phabricator via lldb-commits
mattd updated this revision to Diff 245763.
mattd retitled this revision from "[lldb/bindings] Fail configuration when a 
required dependency is not met." to "[lldb/cmake] Fail configuration if a 
required swig dependency is not met.".

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D74917/new/

https://reviews.llvm.org/D74917

Files:
  lldb/cmake/modules/FindLuaAndSwig.cmake
  lldb/cmake/modules/FindPythonInterpAndLibs.cmake


Index: lldb/cmake/modules/FindPythonInterpAndLibs.cmake
===
--- lldb/cmake/modules/FindPythonInterpAndLibs.cmake
+++ lldb/cmake/modules/FindPythonInterpAndLibs.cmake
@@ -44,7 +44,7 @@
   endif()
 endif()
   else()
-message(STATUS "SWIG 2 or later is required for Python support in LLDB but 
could not be found")
+message(FATAL_ERROR "SWIG 2 or later is required for Python support in 
LLDB but could not be found")
   endif()
 
   include(FindPackageHandleStandardArgs)
Index: lldb/cmake/modules/FindLuaAndSwig.cmake
===
--- lldb/cmake/modules/FindLuaAndSwig.cmake
+++ lldb/cmake/modules/FindLuaAndSwig.cmake
@@ -17,7 +17,7 @@
 SWIG_EXECUTABLE)
 endif()
   else()
-message(STATUS "SWIG 2 or later is required for Lua support in LLDB but 
could not be found")
+message(FATAL_ERROR "SWIG 2 or later is required for Lua support in LLDB 
but could not be found")
   endif()
 
   include(FindPackageHandleStandardArgs)


Index: lldb/cmake/modules/FindPythonInterpAndLibs.cmake
===
--- lldb/cmake/modules/FindPythonInterpAndLibs.cmake
+++ lldb/cmake/modules/FindPythonInterpAndLibs.cmake
@@ -44,7 +44,7 @@
   endif()
 endif()
   else()
-message(STATUS "SWIG 2 or later is required for Python support in LLDB but could not be found")
+message(FATAL_ERROR "SWIG 2 or later is required for Python support in LLDB but could not be found")
   endif()
 
   include(FindPackageHandleStandardArgs)
Index: lldb/cmake/modules/FindLuaAndSwig.cmake
===
--- lldb/cmake/modules/FindLuaAndSwig.cmake
+++ lldb/cmake/modules/FindLuaAndSwig.cmake
@@ -17,7 +17,7 @@
 SWIG_EXECUTABLE)
 endif()
   else()
-message(STATUS "SWIG 2 or later is required for Lua support in LLDB but could not be found")
+message(FATAL_ERROR "SWIG 2 or later is required for Lua support in LLDB but could not be found")
   endif()
 
   include(FindPackageHandleStandardArgs)
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D74917: [lldb/cmake] Fail configuration if a required swig dependency is not met.

2020-02-20 Thread Matt Davis via Phabricator via lldb-commits
mattd added a comment.

In D74917#1885621 , @JDevlieghere 
wrote:

> In D74917#1885615 , @mattd wrote:
>
> > In D74917#1885590 , @JDevlieghere 
> > wrote:
> >
> > > It should never be possible for `LLDB_ENABLE_PYTHON` to be true but 
> > > `SWIG_FOUND` to be false. The modules `FindPythonInterpAndLibs.cmake` and 
> > > `FindLuaAndSwig.cmake` should fail early when SWIG isn't found.
> >
> >
> > Thanks for taking a look.  Would you be okay with making the status 
> > `message()` in `FindPythonInterpAndLibs.cmake` and `FindLuaAndSwig.cmake` 
> > fatal, that way the dependency error is clearer?
>
>
> That would defeat the purpose of auto-detecting these dependencies. Please 
> take a look at D71306  for all the details. 
> The summary is that all optional dependencies default to `Auto`: where we 
> enable them if we can find them. You can override this behavior by passing 
> `LLDB_ENABLE_PYTHON=ON` to CMake, in which case not finding Python (or SWIG) 
> will be a fatal error.


Thanks for the clarification there.

> I agree that it can be confusing to figure out that Python got disabled 
> because SWIG wasn't found. Currently we call `find_package` with `QUIET` from 
> `FindPythonInterpAndLibs.cmake` and `FindLuaAndSwig.cmake`. I think we should 
> remove that so that the user gets more information in CMake's configuration 
> output. Would that address your concerns?

Ah, yes, dropping the `QUIET` produces meaningful insight as to what might be 
missing. I think others, who might not have all the dependencies, might find 
this level of verbosity clearer, so that they can more quickly understand what 
is missing in their build environment.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D74917/new/

https://reviews.llvm.org/D74917



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D74917: [lldb/cmake] Enable more verbose find_package output.

2020-02-20 Thread Matt Davis via Phabricator via lldb-commits
mattd updated this revision to Diff 245771.
mattd retitled this revision from "[lldb/cmake] Fail configuration if a 
required swig dependency is not met." to "[lldb/cmake] Enable more verbose 
find_package output.".
mattd edited the summary of this revision.

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D74917/new/

https://reviews.llvm.org/D74917

Files:
  lldb/cmake/modules/FindLuaAndSwig.cmake
  lldb/cmake/modules/FindPythonInterpAndLibs.cmake


Index: lldb/cmake/modules/FindPythonInterpAndLibs.cmake
===
--- lldb/cmake/modules/FindPythonInterpAndLibs.cmake
+++ lldb/cmake/modules/FindPythonInterpAndLibs.cmake
@@ -7,10 +7,10 @@
 if(PYTHON_LIBRARIES AND PYTHON_INCLUDE_DIRS AND PYTHON_EXECUTABLE AND 
SWIG_EXECUTABLE)
   set(PYTHONINTERPANDLIBS_FOUND TRUE)
 else()
-  find_package(SWIG 2.0 QUIET)
+  find_package(SWIG 2.0)
   if (SWIG_FOUND)
 if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows")
-  find_package(Python3 COMPONENTS Interpreter Development QUIET)
+  find_package(Python3 COMPONENTS Interpreter Development)
   if (Python3_FOUND AND Python3_Interpreter_FOUND)
 set(PYTHON_LIBRARIES ${Python3_LIBRARIES})
 set(PYTHON_INCLUDE_DIRS ${Python3_INCLUDE_DIRS})
@@ -22,8 +22,8 @@
   SWIG_EXECUTABLE)
   endif()
 else()
-  find_package(PythonInterp QUIET)
-  find_package(PythonLibs QUIET)
+  find_package(PythonInterp)
+  find_package(PythonLibs)
   if(PYTHONINTERP_FOUND AND PYTHONLIBS_FOUND AND SWIG_FOUND)
 if (NOT CMAKE_CROSSCOMPILING)
   string(REPLACE "." ";" pythonlibs_version_list 
${PYTHONLIBS_VERSION_STRING})
Index: lldb/cmake/modules/FindLuaAndSwig.cmake
===
--- lldb/cmake/modules/FindLuaAndSwig.cmake
+++ lldb/cmake/modules/FindLuaAndSwig.cmake
@@ -7,9 +7,9 @@
 if(LUA_LIBRARIES AND LUA_INCLUDE_DIR AND SWIG_EXECUTABLE)
   set(LUAANDSWIG_FOUND TRUE)
 else()
-  find_package(SWIG 2.0 QUIET)
+  find_package(SWIG 2.0)
   if (SWIG_FOUND)
-find_package(Lua QUIET)
+find_package(Lua)
 if(LUA_FOUND AND SWIG_FOUND)
   mark_as_advanced(
 LUA_LIBRARIES


Index: lldb/cmake/modules/FindPythonInterpAndLibs.cmake
===
--- lldb/cmake/modules/FindPythonInterpAndLibs.cmake
+++ lldb/cmake/modules/FindPythonInterpAndLibs.cmake
@@ -7,10 +7,10 @@
 if(PYTHON_LIBRARIES AND PYTHON_INCLUDE_DIRS AND PYTHON_EXECUTABLE AND SWIG_EXECUTABLE)
   set(PYTHONINTERPANDLIBS_FOUND TRUE)
 else()
-  find_package(SWIG 2.0 QUIET)
+  find_package(SWIG 2.0)
   if (SWIG_FOUND)
 if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows")
-  find_package(Python3 COMPONENTS Interpreter Development QUIET)
+  find_package(Python3 COMPONENTS Interpreter Development)
   if (Python3_FOUND AND Python3_Interpreter_FOUND)
 set(PYTHON_LIBRARIES ${Python3_LIBRARIES})
 set(PYTHON_INCLUDE_DIRS ${Python3_INCLUDE_DIRS})
@@ -22,8 +22,8 @@
   SWIG_EXECUTABLE)
   endif()
 else()
-  find_package(PythonInterp QUIET)
-  find_package(PythonLibs QUIET)
+  find_package(PythonInterp)
+  find_package(PythonLibs)
   if(PYTHONINTERP_FOUND AND PYTHONLIBS_FOUND AND SWIG_FOUND)
 if (NOT CMAKE_CROSSCOMPILING)
   string(REPLACE "." ";" pythonlibs_version_list ${PYTHONLIBS_VERSION_STRING})
Index: lldb/cmake/modules/FindLuaAndSwig.cmake
===
--- lldb/cmake/modules/FindLuaAndSwig.cmake
+++ lldb/cmake/modules/FindLuaAndSwig.cmake
@@ -7,9 +7,9 @@
 if(LUA_LIBRARIES AND LUA_INCLUDE_DIR AND SWIG_EXECUTABLE)
   set(LUAANDSWIG_FOUND TRUE)
 else()
-  find_package(SWIG 2.0 QUIET)
+  find_package(SWIG 2.0)
   if (SWIG_FOUND)
-find_package(Lua QUIET)
+find_package(Lua)
 if(LUA_FOUND AND SWIG_FOUND)
   mark_as_advanced(
 LUA_LIBRARIES
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D74917: [lldb/cmake] Enable more verbose find_package output.

2020-02-21 Thread Matt Davis via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG07d2cdae1163: [lldb/cmake] Enable more verbose find_package 
output. (authored by mattd).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D74917/new/

https://reviews.llvm.org/D74917

Files:
  lldb/cmake/modules/FindLuaAndSwig.cmake
  lldb/cmake/modules/FindPythonInterpAndLibs.cmake


Index: lldb/cmake/modules/FindPythonInterpAndLibs.cmake
===
--- lldb/cmake/modules/FindPythonInterpAndLibs.cmake
+++ lldb/cmake/modules/FindPythonInterpAndLibs.cmake
@@ -7,10 +7,10 @@
 if(PYTHON_LIBRARIES AND PYTHON_INCLUDE_DIRS AND PYTHON_EXECUTABLE AND 
SWIG_EXECUTABLE)
   set(PYTHONINTERPANDLIBS_FOUND TRUE)
 else()
-  find_package(SWIG 2.0 QUIET)
+  find_package(SWIG 2.0)
   if (SWIG_FOUND)
 if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows")
-  find_package(Python3 COMPONENTS Interpreter Development QUIET)
+  find_package(Python3 COMPONENTS Interpreter Development)
   if (Python3_FOUND AND Python3_Interpreter_FOUND)
 set(PYTHON_LIBRARIES ${Python3_LIBRARIES})
 set(PYTHON_INCLUDE_DIRS ${Python3_INCLUDE_DIRS})
@@ -22,8 +22,8 @@
   SWIG_EXECUTABLE)
   endif()
 else()
-  find_package(PythonInterp QUIET)
-  find_package(PythonLibs QUIET)
+  find_package(PythonInterp)
+  find_package(PythonLibs)
   if(PYTHONINTERP_FOUND AND PYTHONLIBS_FOUND AND SWIG_FOUND)
 if (NOT CMAKE_CROSSCOMPILING)
   string(REPLACE "." ";" pythonlibs_version_list 
${PYTHONLIBS_VERSION_STRING})
Index: lldb/cmake/modules/FindLuaAndSwig.cmake
===
--- lldb/cmake/modules/FindLuaAndSwig.cmake
+++ lldb/cmake/modules/FindLuaAndSwig.cmake
@@ -7,9 +7,9 @@
 if(LUA_LIBRARIES AND LUA_INCLUDE_DIR AND SWIG_EXECUTABLE)
   set(LUAANDSWIG_FOUND TRUE)
 else()
-  find_package(SWIG 2.0 QUIET)
+  find_package(SWIG 2.0)
   if (SWIG_FOUND)
-find_package(Lua QUIET)
+find_package(Lua)
 if(LUA_FOUND AND SWIG_FOUND)
   mark_as_advanced(
 LUA_LIBRARIES


Index: lldb/cmake/modules/FindPythonInterpAndLibs.cmake
===
--- lldb/cmake/modules/FindPythonInterpAndLibs.cmake
+++ lldb/cmake/modules/FindPythonInterpAndLibs.cmake
@@ -7,10 +7,10 @@
 if(PYTHON_LIBRARIES AND PYTHON_INCLUDE_DIRS AND PYTHON_EXECUTABLE AND SWIG_EXECUTABLE)
   set(PYTHONINTERPANDLIBS_FOUND TRUE)
 else()
-  find_package(SWIG 2.0 QUIET)
+  find_package(SWIG 2.0)
   if (SWIG_FOUND)
 if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows")
-  find_package(Python3 COMPONENTS Interpreter Development QUIET)
+  find_package(Python3 COMPONENTS Interpreter Development)
   if (Python3_FOUND AND Python3_Interpreter_FOUND)
 set(PYTHON_LIBRARIES ${Python3_LIBRARIES})
 set(PYTHON_INCLUDE_DIRS ${Python3_INCLUDE_DIRS})
@@ -22,8 +22,8 @@
   SWIG_EXECUTABLE)
   endif()
 else()
-  find_package(PythonInterp QUIET)
-  find_package(PythonLibs QUIET)
+  find_package(PythonInterp)
+  find_package(PythonLibs)
   if(PYTHONINTERP_FOUND AND PYTHONLIBS_FOUND AND SWIG_FOUND)
 if (NOT CMAKE_CROSSCOMPILING)
   string(REPLACE "." ";" pythonlibs_version_list ${PYTHONLIBS_VERSION_STRING})
Index: lldb/cmake/modules/FindLuaAndSwig.cmake
===
--- lldb/cmake/modules/FindLuaAndSwig.cmake
+++ lldb/cmake/modules/FindLuaAndSwig.cmake
@@ -7,9 +7,9 @@
 if(LUA_LIBRARIES AND LUA_INCLUDE_DIR AND SWIG_EXECUTABLE)
   set(LUAANDSWIG_FOUND TRUE)
 else()
-  find_package(SWIG 2.0 QUIET)
+  find_package(SWIG 2.0)
   if (SWIG_FOUND)
-find_package(Lua QUIET)
+find_package(Lua)
 if(LUA_FOUND AND SWIG_FOUND)
   mark_as_advanced(
 LUA_LIBRARIES
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits