[lldb/Bindings] Move bindings into their own subdirectory

All the code required to generate the language bindings for Python and
Lua lives under scripts, even though the majority of this code aren't
scripts at all, and surrounded by scripts that are totally unrelated.

I've reorganized these files and moved everything related to the
language bindings into a new top-level directory named bindings. This
makes the corresponding files self contained and much more discoverable.

Differential revision: https://reviews.llvm.org/D72437
This commit is contained in:
Jonas Devlieghere
2020-01-09 07:57:59 -08:00
parent 241f335b26
commit 6498aff249
80 changed files with 17 additions and 18 deletions

View File

@@ -56,7 +56,7 @@ if (LLDB_ENABLE_PYTHON)
endif ()
if (LLDB_ENABLE_PYTHON OR LLDB_ENABLE_LUA)
add_subdirectory(scripts)
add_subdirectory(bindings)
endif ()
# We need the headers generated by instrinsics_gen before we can compile
@@ -97,7 +97,7 @@ if(LLDB_INCLUDE_TESTS)
endif()
if (LLDB_ENABLE_PYTHON)
get_target_property(lldb_scripts_dir swig_wrapper BINARY_DIR)
get_target_property(lldb_bindings_dir swig_wrapper BINARY_DIR)
if(LLDB_BUILD_FRAMEWORK)
set(lldb_python_build_path "${LLDB_FRAMEWORK_ABSOLUTE_BUILD_DIR}/LLDB.framework/Resources/Python/lldb")
@@ -109,7 +109,7 @@ if (LLDB_ENABLE_PYTHON)
# to liblldb.so for the Python API(hardlink on Windows).
add_custom_target(finish_swig ALL VERBATIM
COMMAND ${CMAKE_COMMAND} -E make_directory ${lldb_python_build_path}
DEPENDS ${lldb_scripts_dir}/lldb.py
DEPENDS ${lldb_bindings_dir}/lldb.py
COMMENT "Python script sym-linking LLDB Python API")
if(NOT LLDB_USE_SYSTEM_SIX)
@@ -121,7 +121,7 @@ if (LLDB_ENABLE_PYTHON)
add_custom_command(TARGET finish_swig POST_BUILD VERBATIM
COMMAND ${CMAKE_COMMAND} -E copy
"${lldb_scripts_dir}/lldb.py"
"${lldb_bindings_dir}/lldb.py"
"${lldb_python_build_path}/__init__.py")
function(create_python_package pkg_dir)
@@ -131,7 +131,7 @@ if (LLDB_ENABLE_PYTHON)
endif()
if(NOT ARG_NOINIT)
set(init_cmd COMMAND ${PYTHON_EXECUTABLE}
"${LLDB_SOURCE_DIR}/scripts/Python/createPythonInit.py"
"${LLDB_SOURCE_DIR}/bindings/python/createPythonInit.py"
"${pkg_dir}" ${ARG_FILES})
endif()
add_custom_command(TARGET finish_swig POST_BUILD VERBATIM

View File

@@ -1,4 +1,4 @@
file(GLOB SWIG_INTERFACES interface/*.i)
file(GLOB SWIG_INTERFACES interfaces/*.i)
file(GLOB_RECURSE SWIG_SOURCES *.swig)
file(GLOB SWIG_HEADERS
${LLDB_SOURCE_DIR}/include/lldb/API/*.h
@@ -46,7 +46,7 @@ if (LLDB_ENABLE_PYTHON)
-python
-threads
-o ${CMAKE_CURRENT_BINARY_DIR}/LLDBWrapPython.cpp
${LLDB_SOURCE_DIR}/scripts/lldb.swig
${LLDB_SOURCE_DIR}/bindings/python.swig
VERBATIM
COMMENT "Builds LLDB Python wrapper")
@@ -67,7 +67,7 @@ if (LLDB_ENABLE_LUA)
-lua
-w503
-o ${CMAKE_CURRENT_BINARY_DIR}/LLDBWrapLua.cpp
${LLDB_SOURCE_DIR}/scripts/lldb_lua.swig
${LLDB_SOURCE_DIR}/bindings/lua.swig
VERBATIM
COMMENT "Builds LLDB Lua wrapper")

View File

@@ -32,8 +32,8 @@
%include "./interface/SBEvent.i"
%include "./interface/SBExecutionContext.i"
%include "./interface/SBExpressionOptions.i"
%include "./interface/SBFileSpec.i"
%include "./interface/SBFile.i"
%include "./interface/SBFileSpec.i"
%include "./interface/SBFileSpecList.i"
%include "./interface/SBFrame.i"
%include "./interface/SBFunction.i"
@@ -75,9 +75,8 @@
%include "./interface/SBTypeNameSpecifier.i"
%include "./interface/SBTypeSummary.i"
%include "./interface/SBTypeSynthetic.i"
%include "./interface/SBUnixSignals.i"
%include "./interface/SBValue.i"
%include "./interface/SBValueList.i"
%include "./interface/SBVariablesOptions.i"
%include "./interface/SBWatchpoint.i"
%include "./interface/SBUnixSignals.i"

View File

@@ -117,7 +117,7 @@ def lldb_iter(obj, getsize, getelem):
%{
#include "../source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h"
#include "../scripts/Python/python-swigsafecast.swig"
#include "../bindings/python/python-swigsafecast.swig"
using namespace lldb_private;
using namespace lldb_private::python;
using namespace lldb;

View File

@@ -30,9 +30,9 @@ if (LLDB_ENABLE_PYTHON)
# Because we don't build liblldb, epydoc will complain that the import of
# _lldb.so failed, but that doesn't prevent it from generating the docs.
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lldb)
get_target_property(lldb_scripts_dir swig_wrapper BINARY_DIR)
get_target_property(lldb_bindings_dir swig_wrapper BINARY_DIR)
add_custom_target(lldb-python-doc-package
COMMAND "${CMAKE_COMMAND}" -E copy "${lldb_scripts_dir}/lldb.py" "${CMAKE_CURRENT_BINARY_DIR}/lldb/__init__.py"
COMMAND "${CMAKE_COMMAND}" -E copy "${lldb_bindings_dir}/lldb.py" "${CMAKE_CURRENT_BINARY_DIR}/lldb/__init__.py"
COMMENT "Copying lldb.py to pretend package.")
add_dependencies(lldb-python-doc-package swig_wrapper)

View File

@@ -5,13 +5,13 @@ endif()
get_property(LLDB_ALL_PLUGINS GLOBAL PROPERTY LLDB_PLUGINS)
if(LLDB_ENABLE_PYTHON)
get_target_property(lldb_scripts_dir swig_wrapper BINARY_DIR)
set(lldb_python_wrapper ${lldb_scripts_dir}/LLDBWrapPython.cpp)
get_target_property(lldb_bindings_dir swig_wrapper BINARY_DIR)
set(lldb_python_wrapper ${lldb_bindings_dir}/LLDBWrapPython.cpp)
endif()
if(LLDB_ENABLE_LUA)
get_target_property(lldb_scripts_dir swig_wrapper_lua BINARY_DIR)
set(lldb_lua_wrapper ${lldb_scripts_dir}/LLDBWrapLua.cpp)
get_target_property(lldb_bindings_dir swig_wrapper_lua BINARY_DIR)
set(lldb_lua_wrapper ${lldb_bindings_dir}/LLDBWrapLua.cpp)
endif()
if(LLDB_BUILD_FRAMEWORK)