[Lldb-commits] [PATCH] D13520: Make CMake display more readable paths to Python binaries on Windows

Vadim Macagon via lldb-commits lldb-commits at lists.llvm.org
Wed Oct 7 10:40:19 PDT 2015


enlight created this revision.
enlight added reviewers: zturner, brucem.
enlight added a subscriber: lldb-commits.
enlight set the repository for this revision to rL LLVM.

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.

Repository:
  rL LLVM

http://reviews.llvm.org/D13520

Files:
  cmake/modules/LLDBConfig.cmake

Index: cmake/modules/LLDBConfig.cmake
===================================================================
--- cmake/modules/LLDBConfig.cmake
+++ cmake/modules/LLDBConfig.cmake
@@ -82,6 +82,42 @@
   file(TO_CMAKE_PATH "${PYTHON_HOME}/python.exe" PYTHON_RELEASE_EXE)
   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
@@ -113,9 +149,9 @@
   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)
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D13520.36764.patch
Type: text/x-patch
Size: 2452 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20151007/7188f991/attachment.bin>


More information about the lldb-commits mailing list