2015-04-24 08:38:53 +08:00
|
|
|
file(GLOB SWIG_INTERFACES interface/*.i)
|
2015-03-14 00:31:58 +08:00
|
|
|
file(GLOB_RECURSE SWIG_SOURCES *.swig)
|
2015-05-29 01:25:34 +08:00
|
|
|
set(SWIG_HEADERS
|
|
|
|
${LLDB_SOURCE_DIR}/include/lldb/API/SBDefines.h
|
|
|
|
${LLDB_SOURCE_DIR}/include/lldb/lldb-defines.h
|
|
|
|
${LLDB_SOURCE_DIR}/include/lldb/lldb-enumerations.h
|
|
|
|
${LLDB_SOURCE_DIR}/include/lldb/lldb-forward.h
|
|
|
|
${LLDB_SOURCE_DIR}/include/lldb/lldb-types.h
|
|
|
|
${LLDB_SOURCE_DIR}/include/lldb/lldb-versioning.h
|
|
|
|
)
|
2014-04-03 23:03:11 +08:00
|
|
|
|
2016-05-13 03:49:17 +08:00
|
|
|
include(FindPythonInterp)
|
|
|
|
|
2017-01-07 06:05:35 +08:00
|
|
|
if (NOT CMAKE_SYSTEM_NAME MATCHES "Windows")
|
|
|
|
set(SWIG_PYTHON_DIR
|
|
|
|
${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR})
|
|
|
|
else()
|
|
|
|
set(SWIG_PYTHON_DIR ${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/site-packages)
|
|
|
|
endif()
|
|
|
|
|
2016-09-22 05:02:16 +08:00
|
|
|
set(SWIG_INSTALL_DIR lib${LLVM_LIBDIR_SUFFIX})
|
|
|
|
|
|
|
|
# Generating the LLDB framework correctly is a bit complicated because the
|
|
|
|
# framework depends on the swig output.
|
|
|
|
if(LLDB_BUILD_FRAMEWORK)
|
|
|
|
set(framework_arg --framework --target-platform Darwin)
|
|
|
|
set(SWIG_PYTHON_DIR
|
|
|
|
${LLDB_PYTHON_TARGET_DIR}/${LLDB_FRAMEWORK_RESOURCE_DIR}/Python)
|
|
|
|
set(SWIG_INSTALL_DIR
|
|
|
|
${LLDB_FRAMEWORK_INSTALL_DIR}/${LLDB_FRAMEWORK_RESOURCE_DIR})
|
|
|
|
endif()
|
|
|
|
|
2015-09-08 13:00:22 +08:00
|
|
|
find_package(SWIG REQUIRED)
|
|
|
|
add_custom_command(
|
2016-09-22 05:02:16 +08:00
|
|
|
OUTPUT ${LLDB_WRAP_PYTHON}
|
2015-11-12 01:59:34 +08:00
|
|
|
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lldb.py
|
2015-09-08 13:00:22 +08:00
|
|
|
DEPENDS ${SWIG_SOURCES}
|
|
|
|
DEPENDS ${SWIG_INTERFACES}
|
|
|
|
DEPENDS ${SWIG_HEADERS}
|
2015-11-19 06:21:47 +08:00
|
|
|
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/Python/prepare_binding_Python.py
|
2015-11-07 09:08:25 +08:00
|
|
|
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/Python/modify-python-lldb.py
|
2016-09-22 05:02:16 +08:00
|
|
|
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/prepare_bindings.py
|
2016-12-17 00:38:25 +08:00
|
|
|
${framework_arg}
|
|
|
|
--srcRoot=${LLDB_SOURCE_DIR}
|
|
|
|
--targetDir=${LLDB_PYTHON_TARGET_DIR}
|
|
|
|
--cfgBldDir=${CMAKE_CURRENT_BINARY_DIR}
|
|
|
|
--prefix=${CMAKE_BINARY_DIR}
|
|
|
|
--swigExecutable=${SWIG_EXECUTABLE}
|
|
|
|
VERBATIM
|
2015-09-08 13:00:22 +08:00
|
|
|
COMMENT "Python script building LLDB Python wrapper")
|
2017-10-31 21:23:19 +08:00
|
|
|
add_custom_target(swig_wrapper ALL DEPENDS ${LLDB_WRAP_PYTHON})
|
|
|
|
|
2015-11-19 01:36:15 +08:00
|
|
|
set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/lldb.py PROPERTIES GENERATED 1)
|
2013-06-14 00:05:41 +08:00
|
|
|
|
|
|
|
|
2017-01-07 06:05:35 +08:00
|
|
|
# Install the LLDB python module
|
|
|
|
install(DIRECTORY ${SWIG_PYTHON_DIR} DESTINATION ${SWIG_INSTALL_DIR})
|
2014-02-26 15:39:20 +08:00
|
|
|
|
|
|
|
# build Python modules
|
2014-08-26 02:16:22 +08:00
|
|
|
add_subdirectory(Python/modules)
|