2016-06-01 04:21:44 +08:00
|
|
|
cmake_minimum_required(VERSION 3.4.3)
|
2019-12-23 05:57:46 +08:00
|
|
|
if(CMAKE_SYSTEM_NAME STREQUAL Windows)
|
|
|
|
cmake_minimum_required(VERSION 3.13)
|
|
|
|
endif()
|
2015-07-17 23:50:48 +08:00
|
|
|
|
2019-02-18 18:09:29 +08:00
|
|
|
if(POLICY CMP0075)
|
|
|
|
cmake_policy(SET CMP0075 NEW)
|
|
|
|
endif()
|
|
|
|
|
2019-05-22 21:23:15 +08:00
|
|
|
# Add path for custom modules.
|
2017-04-28 00:04:26 +08:00
|
|
|
set(CMAKE_MODULE_PATH
|
|
|
|
${CMAKE_MODULE_PATH}
|
|
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/cmake"
|
|
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules"
|
|
|
|
)
|
|
|
|
|
2019-07-18 00:47:02 +08:00
|
|
|
# If we are not building as part of LLVM, build LLDB as a standalone project,
|
|
|
|
# using LLVM as an external library.
|
|
|
|
if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
|
2019-07-30 07:09:31 +08:00
|
|
|
project(lldb)
|
2019-07-18 00:47:02 +08:00
|
|
|
include(LLDBStandalone)
|
2019-10-29 23:24:10 +08:00
|
|
|
|
|
|
|
set(CMAKE_CXX_STANDARD 14 CACHE STRING "C++ standard to conform to")
|
|
|
|
set(CMAKE_CXX_STANDARD_REQUIRED YES)
|
|
|
|
set(CMAKE_CXX_EXTENSIONS NO)
|
2019-07-18 00:47:02 +08:00
|
|
|
endif()
|
|
|
|
|
2017-04-28 00:04:26 +08:00
|
|
|
include(LLDBConfig)
|
|
|
|
include(AddLLDB)
|
2014-05-29 01:06:04 +08:00
|
|
|
|
2019-05-22 21:23:15 +08:00
|
|
|
# Define the LLDB_CONFIGURATION_xxx matching the build type.
|
2017-10-05 04:23:56 +08:00
|
|
|
if( uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG" )
|
|
|
|
add_definitions( -DLLDB_CONFIGURATION_DEBUG )
|
|
|
|
else()
|
|
|
|
add_definitions( -DLLDB_CONFIGURATION_RELEASE )
|
|
|
|
endif()
|
|
|
|
|
2017-07-28 23:39:50 +08:00
|
|
|
if(APPLE)
|
|
|
|
add_definitions(-DLLDB_USE_OS_LOG)
|
|
|
|
endif()
|
|
|
|
|
2019-02-12 08:30:21 +08:00
|
|
|
if (WIN32)
|
|
|
|
add_definitions(-D_ENABLE_EXTENDED_ALIGNED_STORAGE)
|
|
|
|
endif()
|
|
|
|
|
2019-12-14 02:37:33 +08:00
|
|
|
if (LLDB_ENABLE_PYTHON)
|
2019-10-08 07:49:01 +08:00
|
|
|
execute_process(
|
|
|
|
COMMAND ${PYTHON_EXECUTABLE}
|
2019-10-16 03:24:37 +08:00
|
|
|
-c "import distutils.sysconfig; print(distutils.sysconfig.get_python_lib(True, False, ''))"
|
2019-10-08 07:49:01 +08:00
|
|
|
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)
|
|
|
|
set(LLDB_PYTHON_RELATIVE_PATH ${LLDB_PYTHON_DEFAULT_RELATIVE_PATH}
|
|
|
|
CACHE STRING "Path where Python modules are installed, relative to install prefix")
|
2014-07-04 14:43:47 +08:00
|
|
|
endif ()
|
[lldb] Let table gen create command option initializers.
Summary:
We currently have man large arrays containing initializers for our command options.
These tables are tricky maintain as we don't have any good place to check them for consistency and
it's also hard to read (`nullptr, {}, 0` is not very descriptive).
This patch fixes this by letting table gen generate those tables. This way we can have a more readable
syntax for this (especially for all the default arguments) and we can let TableCheck check them
for consistency (e.g. an option with an optional argument can't have `eArgTypeNone`, naming of flags', etc.).
Also refactoring the related data structures can now be done without changing the hundred of option initializers.
For example, this line:
```
{LLDB_OPT_SET_ALL, false, "hide-aliases", 'a', OptionParser::eNoArgument, nullptr, {}, 0, eArgTypeNone, "Hide aliases in the command list."},
```
becomes this:
```
def hide_aliases : Option<"hide-aliases", "a">, Desc<"Hide aliases in the command list.">;
```
For now I just moved a few initializers to the new format to demonstrate the change. I'll slowly migrate the other
option initializers tables in separate patches.
Reviewers: JDevlieghere, davide, sgraenitz
Reviewed By: JDevlieghere
Subscribers: jingham, xiaobai, labath, mgorny, abidh, lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D64365
llvm-svn: 365908
2019-07-12 23:30:55 +08:00
|
|
|
|
2019-12-22 16:01:09 +08:00
|
|
|
if (LLDB_ENABLE_PYTHON OR LLDB_ENABLE_LUA)
|
2020-01-09 23:57:59 +08:00
|
|
|
add_subdirectory(bindings)
|
2019-12-22 16:01:09 +08:00
|
|
|
endif ()
|
2019-12-09 07:32:57 +08:00
|
|
|
|
[lldb] Let LLDB depend on intrinsics_gen to fix non-deterministic module build failures
Summary:
When building with modules we currently fail randomly to build LLDB's modules and get error messages like below:
```
In file included from <module-includes>:1:
In file included from llvm-project/llvm/include/llvm/IR/Argument.h:18:
llvm-project/llvm/include/llvm/IR/Attributes.h:74:14: fatal error: 'llvm/IR/Attributes.inc' file not found
#include "llvm/IR/Attributes.inc"
^~~~~~~~~~~~~~~~~~~~~~~~
...
In file included from llvm-project/lldb/source/Plugins/ABI/SysV-arm/ABISysV_arm.cpp:9:
llvm-project/lldb/source/Plugins/ABI/SysV-arm/ABISysV_arm.h:12:10: fatal error: could not build module 'lldb_Wrapper'
```
The reason for this is that our source files can include Clang headers which in turn include files like Attributes.inc which
are generated by intrinsics_gen. However, it seems Clang can't express this dependency in its CMake code, so intrinsics_gen
is actually not guaranteed to be built before we start parsing LLDB source files and Clang headers. Clang worked around this
by letting all libraries depend on intrinsics_gen, which at least lets their builds pass.
As I haven't figured out how to solve these dependencies properly and I want to get the LLDB+Modules build green,
I suggest we copy Clang's hack until we figure out how to get Clang's dependencies right.
Reviewers: sgraenitz, aprantl, JDevlieghere
Reviewed By: JDevlieghere
Subscribers: mgorny, javed.absar, kristof.beyls, mgrang, lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D66208
llvm-svn: 368975
2019-08-15 15:29:53 +08:00
|
|
|
# We need the headers generated by instrinsics_gen before we can compile
|
|
|
|
# any source file in LLDB as the imported Clang modules might include
|
|
|
|
# some of these generated headers. This approach is copied from Clang's main
|
|
|
|
# CMakeLists.txt, so it should kept in sync the code in Clang which was added
|
|
|
|
# in llvm-svn 308844.
|
2020-07-18 07:43:05 +08:00
|
|
|
if(LLVM_ENABLE_MODULES)
|
[lldb] Let LLDB depend on intrinsics_gen to fix non-deterministic module build failures
Summary:
When building with modules we currently fail randomly to build LLDB's modules and get error messages like below:
```
In file included from <module-includes>:1:
In file included from llvm-project/llvm/include/llvm/IR/Argument.h:18:
llvm-project/llvm/include/llvm/IR/Attributes.h:74:14: fatal error: 'llvm/IR/Attributes.inc' file not found
#include "llvm/IR/Attributes.inc"
^~~~~~~~~~~~~~~~~~~~~~~~
...
In file included from llvm-project/lldb/source/Plugins/ABI/SysV-arm/ABISysV_arm.cpp:9:
llvm-project/lldb/source/Plugins/ABI/SysV-arm/ABISysV_arm.h:12:10: fatal error: could not build module 'lldb_Wrapper'
```
The reason for this is that our source files can include Clang headers which in turn include files like Attributes.inc which
are generated by intrinsics_gen. However, it seems Clang can't express this dependency in its CMake code, so intrinsics_gen
is actually not guaranteed to be built before we start parsing LLDB source files and Clang headers. Clang worked around this
by letting all libraries depend on intrinsics_gen, which at least lets their builds pass.
As I haven't figured out how to solve these dependencies properly and I want to get the LLDB+Modules build green,
I suggest we copy Clang's hack until we figure out how to get Clang's dependencies right.
Reviewers: sgraenitz, aprantl, JDevlieghere
Reviewed By: JDevlieghere
Subscribers: mgorny, javed.absar, kristof.beyls, mgrang, lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D66208
llvm-svn: 368975
2019-08-15 15:29:53 +08:00
|
|
|
list(APPEND LLVM_COMMON_DEPENDS intrinsics_gen)
|
|
|
|
endif()
|
|
|
|
|
2019-07-18 08:21:57 +08:00
|
|
|
if(CMAKE_CROSSCOMPILING AND LLDB_BUILT_STANDALONE)
|
|
|
|
set(LLVM_USE_HOST_TOOLS ON)
|
|
|
|
include(CrossCompile)
|
2019-07-19 07:40:23 +08:00
|
|
|
if (NOT NATIVE_LLVM_DIR OR NOT NATIVE_Clang_DIR)
|
2019-07-18 08:21:57 +08:00
|
|
|
message(FATAL_ERROR
|
2019-07-19 07:40:23 +08:00
|
|
|
"Crosscompiling standalone requires the variables NATIVE_{CLANG,LLVM}_DIR
|
2019-07-18 08:21:57 +08:00
|
|
|
for building the native lldb-tblgen used during the build process.")
|
|
|
|
endif()
|
|
|
|
llvm_create_cross_target(lldb NATIVE "" Release
|
2019-07-19 07:40:23 +08:00
|
|
|
-DLLVM_DIR=${NATIVE_LLVM_DIR}
|
|
|
|
-DClang_DIR=${NATIVE_Clang_DIR})
|
2019-07-18 08:21:57 +08:00
|
|
|
endif()
|
|
|
|
|
2019-07-27 02:14:04 +08:00
|
|
|
# TableGen
|
[lldb] Let table gen create command option initializers.
Summary:
We currently have man large arrays containing initializers for our command options.
These tables are tricky maintain as we don't have any good place to check them for consistency and
it's also hard to read (`nullptr, {}, 0` is not very descriptive).
This patch fixes this by letting table gen generate those tables. This way we can have a more readable
syntax for this (especially for all the default arguments) and we can let TableCheck check them
for consistency (e.g. an option with an optional argument can't have `eArgTypeNone`, naming of flags', etc.).
Also refactoring the related data structures can now be done without changing the hundred of option initializers.
For example, this line:
```
{LLDB_OPT_SET_ALL, false, "hide-aliases", 'a', OptionParser::eNoArgument, nullptr, {}, 0, eArgTypeNone, "Hide aliases in the command list."},
```
becomes this:
```
def hide_aliases : Option<"hide-aliases", "a">, Desc<"Hide aliases in the command list.">;
```
For now I just moved a few initializers to the new format to demonstrate the change. I'll slowly migrate the other
option initializers tables in separate patches.
Reviewers: JDevlieghere, davide, sgraenitz
Reviewed By: JDevlieghere
Subscribers: jingham, xiaobai, labath, mgorny, abidh, lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D64365
llvm-svn: 365908
2019-07-12 23:30:55 +08:00
|
|
|
add_subdirectory(utils/TableGen)
|
2019-07-27 02:14:04 +08:00
|
|
|
|
2013-09-25 18:37:32 +08:00
|
|
|
add_subdirectory(source)
|
|
|
|
add_subdirectory(tools)
|
2019-04-30 00:29:10 +08:00
|
|
|
add_subdirectory(docs)
|
2017-10-07 06:21:36 +08:00
|
|
|
|
2019-01-12 02:11:04 +08:00
|
|
|
option(LLDB_INCLUDE_TESTS "Generate build targets for the LLDB unit tests." ${LLVM_INCLUDE_TESTS})
|
2017-10-07 06:21:36 +08:00
|
|
|
if(LLDB_INCLUDE_TESTS)
|
|
|
|
add_subdirectory(test)
|
|
|
|
add_subdirectory(unittests)
|
2020-01-17 14:30:03 +08:00
|
|
|
add_subdirectory(utils)
|
2017-10-07 06:21:36 +08:00
|
|
|
endif()
|
2015-02-18 06:20:29 +08:00
|
|
|
|
2019-12-14 02:37:33 +08:00
|
|
|
if (LLDB_ENABLE_PYTHON)
|
2020-01-09 23:57:59 +08:00
|
|
|
get_target_property(lldb_bindings_dir swig_wrapper BINARY_DIR)
|
[CMake] Revised LLDB.framework builds
Summary:
Add features to LLDB CMake builds that have so far only been available in Xcode. Clean up a few inconveniences and prepare further improvements.
Options:
* `LLDB_FRAMEWORK_BUILD_DIR` determines target directory (in build-tree)
* `LLDB_FRAMEWORK_INSTALL_DIR` **only** determines target directory in install-tree
* `LLVM_EXTERNALIZE_DEBUGINFO` allows externalized debug info (dSYM on Darwin, emitted to `bin`)
* `LLDB_FRAMEWORK_TOOLS` determines which executables will be copied to the framework's Resources (dropped symlinking, removed INCLUDE_IN_SUITE, removed dummy targets)
Other changes:
* clean up `add_lldb_executable()`
* include `LLDBFramework.cmake` from `source/API/CMakeLists.txt`
* use `*.plist.in` files, which are typical for CMake and independent from Xcode
* add clang headers to the framework bundle
Reviewers: xiaobai, JDevlieghere, aprantl, davide, beanz, stella.stamenova, clayborg, labath
Reviewed By: aprantl
Subscribers: friss, mgorny, lldb-commits, #lldb
Differential Revision: https://reviews.llvm.org/D55328
llvm-svn: 350391
2019-01-04 20:46:50 +08:00
|
|
|
|
2019-10-11 08:12:20 +08:00
|
|
|
if(LLDB_BUILD_FRAMEWORK)
|
2019-10-31 01:33:05 +08:00
|
|
|
set(lldb_python_build_path "${LLDB_FRAMEWORK_ABSOLUTE_BUILD_DIR}/LLDB.framework/Resources/Python/lldb")
|
2019-10-11 08:12:20 +08:00
|
|
|
else()
|
|
|
|
set(lldb_python_build_path "${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${LLDB_PYTHON_RELATIVE_PATH}/lldb")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# Add a Post-Build Event to copy over Python files and create the symlink
|
|
|
|
# to liblldb.so for the Python API(hardlink on Windows).
|
2019-10-16 13:22:53 +08:00
|
|
|
add_custom_target(finish_swig ALL VERBATIM
|
2019-10-17 02:00:21 +08:00
|
|
|
COMMAND ${CMAKE_COMMAND} -E make_directory ${lldb_python_build_path}
|
2020-01-09 23:57:59 +08:00
|
|
|
DEPENDS ${lldb_bindings_dir}/lldb.py
|
2019-10-11 08:12:20 +08:00
|
|
|
COMMENT "Python script sym-linking LLDB Python API")
|
|
|
|
|
2019-10-17 02:00:21 +08:00
|
|
|
if(NOT LLDB_USE_SYSTEM_SIX)
|
|
|
|
add_custom_command(TARGET finish_swig POST_BUILD VERBATIM
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy
|
|
|
|
"${LLDB_SOURCE_DIR}/third_party/Python/module/six/six.py"
|
|
|
|
"${lldb_python_build_path}/../six.py")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
add_custom_command(TARGET finish_swig POST_BUILD VERBATIM
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy
|
2020-01-09 23:57:59 +08:00
|
|
|
"${lldb_bindings_dir}/lldb.py"
|
2019-10-17 02:00:21 +08:00
|
|
|
"${lldb_python_build_path}/__init__.py")
|
|
|
|
|
2019-12-03 04:25:03 +08:00
|
|
|
function(create_python_package pkg_dir)
|
|
|
|
cmake_parse_arguments(ARG "NOINIT" "" "FILES" ${ARGN})
|
2019-10-16 13:22:53 +08:00
|
|
|
if(ARG_FILES)
|
|
|
|
set(copy_cmd COMMAND ${CMAKE_COMMAND} -E copy ${ARG_FILES} ${pkg_dir})
|
|
|
|
endif()
|
2019-12-03 04:25:03 +08:00
|
|
|
if(NOT ARG_NOINIT)
|
|
|
|
set(init_cmd COMMAND ${PYTHON_EXECUTABLE}
|
2020-01-09 23:57:59 +08:00
|
|
|
"${LLDB_SOURCE_DIR}/bindings/python/createPythonInit.py"
|
2019-12-03 04:25:03 +08:00
|
|
|
"${pkg_dir}" ${ARG_FILES})
|
|
|
|
endif()
|
|
|
|
add_custom_command(TARGET finish_swig POST_BUILD VERBATIM
|
2019-10-16 13:22:53 +08:00
|
|
|
COMMAND ${CMAKE_COMMAND} -E make_directory ${pkg_dir}
|
|
|
|
${copy_cmd}
|
2019-12-03 04:25:03 +08:00
|
|
|
${init_cmd}
|
2019-10-16 13:22:53 +08:00
|
|
|
WORKING_DIRECTORY ${lldb_python_build_path})
|
|
|
|
endfunction()
|
|
|
|
|
|
|
|
add_custom_command(TARGET finish_swig POST_BUILD VERBATIM
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy
|
|
|
|
"${LLDB_SOURCE_DIR}/source/Interpreter/embedded_interpreter.py" ${lldb_python_build_path})
|
|
|
|
|
2019-12-03 04:25:03 +08:00
|
|
|
# Distribute the examples as python packages.
|
|
|
|
create_python_package("formatters/cpp"
|
2019-10-16 13:22:53 +08:00
|
|
|
FILES "${LLDB_SOURCE_DIR}/examples/synthetic/gnu_libstdcpp.py"
|
|
|
|
"${LLDB_SOURCE_DIR}/examples/synthetic/libcxx.py")
|
2019-12-03 04:25:03 +08:00
|
|
|
|
|
|
|
create_python_package("formatters"
|
2019-10-16 13:22:53 +08:00
|
|
|
FILES "${LLDB_SOURCE_DIR}/examples/summaries/cocoa/cache.py"
|
|
|
|
"${LLDB_SOURCE_DIR}/examples/summaries/synth.py"
|
|
|
|
"${LLDB_SOURCE_DIR}/examples/summaries/cocoa/metrics.py"
|
|
|
|
"${LLDB_SOURCE_DIR}/examples/summaries/cocoa/attrib_fromdict.py"
|
|
|
|
"${LLDB_SOURCE_DIR}/examples/summaries/cocoa/Logger.py")
|
2019-12-03 04:25:03 +08:00
|
|
|
|
|
|
|
create_python_package("utils"
|
2019-12-03 04:27:43 +08:00
|
|
|
FILES "${LLDB_SOURCE_DIR}/examples/python/in_call_stack.py"
|
|
|
|
"${LLDB_SOURCE_DIR}/examples/python/symbolication.py")
|
2019-12-03 04:25:03 +08:00
|
|
|
|
2019-10-16 13:22:53 +08:00
|
|
|
if(APPLE)
|
2019-12-03 04:25:03 +08:00
|
|
|
create_python_package("macosx"
|
2019-10-16 13:22:53 +08:00
|
|
|
FILES "${LLDB_SOURCE_DIR}/examples/python/crashlog.py"
|
|
|
|
"${LLDB_SOURCE_DIR}/examples/darwin/heap_find/heap.py")
|
2019-12-03 04:25:03 +08:00
|
|
|
|
|
|
|
create_python_package("macosx/heap"
|
|
|
|
FILES "${LLDB_SOURCE_DIR}/examples/darwin/heap_find/heap/heap_find.cpp"
|
|
|
|
"${LLDB_SOURCE_DIR}/examples/darwin/heap_find/heap/Makefile"
|
|
|
|
NOINIT)
|
|
|
|
|
|
|
|
create_python_package("diagnose"
|
2019-10-16 13:22:53 +08:00
|
|
|
FILES "${LLDB_SOURCE_DIR}/examples/python/diagnose_unwind.py"
|
|
|
|
"${LLDB_SOURCE_DIR}/examples/python/diagnose_nsstring.py")
|
|
|
|
endif()
|
|
|
|
|
2019-10-16 05:58:45 +08:00
|
|
|
function(create_relative_symlink target dest_file output_dir output_name)
|
|
|
|
get_filename_component(dest_file ${dest_file} ABSOLUTE)
|
|
|
|
get_filename_component(output_dir ${output_dir} ABSOLUTE)
|
|
|
|
file(RELATIVE_PATH rel_dest_file ${output_dir} ${dest_file})
|
|
|
|
if(CMAKE_HOST_UNIX)
|
|
|
|
set(LLVM_LINK_OR_COPY create_symlink)
|
|
|
|
else()
|
|
|
|
set(LLVM_LINK_OR_COPY copy)
|
|
|
|
endif()
|
|
|
|
add_custom_command(TARGET ${target} POST_BUILD VERBATIM
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E ${LLVM_LINK_OR_COPY} ${rel_dest_file} ${output_name}
|
|
|
|
WORKING_DIRECTORY ${output_dir})
|
|
|
|
endfunction()
|
|
|
|
|
|
|
|
if(LLDB_BUILD_FRAMEWORK)
|
2019-10-31 01:33:05 +08:00
|
|
|
set(LIBLLDB_SYMLINK_DEST "${LLDB_FRAMEWORK_ABSOLUTE_BUILD_DIR}/LLDB.framework/LLDB")
|
2019-10-16 05:58:45 +08:00
|
|
|
else()
|
|
|
|
set(LIBLLDB_SYMLINK_DEST "${LLVM_SHLIB_OUTPUT_INTDIR}/liblldb${CMAKE_SHARED_LIBRARY_SUFFIX}")
|
|
|
|
endif()
|
|
|
|
if(WIN32)
|
|
|
|
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")
|
|
|
|
endif()
|
|
|
|
create_relative_symlink(finish_swig ${LIBLLDB_SYMLINK_DEST}
|
|
|
|
${lldb_python_build_path} ${LIBLLDB_SYMLINK_OUTPUT_FILE})
|
|
|
|
|
|
|
|
if(NOT LLDB_BUILD_FRAMEWORK)
|
|
|
|
set(LLDB_ARGDUMPER_FILENAME "lldb-argdumper${CMAKE_EXECUTABLE_SUFFIX}")
|
|
|
|
create_relative_symlink(finish_swig "${LLVM_RUNTIME_OUTPUT_INTDIR}/${LLDB_ARGDUMPER_FILENAME}"
|
|
|
|
${lldb_python_build_path} ${LLDB_ARGDUMPER_FILENAME})
|
|
|
|
endif()
|
|
|
|
|
2019-10-11 08:12:20 +08:00
|
|
|
add_dependencies(finish_swig swig_wrapper liblldb lldb-argdumper)
|
|
|
|
set_target_properties(finish_swig swig_wrapper PROPERTIES FOLDER "lldb misc")
|
|
|
|
|
|
|
|
# Ensure we do the python post-build step when building lldb.
|
|
|
|
add_dependencies(lldb finish_swig)
|
|
|
|
|
2019-11-05 09:04:54 +08:00
|
|
|
# Install the LLDB python module
|
|
|
|
if(LLDB_BUILD_FRAMEWORK)
|
|
|
|
set(LLDB_PYTHON_INSTALL_PATH ${LLDB_FRAMEWORK_INSTALL_DIR}/LLDB.framework/Resources/Python)
|
|
|
|
else()
|
|
|
|
set(LLDB_PYTHON_INSTALL_PATH ${LLDB_PYTHON_RELATIVE_PATH})
|
|
|
|
endif()
|
2020-03-28 08:48:58 +08:00
|
|
|
if (NOT CMAKE_CFG_INTDIR STREQUAL ".")
|
|
|
|
string(REPLACE ${CMAKE_CFG_INTDIR} "\$\{CMAKE_INSTALL_CONFIG_NAME\}" LLDB_PYTHON_INSTALL_PATH ${LLDB_PYTHON_INSTALL_PATH})
|
|
|
|
string(REPLACE ${CMAKE_CFG_INTDIR} "\$\{CMAKE_INSTALL_CONFIG_NAME\}" lldb_python_build_path ${lldb_python_build_path})
|
|
|
|
endif()
|
2019-11-05 09:04:54 +08:00
|
|
|
add_custom_target(lldb-python-scripts)
|
|
|
|
add_dependencies(lldb-python-scripts finish_swig)
|
|
|
|
install(DIRECTORY ${lldb_python_build_path}/../
|
|
|
|
DESTINATION ${LLDB_PYTHON_INSTALL_PATH}
|
|
|
|
COMPONENT lldb-python-scripts)
|
|
|
|
if (NOT LLVM_ENABLE_IDE)
|
|
|
|
add_llvm_install_targets(install-lldb-python-scripts
|
|
|
|
COMPONENT lldb-python-scripts
|
|
|
|
DEPENDS lldb-python-scripts)
|
2019-10-11 08:12:20 +08:00
|
|
|
endif()
|
2019-10-08 07:49:01 +08:00
|
|
|
|
2019-10-11 08:12:20 +08:00
|
|
|
# Add a Post-Build Event to copy the custom Python DLL to the lldb binaries dir so that Windows can find it when launching
|
|
|
|
# lldb.exe or any other executables that were linked with liblldb.
|
|
|
|
if (WIN32 AND NOT "${PYTHON_DLL}" STREQUAL "")
|
|
|
|
# When using the Visual Studio CMake generator the lldb binaries end up in Release/bin, Debug/bin etc.
|
|
|
|
file(TO_NATIVE_PATH "${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin" LLDB_BIN_DIR)
|
|
|
|
file(TO_NATIVE_PATH "${PYTHON_DLL}" PYTHON_DLL_NATIVE_PATH)
|
|
|
|
add_custom_command(
|
|
|
|
TARGET finish_swig
|
|
|
|
POST_BUILD
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy ${PYTHON_DLL_NATIVE_PATH} ${LLDB_BIN_DIR} VERBATIM
|
|
|
|
COMMENT "Copying Python DLL to LLDB binaries directory.")
|
|
|
|
endif ()
|
2015-02-18 06:20:29 +08:00
|
|
|
endif ()
|
2019-07-10 19:09:11 +08:00
|
|
|
|
2019-07-19 00:44:45 +08:00
|
|
|
if(LLDB_BUILT_STANDALONE AND NOT LLVM_ENABLE_IDE)
|
2019-07-10 19:09:11 +08:00
|
|
|
llvm_distribution_add_targets()
|
|
|
|
endif()
|