if (LLDB_ENABLE_PYTHON)
execute_process(
- COMMAND ${PYTHON_EXECUTABLE}
+ COMMAND ${Python3_EXECUTABLE}
-c "import distutils.sysconfig; print(distutils.sysconfig.get_python_lib(True, False, ''))"
OUTPUT_VARIABLE LLDB_PYTHON_DEFAULT_RELATIVE_PATH
OUTPUT_STRIP_TRAILING_WHITESPACE)
set(copy_cmd COMMAND ${CMAKE_COMMAND} -E copy ${ARG_FILES} ${pkg_dir})
endif()
if(NOT ARG_NOINIT)
- set(init_cmd COMMAND ${PYTHON_EXECUTABLE}
+ set(init_cmd COMMAND ${Python3_EXECUTABLE}
"${LLDB_SOURCE_DIR}/bindings/python/createPythonInit.py"
"${pkg_dir}" ${ARG_FILES})
endif()
#.rst:
-# FindPythonInterpAndLibs
+# FindPythonAndSwig
# -----------
#
# Find the python interpreter and libraries as a whole.
set(Python3_ROOT_DIR "${PYTHON_HOME}")
find_package(Python3 COMPONENTS Interpreter Development)
if(Python3_FOUND AND Python3_Interpreter_FOUND)
- set(PYTHON_LIBRARIES ${Python3_LIBRARIES})
- set(PYTHON_INCLUDE_DIRS ${Python3_INCLUDE_DIRS})
- set(PYTHON_EXECUTABLE ${Python3_EXECUTABLE})
# The install name for the Python 3 framework in Xcode is relative to
# the framework's location and not the dylib itself.
# called Python.framework instead of Python3.framework.
if (APPLE AND Python3_LIBRARIES MATCHES "Python3.framework")
string(FIND "${Python3_LIBRARIES}" "Python3.framework" python_framework_pos)
- string(SUBSTRING "${Python3_LIBRARIES}" "0" ${python_framework_pos} PYTHON_RPATH)
+ string(SUBSTRING "${Python3_LIBRARIES}" "0" ${python_framework_pos} Python3_RPATH)
endif()
set(PYTHON3_FOUND TRUE)
mark_as_advanced(
- PYTHON_LIBRARIES
- PYTHON_INCLUDE_DIRS
- PYTHON_EXECUTABLE
- PYTHON_RPATH
+ Python3_LIBRARIES
+ Python3_INCLUDE_DIRS
+ Python3_EXECUTABLE
+ Python3_RPATH
SWIG_EXECUTABLE)
endif()
endmacro()
-if(PYTHON_LIBRARIES AND PYTHON_INCLUDE_DIRS AND PYTHON_EXECUTABLE AND SWIG_EXECUTABLE)
- set(PYTHONINTERPANDLIBS_FOUND TRUE)
+if(Python3_LIBRARIES AND Python3_INCLUDE_DIRS AND Python3_EXECUTABLE AND SWIG_EXECUTABLE)
+ set(PYTHONANDSWIG_FOUND TRUE)
else()
find_package(SWIG 2.0)
if (SWIG_FOUND)
endif()
include(FindPackageHandleStandardArgs)
- find_package_handle_standard_args(PythonInterpAndLibs
+ find_package_handle_standard_args(PythonAndSwig
FOUND_VAR
- PYTHONINTERPANDLIBS_FOUND
+ PYTHONANDSWIG_FOUND
REQUIRED_VARS
- PYTHON_LIBRARIES
- PYTHON_INCLUDE_DIRS
- PYTHON_EXECUTABLE
+ Python3_LIBRARIES
+ Python3_INCLUDE_DIRS
+ Python3_EXECUTABLE
SWIG_EXECUTABLE)
endif()
add_optional_dependency(LLDB_ENABLE_CURSES "Enable curses support in LLDB" CursesAndPanel CURSESANDPANEL_FOUND)
add_optional_dependency(LLDB_ENABLE_LZMA "Enable LZMA compression support in LLDB" LibLZMA LIBLZMA_FOUND)
add_optional_dependency(LLDB_ENABLE_LUA "Enable Lua scripting support in LLDB" LuaAndSwig LUAANDSWIG_FOUND)
-add_optional_dependency(LLDB_ENABLE_PYTHON "Enable Python scripting support in LLDB" PythonInterpAndLibs PYTHONINTERPANDLIBS_FOUND)
+add_optional_dependency(LLDB_ENABLE_PYTHON "Enable Python scripting support in LLDB" PythonAndSwig PYTHONANDSWIG_FOUND)
add_optional_dependency(LLDB_ENABLE_LIBXML2 "Enable Libxml 2 support in LLDB" LibXml2 LIBXML2_FOUND VERSION 2.8)
option(LLDB_USE_SYSTEM_SIX "Use six.py shipped with system and do not install a copy of it" OFF)
"Embed PYTHONHOME in the binary. If set to OFF, PYTHONHOME environment variable will be used to to locate Python."
${default_embed_python_home})
- include_directories(${PYTHON_INCLUDE_DIRS})
+ include_directories(${Python3_INCLUDE_DIRS})
if (LLDB_EMBED_PYTHON_HOME)
- get_filename_component(PYTHON_HOME "${PYTHON_EXECUTABLE}" DIRECTORY)
+ get_filename_component(PYTHON_HOME "${Python3_EXECUTABLE}" DIRECTORY)
set(LLDB_PYTHON_HOME "${PYTHON_HOME}" CACHE STRING
"Path to use as PYTHONHOME in lldb. If a relative path is specified, it will be resolved at runtime relative to liblldb directory.")
endif()
set_property(TARGET liblldb APPEND PROPERTY INSTALL_RPATH "\$ORIGIN/../../../../lib${LLVM_LIBDIR_SUFFIX}")
endif()
-if(PYTHON_RPATH)
- set_property(TARGET liblldb APPEND PROPERTY INSTALL_RPATH "${PYTHON_RPATH}")
- set_property(TARGET liblldb APPEND PROPERTY BUILD_RPATH "${PYTHON_RPATH}")
+if(Python3_RPATH)
+ set_property(TARGET liblldb APPEND PROPERTY INSTALL_RPATH "${Python3_RPATH}")
+ set_property(TARGET liblldb APPEND PROPERTY BUILD_RPATH "${Python3_RPATH}")
endif()
if ( CMAKE_SYSTEM_NAME MATCHES "Windows" )
# Only MSVC has the ABI compatibility problem and avoids using FindPythonLibs,
- # so only it needs to explicitly link against ${PYTHON_LIBRARIES}
+ # so only it needs to explicitly link against ${Python3_LIBRARIES}
if (MSVC AND LLDB_ENABLE_PYTHON)
- target_link_libraries(liblldb PRIVATE ${PYTHON_LIBRARIES})
+ target_link_libraries(liblldb PRIVATE ${Python3_LIBRARIES})
endif()
else()
set_target_properties(liblldb
add_subdirectory(Mach-O)
add_subdirectory(PECOFF)
add_subdirectory(JIT)
-add_subdirectory(wasm)
\ No newline at end of file
+add_subdirectory(wasm)
LINK_LIBS
lldbCore
lldbInterpreter
- )
\ No newline at end of file
+ )
lldbHost
lldbInterpreter
lldbTarget
- ${PYTHON_LIBRARIES}
+ ${Python3_LIBRARIES}
${LLDB_LIBEDIT_LIBS}
LINK_COMPONENTS
function(add_python_test_target name test_script args comment)
set(PYTHON_TEST_COMMAND
- ${PYTHON_EXECUTABLE}
+ ${Python3_EXECUTABLE}
${test_script}
${args}
)
config.target_triple = "@TARGET_TRIPLE@"
config.lldb_build_directory = "@LLDB_TEST_BUILD_DIRECTORY@"
config.lldb_reproducer_directory = os.path.join("@LLDB_TEST_BUILD_DIRECTORY@", "reproducers")
-config.python_executable = "@PYTHON_EXECUTABLE@"
+config.python_executable = "@Python3_EXECUTABLE@"
config.dotest_path = "@LLDB_SOURCE_DIR@/test/API/dotest.py"
config.dotest_args_str = "@LLDB_DOTEST_ARGS@"
config.lldb_enable_python = @LLDB_ENABLE_PYTHON@
if (EXISTS ${LLVM_MAIN_SRC_DIR}/utils/llvm-lit)
# LLVM's make_paths_relative uses Python3_EXECUTABLE which isn't set in a
# standalone LLDB build.
- set(Python3_EXECUTABLE ${PYTHON_EXECUTABLE})
+ set(Python3_EXECUTABLE ${Python3_EXECUTABLE})
add_subdirectory(${LLVM_MAIN_SRC_DIR}/utils/llvm-lit ${CMAKE_CURRENT_BINARY_DIR}/llvm-lit)
endif()
endif()
# should not need to be escaped.
config.lldb_lit_tools_dir = r"@LLDB_LIT_TOOLS_DIR@"
config.target_triple = "@TARGET_TRIPLE@"
-config.python_executable = "@PYTHON_EXECUTABLE@"
+config.python_executable = "@Python3_EXECUTABLE@"
config.have_zlib = @LLVM_ENABLE_ZLIB@
config.lldb_enable_lzma = @LLDB_ENABLE_LZMA@
config.host_triple = "@LLVM_HOST_TRIPLE@"
config.lldb_obj_root = "@LLDB_BINARY_DIR@"
config.lldb_src_root = "@LLDB_SOURCE_DIR@"
config.target_triple = "@TARGET_TRIPLE@"
-config.python_executable = "@PYTHON_EXECUTABLE@"
+config.python_executable = "@Python3_EXECUTABLE@"
# Support substitution of the tools and libs dirs with user parameters. This is
# used when we can't determine the tool dir at configuration time.
config.lldb_obj_root = "@LLDB_BINARY_DIR@"
config.lldb_src_root = "@LLDB_SOURCE_DIR@"
config.target_triple = "@TARGET_TRIPLE@"
-config.python_executable = "@PYTHON_EXECUTABLE@"
+config.python_executable = "@Python3_EXECUTABLE@"
# Support substitution of the tools and libs dirs with user parameters. This is
# used when we can't determine the tool dir at configuration time.
LINK_LIBS
${FEATURE_LIBS}
- ${PYTHON_LIBRARIES}
+ ${Python3_LIBRARIES}
)
# Add link dependencies for python wrapper
Support
)
-if(PYTHON_RPATH)
- set_property(TARGET lldb-test APPEND PROPERTY INSTALL_RPATH "${PYTHON_RPATH}")
- set_property(TARGET lldb-test APPEND PROPERTY BUILD_RPATH "${PYTHON_RPATH}")
+if(Python3_RPATH)
+ set_property(TARGET lldb-test APPEND PROPERTY INSTALL_RPATH "${Python3_RPATH}")
+ set_property(TARGET lldb-test APPEND PROPERTY BUILD_RPATH "${Python3_RPATH}")
endif()
target_include_directories(lldb-test PRIVATE ${LLDB_SOURCE_DIR}/source)
liblldb
)
-if(PYTHON_RPATH)
- set_property(TARGET APITests APPEND PROPERTY BUILD_RPATH "${PYTHON_RPATH}")
+if(Python3_RPATH)
+ set_property(TARGET APITests APPEND PROPERTY BUILD_RPATH "${Python3_RPATH}")
endif()
)
target_include_directories(ProcessorTraceTests PRIVATE
- ${LLDB_SOURCE_DIR}/source/Plugins/Process/Linux)
\ No newline at end of file
+ ${LLDB_SOURCE_DIR}/source/Plugins/Process/Linux)
LLVMTestingSupport
LINK_COMPONENTS
Support
- )
\ No newline at end of file
+ )
Support
)
-if(PYTHON_RPATH)
- set_property(TARGET ScriptInterpreterPythonTests APPEND PROPERTY BUILD_RPATH "${PYTHON_RPATH}")
-endif()
\ No newline at end of file
+if(Python3_RPATH)
+ set_property(TARGET ScriptInterpreterPythonTests APPEND PROPERTY BUILD_RPATH "${Python3_RPATH}")
+endif()
-#!@PYTHON_EXECUTABLE@
+#!@Python3_EXECUTABLE@
import subprocess
import sys