[Lldb-commits] [lldb] r249671 - Make CMake display more readable paths to Python binaries on Windows

Bruce Mitchener via lldb-commits lldb-commits at lists.llvm.org
Thu Oct 8 01:50:21 PDT 2015


Author: brucem
Date: Thu Oct  8 03:50:20 2015
New Revision: 249671

URL: http://llvm.org/viewvc/llvm-project?rev=249671&view=rev
Log:
Make CMake display more readable paths to Python binaries on Windows

Summary:
Previously CMake would display messages like these:

```
-- LLDB Found PythonExecutable: $<$<CONFIG:Debug>:C:/Projects/Python-2.7.9-bin/x64/python_d.exe>$<$<NOT:$<CONFIG:Debug>>:C:/Projects/Python-2.7.9-bin/x64/python.exe>
-- LLDB Found PythonLibs: $<$<CONFIG:Debug>:C:/Projects/Python-2.7.9-bin/x64/libs/python27_d.lib>$<$<NOT:$<CONFIG:Debug>>:C:/Projects/Python-2.7.9-bin/x64/libs/python27.lib>
-- LLDB Found PythonDLL: $<$<CONFIG:Debug>:C:/Projects/Python-2.7.9-bin/x64/python27_d.dll>$<$<NOT:$<CONFIG:Debug>>:C:/Projects/Python-2.7.9-bin/x64/python27.dll>
```

This patch makes the messages look like this:

```
-- LLDB Found PythonExecutable: C:/Projects/Python-2.7.9-bin/x64/python.exe and C:/Projects/Python-2.7.9-bin/x64/python_d.exe
-- LLDB Found PythonLibs: C:/Projects/Python-2.7.9-bin/x64/libs/python27.lib and C:/Projects/Python-2.7.9-bin/x64/libs/python27_d.lib
-- LLDB Found PythonDLL: C:/Projects/Python-2.7.9-bin/x64/python27.dll and C:/Projects/Python-2.7.9-bin/x64/python27_d.dll
```

I've also added checks to ensure the messages are actually accurate, as in check that the files actually exist before claiming they've been found. If any of the files are missing Python integration will be disabled for the build.

Patch by Vadim Macagon. Thanks!

Reviewers: brucem, zturner

Subscribers: lldb-commits

Differential Revision: http://reviews.llvm.org/D13520

Modified:
    lldb/trunk/cmake/modules/LLDBConfig.cmake

Modified: lldb/trunk/cmake/modules/LLDBConfig.cmake
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/cmake/modules/LLDBConfig.cmake?rev=249671&r1=249670&r2=249671&view=diff
==============================================================================
--- lldb/trunk/cmake/modules/LLDBConfig.cmake (original)
+++ lldb/trunk/cmake/modules/LLDBConfig.cmake Thu Oct  8 03:50:20 2015
@@ -83,6 +83,42 @@ function(find_python_libs_windows)
   file(TO_CMAKE_PATH "${PYTHON_HOME}/libs/${PYTHONLIBS_BASE_NAME}.lib" PYTHON_RELEASE_LIB)
   file(TO_CMAKE_PATH "${PYTHON_HOME}/${PYTHONLIBS_BASE_NAME}.dll" PYTHON_RELEASE_DLL)
 
+  if (NOT EXISTS ${PYTHON_DEBUG_EXE})
+    message("Unable to find ${PYTHON_DEBUG_EXE}")
+    unset(PYTHON_DEBUG_EXE)
+  endif()
+
+  if (NOT EXISTS ${PYTHON_RELEASE_EXE})
+    message("Unable to find ${PYTHON_RELEASE_EXE}")
+    unset(PYTHON_RELEASE_EXE)
+  endif()
+
+  if (NOT EXISTS ${PYTHON_DEBUG_LIB})
+    message("Unable to find ${PYTHON_DEBUG_LIB}")
+    unset(PYTHON_DEBUG_LIB)
+  endif()
+
+  if (NOT EXISTS ${PYTHON_RELEASE_LIB})
+    message("Unable to find ${PYTHON_RELEASE_LIB}")
+    unset(PYTHON_RELEASE_LIB)
+  endif()
+
+  if (NOT EXISTS ${PYTHON_DEBUG_DLL})
+    message("Unable to find ${PYTHON_DEBUG_DLL}")
+    unset(PYTHON_DEBUG_DLL)
+  endif()
+
+  if (NOT EXISTS ${PYTHON_RELEASE_DLL})
+    message("Unable to find ${PYTHON_RELEASE_DLL}")
+    unset(PYTHON_RELEASE_DLL)
+  endif()
+
+  if (NOT (PYTHON_DEBUG_EXE AND PYTHON_RELEASE_EXE AND PYTHON_DEBUG_LIB AND PYTHON_RELEASE_LIB AND PYTHON_DEBUG_DLL AND PYTHON_RELEASE_DLL))
+    message("Python installation is corrupt. Python support will be disabled for this build.")
+    set(LLDB_DISABLE_PYTHON 1 PARENT_SCOPE)
+    return()
+  endif()
+
   # Generator expressions are evaluated in the context of each build configuration generated
   # by CMake. Here we use the $<CONFIG:Debug>:VALUE logical generator expression to ensure
   # that the debug Python library, DLL, and executable are used in the Debug build configuration.
@@ -113,9 +149,9 @@ function(find_python_libs_windows)
   set (PYTHON_DLL ${PYTHON_DLL} PARENT_SCOPE)
   set (PYTHON_INCLUDE_DIRS ${PYTHON_INCLUDE_DIRS} PARENT_SCOPE)
 
-  message("-- LLDB Found PythonExecutable: ${PYTHON_EXECUTABLE}")
-  message("-- LLDB Found PythonLibs: ${PYTHON_LIBRARY}")
-  message("-- LLDB Found PythonDLL: ${PYTHON_DLL}")
+  message("-- LLDB Found PythonExecutable: ${PYTHON_RELEASE_EXE} and ${PYTHON_DEBUG_EXE}")
+  message("-- LLDB Found PythonLibs: ${PYTHON_RELEASE_LIB} and ${PYTHON_DEBUG_LIB}")
+  message("-- LLDB Found PythonDLL: ${PYTHON_RELEASE_DLL} and ${PYTHON_DEBUG_DLL}")
   message("-- LLDB Found PythonIncludeDirs: ${PYTHON_INCLUDE_DIRS}")
 endfunction(find_python_libs_windows)
 




More information about the lldb-commits mailing list