diff --git a/lldb/CMakeLists.txt b/lldb/CMakeLists.txt --- a/lldb/CMakeLists.txt +++ b/lldb/CMakeLists.txt @@ -37,18 +37,29 @@ -c "import distutils.sysconfig; print(distutils.sysconfig.get_python_lib(True, False, ''))" OUTPUT_VARIABLE LLDB_PYTHON_DEFAULT_RELATIVE_PATH OUTPUT_STRIP_TRAILING_WHITESPACE) - file(TO_CMAKE_PATH ${LLDB_PYTHON_DEFAULT_RELATIVE_PATH} LLDB_PYTHON_DEFAULT_RELATIVE_PATH) + execute_process( + COMMAND ${Python3_EXECUTABLE} + -c "import sysconfig; print(sysconfig.get_config_var('EXT_SUFFIX'))" + OUTPUT_VARIABLE LLDB_PYTHON_DEFAULT_EXT_SUFFIX + OUTPUT_STRIP_TRAILING_WHITESPACE) else () if ("${LLDB_PYTHON_RELATIVE_PATH}" STREQUAL "") message(FATAL_ERROR "Crosscompiling LLDB with Python requires manually setting LLDB_PYTHON_RELATIVE_PATH.") endif () + if ("${LLDB_PYTHON_EXT_SUFFIX}" STREQUAL "") + message(FATAL_ERROR + "Crosscompiling LLDB with Python requires manually setting + LLDB_PYTHON_EXT_SUFFIX.") + endif () endif () set(LLDB_PYTHON_RELATIVE_PATH ${LLDB_PYTHON_DEFAULT_RELATIVE_PATH} - CACHE STRING "Path where Python modules are installed, relative to install prefix") + CACHE STRING "Path where Python modules are installed, relative to install prefix.") + set(LLDB_PYTHON_EXT_SUFFIX ${LLDB_PYTHON_DEFAULT_EXT_SUFFIX} + CACHE STRING "Filename suffix for Python modules.") endif () if (LLDB_ENABLE_LUA) diff --git a/lldb/bindings/python/CMakeLists.txt b/lldb/bindings/python/CMakeLists.txt --- a/lldb/bindings/python/CMakeLists.txt +++ b/lldb/bindings/python/CMakeLists.txt @@ -138,13 +138,14 @@ set(LIBLLDB_SYMLINK_DEST "${LLVM_SHLIB_OUTPUT_INTDIR}/liblldb${CMAKE_SHARED_LIBRARY_SUFFIX}") endif() if(WIN32) + # FIXME should we use EXT_SUFFIX on windows? if(CMAKE_BUILD_TYPE STREQUAL Debug) set(LIBLLDB_SYMLINK_OUTPUT_FILE "_lldb_d.pyd") else() set(LIBLLDB_SYMLINK_OUTPUT_FILE "_lldb.pyd") endif() else() - set(LIBLLDB_SYMLINK_OUTPUT_FILE "_lldb.so") + set(LIBLLDB_SYMLINK_OUTPUT_FILE "_lldb${LLDB_PYTHON_EXT_SUFFIX}") endif() create_relative_symlink(${swig_target} ${LIBLLDB_SYMLINK_DEST} ${lldb_python_target_dir} ${LIBLLDB_SYMLINK_OUTPUT_FILE})