Skip to content

Commit 5a115e8

Browse files
committedSep 16, 2019
Fix swig python package path
Summary: The path defined in CMakeLists.txt doesn't match the path generated in our python script. This change fixes that. LLVM_LIBRARY_OUTPUT_INTDIR is defined as: ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib${LLVM_LIBDIR_SUFFIX}) On the other hand, the path of site-package is generaged in get_framework_python_dir_windows() in finishSwigPythonLLDB.py as: (Dispite its name, the function is used for everything other than xcode) prefix/cmakeBuildConfiguration/distutils.sysconfig.get_python_lib() From lldb/CMakeLists.txt, we can see that: prefix=${CMAKE_BINARY_DIR}, cmakeBuildConfiguration=${CMAKE_CFG_INTDIR} And from python source code, we can see get_python_lib() always returns lib/pythonx.y/site-packages for posix, or Lib/site-packages for windows: https://github.com/python/cpython/blob/3.8/Lib/distutils/sysconfig.py#L128 We should make them match each other. Subscribers: mgorny, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D67583 llvm-svn: 372047
1 parent 8fc8d3f commit 5a115e8

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed
 

Diff for: ‎lldb/scripts/CMakeLists.txt

+6-4
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,15 @@ add_custom_target(swig_wrapper ALL DEPENDS
4242
)
4343

4444
if(NOT LLDB_BUILD_FRAMEWORK)
45-
if(CMAKE_SYSTEM_NAME MATCHES "Windows")
46-
set(swig_python_subdir site-packages)
45+
# The path here should match the result of python function
46+
# distutils.sysconfig.get_python_lib().
47+
if(CMAKE_HOST_SYSTEM_NAME MATCHES "Windows")
48+
set(swig_python_subdir Lib/site-packages)
4749
else()
48-
set(swig_python_subdir python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR})
50+
set(swig_python_subdir lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR})
4951
endif()
5052

51-
set(SWIG_PYTHON_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/${swig_python_subdir})
53+
set(SWIG_PYTHON_DIR ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${swig_python_subdir})
5254
set(SWIG_INSTALL_DIR lib${LLVM_LIBDIR_SUFFIX})
5355

5456
# Install the LLDB python module

0 commit comments

Comments
 (0)
Please sign in to comment.