summaryrefslogtreecommitdiffstats
path: root/lldb
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2015-01-21 17:53:10 +0000
committerZachary Turner <zturner@google.com>2015-01-21 17:53:10 +0000
commitf3a7da349cddaa4c12eebd757673fa2c45a8ab47 (patch)
tree6397e31deee6d92973cff35a2fe1c68a6ebfe7d1 /lldb
parentfd725c060bf727f8967eef96dd6a72213fe93887 (diff)
downloadbcm5719-llvm-f3a7da349cddaa4c12eebd757673fa2c45a8ab47.tar.gz
bcm5719-llvm-f3a7da349cddaa4c12eebd757673fa2c45a8ab47.zip
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. llvm-svn: 226679
Diffstat (limited to 'lldb')
-rw-r--r--lldb/CMakeLists.txt17
-rw-r--r--lldb/scripts/CMakeLists.txt3
2 files changed, 19 insertions, 1 deletions
diff --git a/lldb/CMakeLists.txt b/lldb/CMakeLists.txt
index 65c5b2ab968..28c988e034c 100644
--- a/lldb/CMakeLists.txt
+++ b/lldb/CMakeLists.txt
@@ -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()
diff --git a/lldb/scripts/CMakeLists.txt b/lldb/scripts/CMakeLists.txt
index b0023968078..58527a87837 100644
--- a/lldb/scripts/CMakeLists.txt
+++ b/lldb/scripts/CMakeLists.txt
@@ -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 ()
OpenPOWER on IntegriCloud