]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - CMakeLists.txt
Vendor import of lldb trunk r256945:
[FreeBSD/FreeBSD.git] / CMakeLists.txt
1 cmake_minimum_required(VERSION 2.8)
2
3 include(cmake/modules/LLDBStandalone.cmake)
4 include(cmake/modules/LLDBConfig.cmake)
5 include(cmake/modules/AddLLDB.cmake)
6
7 if (__ANDROID_NDK__ OR (CMAKE_SYSTEM_NAME MATCHES "Windows"))
8   set(LLDB_DEFAULT_DISABLE_LIBEDIT 1)
9 else()
10   set(LLDB_DEFAULT_DISABLE_LIBEDIT 0)
11 endif ()
12
13 # We need libedit support to go down both the source and
14 # the scripts directories.
15 set(LLDB_DISABLE_LIBEDIT ${LLDB_DEFAULT_DISABLE_LIBEDIT} CACHE BOOL "Disables the use of editline.")
16 if (LLDB_DISABLE_LIBEDIT)
17   add_definitions( -DLLDB_DISABLE_LIBEDIT )
18 endif()
19
20 # add_subdirectory(include)
21 add_subdirectory(docs)
22 if (NOT LLDB_DISABLE_PYTHON)
23   add_subdirectory(scripts)
24 endif ()
25 add_subdirectory(source)
26 add_subdirectory(test)
27 add_subdirectory(tools)
28 add_subdirectory(unittests)
29 add_subdirectory(lit)
30
31 if (NOT LLDB_DISABLE_PYTHON)
32     # Add a Post-Build Event to copy over Python files and create the symlink to liblldb.so for the Python API(hardlink on Windows)
33     add_custom_target( finish_swig ALL
34         COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/scripts/finishSwigWrapperClasses.py "--srcRoot=${LLDB_SOURCE_DIR}" "--targetDir=${CMAKE_CURRENT_BINARY_DIR}/scripts" "--cfgBldDir=${CMAKE_CURRENT_BINARY_DIR}/scripts" "--prefix=${CMAKE_BINARY_DIR}" "--cmakeBuildConfiguration=${CMAKE_CFG_INTDIR}" -m
35         DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/scripts/finishSwigWrapperClasses.py
36         DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/scripts/lldb.py
37         COMMENT "Python script sym-linking LLDB Python API")
38     # We depend on liblldb being built before we can do this step.
39     add_dependencies(finish_swig liblldb lldb-argdumper)
40
41     # If we build the readline module, we depend on that happening
42     # first.
43     if (TARGET readline)
44         add_dependencies(finish_swig readline)
45     endif()
46
47     # Ensure we do the python post-build step when building lldb.
48     add_dependencies(lldb finish_swig)
49
50     # Add a Post-Build Event to copy the custom Python DLL to the lldb binaries dir so that Windows can find it when launching
51     # lldb.exe or any other executables that were linked with liblldb.
52     if (WIN32 AND NOT "${PYTHON_DLL}" STREQUAL "")
53         # When using the Visual Studio CMake generator the lldb binaries end up in Release/bin, Debug/bin etc.
54         file(TO_NATIVE_PATH "${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin" LLDB_BIN_DIR)
55         file(TO_NATIVE_PATH "${PYTHON_DLL}" PYTHON_DLL_NATIVE_PATH)
56         add_custom_command(
57             TARGET finish_swig
58             POST_BUILD
59             COMMAND "${CMAKE_COMMAND}" -E copy ${PYTHON_DLL_NATIVE_PATH} ${LLDB_BIN_DIR}
60             COMMENT "Copying Python DLL to LLDB binaries directory.")
61     endif ()
62 endif ()