fyi, For some reason, this makes the python library path case sensitive on 
Windows.

My system had C:\src\Python. The source dir was C:\src\python, causing the 
failure below.

No big deal, just an fyi, I renamed the directory on the buildslave and 
happiness.

-rick

Copying PYTHON_DEBUG_LIBRARY-NOTFOUND to 
C:/buildbots/hexagon-build-01-exp/builddir/lldb-x86-win7-msvc/build/bin
CMake Error at tools/lldb/scripts/CMakeLists.txt:8 (file):
  file COPY cannot find
  
"C:/buildbots/hexagon-build-01-exp/builddir/lldb-x86-win7-msvc/llvm/tools/lldb/scripts/PYTHON_DEBUG_LIBRARY-NOTFOUND".

On 01/21/2015 11:53 AM, Zachary Turner wrote:
Author: zturner
Date: Wed Jan 21 11:53:10 2015
New Revision: 226679

URL: http://llvm.org/viewvc/llvm-project?rev=226679&view=rev
Log:
Some fixes for linking Python on Windows.

CMake FindPythonLibs will look for multiple versions of Python
including both debug and release, and build up a list such as
(debug <debugpath> optimized <optimizedpath>).  This confuses
the logic we have in CMake to copy the correct python dll to
the output directory so that it need not be in your system's PATH.

To alleviate this, we manually split this list and extract out
the debug and release versions of the python library, and copy
only the correct one to the output directory.

Modified:
     lldb/trunk/CMakeLists.txt
     lldb/trunk/scripts/CMakeLists.txt

Modified: lldb/trunk/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/CMakeLists.txt?rev=226679&r1=226678&r2=226679&view=diff
==============================================================================
--- lldb/trunk/CMakeLists.txt (original)
+++ lldb/trunk/CMakeLists.txt Wed Jan 21 11:53:10 2015
@@ -137,6 +137,23 @@ if (NOT LLDB_DISABLE_PYTHON)
      endif()
    endif()
    find_package(PythonLibs REQUIRED)
+  # PYTHON_LIBRARIES is now a list in the form (debug DebugPath optimized 
OptimizedPath)
+  # So we need to parse it to get the path to the respective installations.
+  list(FIND PYTHON_LIBRARIES optimized PYTHON_OPTIMIZED_INDEX)
+  list(FIND PYTHON_LIBRARIES debug PYTHON_DEBUG_INDEX)
+  if (NOT ${PYTHON_OPTIMIZED_INDEX} EQUAL -1)
+    MATH(EXPR PYTHON_OPTIMIZED_INDEX "${PYTHON_OPTIMIZED_INDEX}+1")
+    list(GET PYTHON_LIBRARIES ${PYTHON_OPTIMIZED_INDEX} PYTHON_RELEASE_LIBRARY)
+  endif()
+  if (NOT ${PYTHON_DEBUG_INDEX} EQUAL -1)
+    MATH(EXPR PYTHON_DEBUG_INDEX "${PYTHON_DEBUG_INDEX}+1")
+    list(GET PYTHON_LIBRARIES ${PYTHON_DEBUG_INDEX} PYTHON_DEBUG_LIBRARY)
+  endif()
+  if (CMAKE_BUILD_TYPE STREQUAL "Debug")
+    set(PYTHON_LIBRARY ${PYTHON_DEBUG_LIBRARY})
+  else()
+    set(PYTHON_LIBRARY ${PYTHON_RELEASE_LIBRARY})
+  endif()
    include_directories(${PYTHON_INCLUDE_DIRS})
  endif()
Modified: lldb/trunk/scripts/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/CMakeLists.txt?rev=226679&r1=226678&r2=226679&view=diff
==============================================================================
--- lldb/trunk/scripts/CMakeLists.txt (original)
+++ lldb/trunk/scripts/CMakeLists.txt Wed Jan 21 11:53:10 2015
@@ -3,7 +3,8 @@ set(LLVM_NO_RTTI 1)
  file(GLOB SWIG_INPUTS Python/interface/*.i)
if (CMAKE_SYSTEM_NAME MATCHES "Windows")
-    STRING(REGEX REPLACE ".lib" ".dll" PYTHON_DLL ${PYTHON_LIBRARY})
+    STRING(REGEX REPLACE "[.]lib" ".dll" PYTHON_DLL ${PYTHON_LIBRARY})
+    message("Copying ${PYTHON_DLL} to ${CMAKE_BINARY_DIR}/bin")
      file(COPY ${PYTHON_DLL} DESTINATION ${CMAKE_BINARY_DIR}/bin)
  endif ()

_______________________________________________
lldb-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits

--
Rick Foos
Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux 
Foundation Collaborative Project

_______________________________________________
lldb-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits

Reply via email to