2013-11-11 12:46:09 +08:00
|
|
|
if ( CMAKE_SYSTEM_NAME MATCHES "Windows" )
|
2014-12-19 05:25:53 +08:00
|
|
|
set(LLDB_DEFAULT_DISABLE_PYTHON 0)
|
2014-02-01 02:48:46 +08:00
|
|
|
set(LLDB_DEFAULT_DISABLE_CURSES 1)
|
2013-11-11 12:46:09 +08:00
|
|
|
else()
|
2014-11-08 09:41:49 +08:00
|
|
|
if ( __ANDROID_NDK__ )
|
|
|
|
set(LLDB_DEFAULT_DISABLE_PYTHON 1)
|
|
|
|
set(LLDB_DEFAULT_DISABLE_CURSES 1)
|
|
|
|
else()
|
|
|
|
set(LLDB_DEFAULT_DISABLE_PYTHON 0)
|
|
|
|
set(LLDB_DEFAULT_DISABLE_CURSES 0)
|
|
|
|
endif()
|
2013-11-11 12:46:09 +08:00
|
|
|
endif()
|
|
|
|
set(LLDB_DISABLE_PYTHON ${LLDB_DEFAULT_DISABLE_PYTHON} CACHE BOOL
|
|
|
|
"Disables the Python scripting integration.")
|
2014-02-01 02:48:46 +08:00
|
|
|
set(LLDB_DISABLE_CURSES ${LLDB_DEFAULT_DISABLE_CURSES} CACHE BOOL
|
|
|
|
"Disables the Curses integration.")
|
2014-07-04 14:58:01 +08:00
|
|
|
|
2014-12-19 05:25:53 +08:00
|
|
|
if ( LLDB_DISABLE_PYTHON )
|
|
|
|
set(LLDB_DEFAULT_ENABLE_PYTHON_SCRIPTS_SWIG_API_GENERATION 0)
|
|
|
|
else ()
|
|
|
|
set(LLDB_DEFAULT_ENABLE_PYTHON_SCRIPTS_SWIG_API_GENERATION 1)
|
|
|
|
endif ()
|
|
|
|
|
2014-07-04 14:58:01 +08:00
|
|
|
set(LLDB_ENABLE_PYTHON_SCRIPTS_SWIG_API_GENERATION ${LLDB_DEFAULT_ENABLE_PYTHON_SCRIPTS_SWIG_API_GENERATION} CACHE BOOL
|
2014-07-02 01:57:19 +08:00
|
|
|
"Enables using new Python scripts for SWIG API generation .")
|
2013-11-11 12:46:09 +08:00
|
|
|
|
2015-02-25 07:36:12 +08:00
|
|
|
set(LLDB_SOURCE_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/source")
|
|
|
|
set(LLDB_INCLUDE_ROOT "${LLDB_INCLUDE_ROOT}/include")
|
|
|
|
|
2013-09-25 18:37:32 +08:00
|
|
|
# If we are not building as a part of LLVM, build LLDB as an
|
|
|
|
# standalone project, using LLVM as an external library:
|
|
|
|
if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
|
|
|
|
project(lldb)
|
|
|
|
cmake_minimum_required(VERSION 2.8)
|
|
|
|
|
|
|
|
set(LLDB_PATH_TO_LLVM_SOURCE "" CACHE PATH
|
|
|
|
"Path to LLVM source code. Not necessary if using an installed LLVM.")
|
|
|
|
set(LLDB_PATH_TO_LLVM_BUILD "" CACHE PATH
|
|
|
|
"Path to the directory where LLVM was built or installed.")
|
2014-03-11 11:08:47 +08:00
|
|
|
|
2013-09-25 18:37:32 +08:00
|
|
|
set(LLDB_PATH_TO_CLANG_SOURCE "" CACHE PATH
|
|
|
|
"Path to Clang source code. Not necessary if using an installed Clang.")
|
|
|
|
set(LLDB_PATH_TO_CLANG_BUILD "" CACHE PATH
|
2014-03-11 11:08:47 +08:00
|
|
|
"Path to the directory where Clang was built or installed.")
|
2013-09-25 18:37:32 +08:00
|
|
|
|
|
|
|
if (LLDB_PATH_TO_LLVM_SOURCE)
|
|
|
|
if (NOT EXISTS "${LLDB_PATH_TO_LLVM_SOURCE}/cmake/config-ix.cmake")
|
|
|
|
message(FATAL_ERROR "Please set LLDB_PATH_TO_LLVM_SOURCE to the root "
|
|
|
|
"directory of LLVM source code.")
|
|
|
|
else()
|
|
|
|
get_filename_component(LLVM_MAIN_SRC_DIR ${LLDB_PATH_TO_LLVM_SOURCE}
|
|
|
|
ABSOLUTE)
|
|
|
|
list(APPEND CMAKE_MODULE_PATH "${LLVM_MAIN_SRC_DIR}/cmake/modules")
|
|
|
|
endif()
|
|
|
|
endif()
|
2014-03-11 11:08:47 +08:00
|
|
|
|
2013-09-25 18:37:32 +08:00
|
|
|
if (LLDB_PATH_TO_CLANG_SOURCE)
|
|
|
|
get_filename_component(CLANG_MAIN_SRC_DIR ${LLDB_PATH_TO_CLANG_SOURCE}
|
|
|
|
ABSOLUTE)
|
2014-03-11 11:08:47 +08:00
|
|
|
endif()
|
2013-09-25 18:37:32 +08:00
|
|
|
|
|
|
|
list(APPEND CMAKE_MODULE_PATH "${LLDB_PATH_TO_LLVM_BUILD}/share/llvm/cmake")
|
|
|
|
|
|
|
|
get_filename_component(PATH_TO_LLVM_BUILD ${LLDB_PATH_TO_LLVM_BUILD}
|
|
|
|
ABSOLUTE)
|
2014-03-11 11:08:47 +08:00
|
|
|
|
2013-09-25 18:37:32 +08:00
|
|
|
get_filename_component(PATH_TO_CLANG_BUILD ${LLDB_PATH_TO_CLANG_BUILD}
|
2014-03-11 11:08:47 +08:00
|
|
|
ABSOLUTE)
|
|
|
|
|
2014-11-06 07:23:18 +08:00
|
|
|
# These variables are used by add_llvm_library.
|
|
|
|
set(LLVM_RUNTIME_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin)
|
[cmake/multilib] Teach LLDB to respect the multlib LLVM_LIBDIR_SUFFIX
variable (now provided both by the normal parent LLVM CMake files and by
the LLVMConfig.cmake file used by the standalone build).
This allows LLDB to build into and install into correctly suffixed
libdirs. This is especially significant for LLDB because the python
extension building done by CMake directly uses multilib suffixes when
the host OS does, and the host OS will not always look back and forth
between them. As a consequence, before LLVM, Clang, and LLDB (and every
other subproject) had support for using LLVM_LIBDIR_SUFFIX, you couldn't
build or install LLDB on a multilib system with its python extensions
enabled. With this patch (on top of all the others I have submitted
throughout the project), I'm finally able to build and install LLDB on
my system with Python support enabled. I'm also able to actually run the
LLDB test suite, etc. Now, a *huge* number of the tests still fail on my
Linux system, but hey, actually running them and them testing the
debugger is a huge step forward. =D
llvm-svn: 224930
2014-12-29 20:42:33 +08:00
|
|
|
set(LLVM_LIBRARY_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib${LLVM_LIBDIR_SUFFIX})
|
2014-11-06 07:23:18 +08:00
|
|
|
|
2013-09-25 18:37:32 +08:00
|
|
|
include(AddLLVM)
|
|
|
|
include(HandleLLVMOptions)
|
|
|
|
|
2014-12-29 20:32:27 +08:00
|
|
|
# Verify that we can find a Python 2 interpreter. Python 3 is unsupported.
|
2015-02-24 05:20:59 +08:00
|
|
|
if (PYTHON_EXECUTABLE STREQUAL "")
|
|
|
|
set(Python_ADDITIONAL_VERSIONS 2.7 2.6 2.5)
|
|
|
|
include(FindPythonInterp)
|
|
|
|
if( NOT PYTHONINTERP_FOUND )
|
|
|
|
message(FATAL_ERROR
|
|
|
|
"Unable to find Python interpreter, required for builds and testing.
|
|
|
|
Please install Python or specify the PYTHON_EXECUTABLE CMake variable.")
|
|
|
|
endif()
|
|
|
|
else()
|
|
|
|
message("-- Found PythonInterp: ${PYTHON_EXECUTABLE}")
|
2014-12-29 20:32:27 +08:00
|
|
|
endif()
|
2014-11-06 07:23:18 +08:00
|
|
|
# Import CMake library targets from LLVM and Clang.
|
|
|
|
include("${LLDB_PATH_TO_LLVM_BUILD}/share/llvm/cmake/LLVMConfig.cmake")
|
|
|
|
include("${LLDB_PATH_TO_CLANG_BUILD}/share/clang/cmake/ClangConfig.cmake")
|
|
|
|
|
2013-09-25 18:37:32 +08:00
|
|
|
set(PACKAGE_VERSION "${LLVM_PACKAGE_VERSION}")
|
|
|
|
|
|
|
|
set(LLVM_MAIN_INCLUDE_DIR "${LLVM_MAIN_SRC_DIR}/include")
|
|
|
|
set(LLVM_BINARY_DIR ${CMAKE_BINARY_DIR})
|
2014-03-11 11:08:47 +08:00
|
|
|
|
2013-09-25 18:37:32 +08:00
|
|
|
set(CLANG_MAIN_INCLUDE_DIR "${CLANG_MAIN_SRC_DIR}/include")
|
|
|
|
|
|
|
|
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
|
|
|
include_directories("${PATH_TO_LLVM_BUILD}/include"
|
|
|
|
"${LLVM_MAIN_INCLUDE_DIR}"
|
|
|
|
"${PATH_TO_CLANG_BUILD}/include"
|
|
|
|
"${CLANG_MAIN_INCLUDE_DIR}"
|
|
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/source")
|
[cmake/multilib] Teach LLDB to respect the multlib LLVM_LIBDIR_SUFFIX
variable (now provided both by the normal parent LLVM CMake files and by
the LLVMConfig.cmake file used by the standalone build).
This allows LLDB to build into and install into correctly suffixed
libdirs. This is especially significant for LLDB because the python
extension building done by CMake directly uses multilib suffixes when
the host OS does, and the host OS will not always look back and forth
between them. As a consequence, before LLVM, Clang, and LLDB (and every
other subproject) had support for using LLVM_LIBDIR_SUFFIX, you couldn't
build or install LLDB on a multilib system with its python extensions
enabled. With this patch (on top of all the others I have submitted
throughout the project), I'm finally able to build and install LLDB on
my system with Python support enabled. I'm also able to actually run the
LLDB test suite, etc. Now, a *huge* number of the tests still fail on my
Linux system, but hey, actually running them and them testing the
debugger is a huge step forward. =D
llvm-svn: 224930
2014-12-29 20:42:33 +08:00
|
|
|
link_directories("${PATH_TO_LLVM_BUILD}/lib${LLVM_LIBDIR_SUFFIX}"
|
|
|
|
"${PATH_TO_CLANG_BUILD}/lib${LLVM_LIBDIR_SUFFIX}")
|
2013-09-25 18:37:32 +08:00
|
|
|
|
|
|
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
|
[cmake/multilib] Teach LLDB to respect the multlib LLVM_LIBDIR_SUFFIX
variable (now provided both by the normal parent LLVM CMake files and by
the LLVMConfig.cmake file used by the standalone build).
This allows LLDB to build into and install into correctly suffixed
libdirs. This is especially significant for LLDB because the python
extension building done by CMake directly uses multilib suffixes when
the host OS does, and the host OS will not always look back and forth
between them. As a consequence, before LLVM, Clang, and LLDB (and every
other subproject) had support for using LLVM_LIBDIR_SUFFIX, you couldn't
build or install LLDB on a multilib system with its python extensions
enabled. With this patch (on top of all the others I have submitted
throughout the project), I'm finally able to build and install LLDB on
my system with Python support enabled. I'm also able to actually run the
LLDB test suite, etc. Now, a *huge* number of the tests still fail on my
Linux system, but hey, actually running them and them testing the
debugger is a huge step forward. =D
llvm-svn: 224930
2014-12-29 20:42:33 +08:00
|
|
|
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX})
|
|
|
|
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX})
|
2013-09-25 18:37:32 +08:00
|
|
|
|
|
|
|
set(LLDB_BUILT_STANDALONE 1)
|
|
|
|
endif()
|
|
|
|
|
2014-07-02 01:57:19 +08:00
|
|
|
set(LLDB_DISABLE_PYTHON 0 CACHE BOOL "Disables the Python scripting integration.")
|
2013-09-25 18:37:32 +08:00
|
|
|
|
2014-07-04 14:58:01 +08:00
|
|
|
if ((NOT MSVC) OR MSVC12)
|
|
|
|
add_definitions( -DHAVE_ROUND )
|
|
|
|
endif()
|
|
|
|
|
2014-02-01 02:48:46 +08:00
|
|
|
if (LLDB_DISABLE_CURSES)
|
|
|
|
add_definitions( -DLLDB_DISABLE_CURSES )
|
|
|
|
endif()
|
|
|
|
|
2013-09-25 18:37:32 +08:00
|
|
|
macro(add_lldb_definitions)
|
|
|
|
# We don't want no semicolons on LLDB_DEFINITIONS:
|
|
|
|
foreach(arg ${ARGN})
|
|
|
|
set(LLDB_DEFINITIONS "${LLVM_DEFINITIONS} ${arg}")
|
|
|
|
endforeach(arg)
|
|
|
|
add_definitions( ${ARGN} )
|
|
|
|
endmacro(add_lldb_definitions)
|
|
|
|
|
2013-11-15 18:32:40 +08:00
|
|
|
if (NOT LLDB_DISABLE_PYTHON)
|
2014-11-08 09:41:49 +08:00
|
|
|
if(UNIX)
|
|
|
|
# This is necessary for crosscompile on Ubuntu 14.04 64bit. Need a proper fix.
|
|
|
|
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
|
|
|
set(CMAKE_LIBRARY_ARCHITECTURE "x86_64-linux-gnu")
|
|
|
|
endif()
|
|
|
|
endif()
|
2015-02-24 05:20:59 +08:00
|
|
|
if (MSVC)
|
2015-02-25 06:17:57 +08:00
|
|
|
if ("${PYTHON_INCLUDE_DIR}" STREQUAL "" OR "${PYTHON_LIBRARY}" STREQUAL "")
|
|
|
|
message("-- LLDB Embedded python disabled. Embedding python on Windows requires "
|
|
|
|
"manually specifying PYTHON_INCLUDE_DIR *and* PYTHON_LIBRARY")
|
|
|
|
set(LLDB_DISABLE_PYTHON 1)
|
2015-02-24 05:20:59 +08:00
|
|
|
else()
|
|
|
|
message("-- Found PythonLibs: ${PYTHON_LIBRARY}")
|
|
|
|
include_directories(${PYTHON_INCLUDE_DIR})
|
|
|
|
endif()
|
|
|
|
else()
|
|
|
|
find_package(PythonLibs REQUIRED)
|
|
|
|
include_directories(${PYTHON_INCLUDE_DIRS})
|
|
|
|
endif()
|
2013-11-15 18:32:40 +08:00
|
|
|
endif()
|
2014-07-02 01:57:19 +08:00
|
|
|
|
2015-02-25 06:17:57 +08:00
|
|
|
if (LLDB_DISABLE_PYTHON)
|
|
|
|
unset(PYTHON_INCLUDE_DIR)
|
|
|
|
unset(PYTHON_LIBRARY)
|
|
|
|
add_definitions( -DLLDB_DISABLE_PYTHON )
|
|
|
|
endif()
|
|
|
|
|
2013-09-25 18:37:32 +08:00
|
|
|
include_directories(../clang/include)
|
|
|
|
include_directories("${CMAKE_CURRENT_BINARY_DIR}/../clang/include")
|
|
|
|
|
|
|
|
# lldb requires c++11 to build. Make sure that we have a compiler and standard
|
|
|
|
# library combination that can do that.
|
2013-11-12 23:42:53 +08:00
|
|
|
if (NOT MSVC)
|
2013-09-25 18:37:32 +08:00
|
|
|
# gcc and clang require the -std=c++0x or -std=c++11 flag.
|
|
|
|
if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU" OR
|
|
|
|
"${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
|
|
|
|
if (NOT ("${CMAKE_CXX_FLAGS}" MATCHES "-std=c\\+\\+0x" OR
|
|
|
|
"${CMAKE_CXX_FLAGS}" MATCHES "-std=gnu\\+\\+0x" OR
|
|
|
|
"${CMAKE_CXX_FLAGS}" MATCHES "-std=c\\+\\+11" OR
|
|
|
|
"${CMAKE_CXX_FLAGS}" MATCHES "-std=gnu\\+\\+11"))
|
|
|
|
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
|
|
|
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.7")
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
|
|
|
|
else()
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
|
|
|
endif()
|
|
|
|
else()
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
endif()
|
2013-11-12 23:42:53 +08:00
|
|
|
elseif (MSVC_VERSION LESS 1700)
|
2013-09-25 18:37:32 +08:00
|
|
|
message(FATAL_ERROR "The selected compiler does not support c++11 which is "
|
|
|
|
"required to build lldb.")
|
|
|
|
endif()
|
|
|
|
|
2014-03-11 11:08:53 +08:00
|
|
|
# Disable GCC warnings
|
|
|
|
check_cxx_compiler_flag("-Wno-deprecated-declarations"
|
|
|
|
CXX_SUPPORTS_NO_DEPRECATED_DECLARATIONS)
|
2014-03-20 14:08:41 +08:00
|
|
|
if (CXX_SUPPORTS_NO_DEPRECATED_DECLARATIONS)
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-declarations")
|
|
|
|
endif ()
|
2013-09-25 18:37:32 +08:00
|
|
|
|
2014-04-02 11:51:16 +08:00
|
|
|
check_cxx_compiler_flag("-Wno-unknown-pragmas"
|
|
|
|
CXX_SUPPORTS_NO_UNKNOWN_PRAGMAS)
|
|
|
|
if (CXX_SUPPORTS_NO_UNKNOWN_PRAGMAS)
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unknown-pragmas")
|
|
|
|
endif ()
|
|
|
|
|
2014-03-11 11:08:53 +08:00
|
|
|
# Disable Clang warnings
|
|
|
|
check_cxx_compiler_flag("-Wno-deprecated-register"
|
|
|
|
CXX_SUPPORTS_NO_DEPRECATED_REGISTER)
|
2014-03-20 14:08:41 +08:00
|
|
|
if (CXX_SUPPORTS_NO_DEPRECATED_REGISTER)
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-register")
|
|
|
|
endif ()
|
2013-09-25 18:37:32 +08:00
|
|
|
|
|
|
|
# Disable MSVC warnings
|
|
|
|
if( MSVC )
|
|
|
|
add_lldb_definitions(
|
|
|
|
-wd4018 # Suppress 'warning C4018: '>=' : signed/unsigned mismatch'
|
|
|
|
-wd4068 # Suppress 'warning C4068: unknown pragma'
|
|
|
|
-wd4150 # Suppress 'warning C4150: deletion of pointer to incomplete type'
|
2014-05-29 01:58:29 +08:00
|
|
|
-wd4251 # Suppress 'warning C4251: T must have dll-interface to be used by clients of class U.'
|
2013-09-25 18:37:32 +08:00
|
|
|
-wd4521 # Suppress 'warning C4521: 'type' : multiple copy constructors specified'
|
2014-05-29 01:06:04 +08:00
|
|
|
-wd4530 # Suppress 'warning C4530: C++ exception handler used, but unwind semantics are not enabled.'
|
2013-09-25 18:37:32 +08:00
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# If building on a 32-bit system, make sure off_t can store offsets > 2GB
|
|
|
|
if( CMAKE_SIZEOF_VOID_P EQUAL 4 )
|
|
|
|
add_lldb_definitions(
|
|
|
|
-D_LARGEFILE_SOURCE
|
|
|
|
-D_FILE_OFFSET_BITS=64
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
set(LLDB_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
|
|
|
|
set(LLDB_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
|
|
|
|
|
|
|
|
if (CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR)
|
|
|
|
message(FATAL_ERROR "In-source builds are not allowed. CMake would overwrite "
|
|
|
|
"the makefiles distributed with LLDB. Please create a directory and run cmake "
|
|
|
|
"from there, passing the path to this source directory as the last argument. "
|
|
|
|
"This process created the file `CMakeCache.txt' and the directory "
|
|
|
|
"`CMakeFiles'. Please delete them.")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# Compute the LLDB version from the LLVM version.
|
|
|
|
string(REGEX MATCH "[0-9]+\\.[0-9]+(\\.[0-9]+)?" LLDB_VERSION
|
|
|
|
${PACKAGE_VERSION})
|
|
|
|
message(STATUS "LLDB version: ${LLDB_VERSION}")
|
|
|
|
|
2014-07-20 13:28:55 +08:00
|
|
|
if (CMAKE_VERSION VERSION_LESS 2.8.12)
|
|
|
|
set(cmake_2_8_12_INTERFACE)
|
|
|
|
set(cmake_2_8_12_PRIVATE)
|
|
|
|
set(cmake_2_8_12_PUBLIC)
|
|
|
|
else ()
|
|
|
|
set(cmake_2_8_12_INTERFACE INTERFACE)
|
|
|
|
set(cmake_2_8_12_PRIVATE PRIVATE)
|
|
|
|
set(cmake_2_8_12_PUBLIC PUBLIC)
|
|
|
|
endif ()
|
|
|
|
|
2013-09-25 18:37:32 +08:00
|
|
|
macro(add_lldb_library name)
|
2015-01-15 05:01:15 +08:00
|
|
|
# only supported parameters to this macro are the optional
|
|
|
|
# MODULE;SHARED;STATIC library type and source files
|
|
|
|
cmake_parse_arguments(PARAM
|
2015-02-25 06:17:57 +08:00
|
|
|
"MODULE;SHARED;STATIC;OBJECT"
|
2015-01-15 05:01:15 +08:00
|
|
|
""
|
|
|
|
""
|
|
|
|
${ARGN})
|
|
|
|
llvm_process_sources(srcs ${PARAM_UNPARSED_ARGUMENTS})
|
2015-02-25 06:17:57 +08:00
|
|
|
|
2013-09-25 18:37:32 +08:00
|
|
|
if (MSVC_IDE OR XCODE)
|
|
|
|
string(REGEX MATCHALL "/[^/]+" split_path ${CMAKE_CURRENT_SOURCE_DIR})
|
|
|
|
list(GET split_path -1 dir)
|
|
|
|
file(GLOB_RECURSE headers
|
|
|
|
../../include/lldb${dir}/*.h)
|
|
|
|
set(srcs ${srcs} ${headers})
|
|
|
|
endif()
|
2015-01-15 05:01:15 +08:00
|
|
|
if (PARAM_MODULE)
|
2013-09-25 18:37:32 +08:00
|
|
|
set(libkind MODULE)
|
2015-01-15 05:01:15 +08:00
|
|
|
elseif (PARAM_SHARED)
|
2013-09-25 18:37:32 +08:00
|
|
|
set(libkind SHARED)
|
2015-01-15 05:01:15 +08:00
|
|
|
elseif (PARAM_STATIC)
|
2013-09-25 18:37:32 +08:00
|
|
|
set(libkind STATIC)
|
2015-02-25 06:17:57 +08:00
|
|
|
elseif (PARAM_OBJECT)
|
|
|
|
set(libkind OBJECT)
|
2015-01-15 05:01:15 +08:00
|
|
|
else ()
|
|
|
|
# library type unspecified - controlled by BUILD_SHARED_LIBS
|
|
|
|
unset(libkind)
|
2013-09-25 18:37:32 +08:00
|
|
|
endif()
|
2015-01-15 05:01:15 +08:00
|
|
|
|
2014-02-01 02:48:46 +08:00
|
|
|
#PIC not needed on Win
|
|
|
|
if (NOT MSVC)
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
|
|
|
|
endif()
|
2013-09-25 18:37:32 +08:00
|
|
|
|
2015-02-25 06:17:57 +08:00
|
|
|
if (PARAM_OBJECT)
|
|
|
|
add_library(${name} ${libkind} ${srcs})
|
|
|
|
else()
|
|
|
|
llvm_add_library(${name} ${libkind} ${srcs})
|
|
|
|
|
|
|
|
if (PARAM_STATIC)
|
|
|
|
set(lldb_library_keyword ${cmake_2_8_12_INTERFACE})
|
|
|
|
else ()
|
|
|
|
set(lldb_library_keyword ${cmake_2_8_12_PUBLIC})
|
|
|
|
endif ()
|
|
|
|
|
|
|
|
if(LLDB_USED_LIBS)
|
|
|
|
# The Darwin linker doesn't understand --start-group/--end-group.
|
|
|
|
if (LLVM_COMPILER_IS_GCC_COMPATIBLE AND NOT "${CMAKE_SYSTEM_NAME}" MATCHES "Darwin")
|
|
|
|
target_link_libraries(${name} ${lldb_library_keyword}
|
|
|
|
-Wl,--start-group ${LLDB_USED_LIBS} -Wl,--end-group)
|
|
|
|
else()
|
|
|
|
target_link_libraries(${name} ${lldb_library_keyword} ${LLDB_USED_LIBS})
|
|
|
|
endif()
|
2013-09-25 18:37:32 +08:00
|
|
|
endif()
|
2015-02-25 06:17:57 +08:00
|
|
|
|
|
|
|
target_link_libraries(${name} ${lldb_library_keyword} ${CLANG_USED_LIBS})
|
|
|
|
target_link_libraries(${name} ${lldb_library_keyword} ${LLVM_USED_LIBS})
|
|
|
|
llvm_config(${name} ${LLVM_LINK_COMPONENTS})
|
|
|
|
target_link_libraries(${name} ${lldb_library_keyword} ${LLVM_COMMON_LIBS})
|
|
|
|
|
|
|
|
install(TARGETS ${name}
|
|
|
|
LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
|
|
|
|
ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX})
|
2013-09-25 18:37:32 +08:00
|
|
|
endif()
|
|
|
|
|
|
|
|
# Hack: only some LLDB libraries depend on the clang autogenerated headers,
|
|
|
|
# but it is simple enough to make all of LLDB depend on some of those
|
|
|
|
# headers without negatively impacting much of anything.
|
2015-02-25 06:17:57 +08:00
|
|
|
add_dependencies(${name} libclang)
|
2013-09-25 18:37:32 +08:00
|
|
|
|
|
|
|
set_target_properties(${name} PROPERTIES FOLDER "lldb libraries")
|
|
|
|
endmacro(add_lldb_library)
|
|
|
|
|
|
|
|
macro(add_lldb_executable name)
|
2014-07-02 01:57:19 +08:00
|
|
|
add_llvm_executable(${name} ${ARGN})
|
2013-09-25 18:37:32 +08:00
|
|
|
set_target_properties(${name} PROPERTIES FOLDER "lldb executables")
|
|
|
|
endmacro(add_lldb_executable)
|
|
|
|
|
|
|
|
include_directories(BEFORE
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/include
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/include
|
|
|
|
)
|
|
|
|
|
|
|
|
install(DIRECTORY include/
|
|
|
|
DESTINATION include
|
|
|
|
FILES_MATCHING
|
|
|
|
PATTERN "*.h"
|
|
|
|
PATTERN ".svn" EXCLUDE
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
# Find libraries or frameworks that may be needed
|
|
|
|
if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
|
|
|
|
find_library(CARBON_LIBRARY Carbon)
|
|
|
|
find_library(FOUNDATION_LIBRARY Foundation)
|
|
|
|
find_library(CORE_FOUNDATION_LIBRARY CoreFoundation)
|
|
|
|
find_library(CORE_SERVICES_LIBRARY CoreServices)
|
|
|
|
find_library(SECURITY_LIBRARY Security)
|
|
|
|
find_library(DEBUG_SYMBOLS_LIBRARY DebugSymbols PATHS "/System/Library/PrivateFrameworks")
|
|
|
|
|
2014-03-15 02:23:07 +08:00
|
|
|
if (NOT LIBXML2_FOUND)
|
|
|
|
find_package(LibXml2)
|
|
|
|
endif ()
|
2014-01-28 07:43:24 +08:00
|
|
|
list(APPEND system_libs xml2 ncurses panel)
|
2013-09-25 18:37:32 +08:00
|
|
|
list(APPEND system_libs ${CARBON_LIBRARY} ${FOUNDATION_LIBRARY}
|
|
|
|
${CORE_FOUNDATION_LIBRARY} ${CORE_SERVICES_LIBRARY} ${SECURITY_LIBRARY}
|
|
|
|
${DEBUG_SYMBOLS_LIBRARY})
|
|
|
|
endif()
|
|
|
|
|
2014-05-29 01:06:04 +08:00
|
|
|
if(LLDB_REQUIRES_EH)
|
|
|
|
set(LLDB_REQUIRES_RTTI ON)
|
|
|
|
else()
|
|
|
|
if(LLVM_COMPILER_IS_GCC_COMPATIBLE)
|
|
|
|
set(LLDB_COMPILE_FLAGS "${LLDB_COMPILE_FLAGS} -fno-exceptions")
|
|
|
|
elseif(MSVC)
|
|
|
|
add_definitions( -D_HAS_EXCEPTIONS=0 )
|
|
|
|
set(LLDB_COMPILE_FLAGS "${LLDB_COMPILE_FLAGS} /EHs-c-")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2014-02-01 02:48:46 +08:00
|
|
|
# Disable RTTI by default
|
|
|
|
if(NOT LLDB_REQUIRES_RTTI)
|
2014-05-29 01:06:04 +08:00
|
|
|
if (LLVM_COMPILER_IS_GCC_COMPATIBLE)
|
|
|
|
set(LLDB_COMPILE_FLAGS "${LLDB_COMPILE_FLAGS} -fno-rtti")
|
|
|
|
elseif(MSVC)
|
|
|
|
set(LLDB_COMPILE_FLAGS "${LLDB_COMPILE_FLAGS} /GR-")
|
|
|
|
endif()
|
2014-02-01 02:48:46 +08:00
|
|
|
endif()
|
|
|
|
|
2014-05-29 01:06:04 +08:00
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${LLDB_COMPILE_FLAGS}")
|
|
|
|
|
2013-09-25 18:37:32 +08:00
|
|
|
#add_subdirectory(include)
|
|
|
|
add_subdirectory(docs)
|
2014-07-04 14:43:47 +08:00
|
|
|
if (NOT CMAKE_SYSTEM_NAME MATCHES "Windows" OR NOT LLDB_DISABLE_PYTHON)
|
|
|
|
add_subdirectory(scripts)
|
|
|
|
endif ()
|
2013-09-25 18:37:32 +08:00
|
|
|
add_subdirectory(source)
|
|
|
|
add_subdirectory(test)
|
|
|
|
add_subdirectory(tools)
|
2015-02-18 06:20:29 +08:00
|
|
|
|
|
|
|
|
|
|
|
if ( LLDB_ENABLE_PYTHON_SCRIPTS_SWIG_API_GENERATION AND NOT LLDB_DISABLE_PYTHON )
|
|
|
|
# Add a Post-Build Event to copy over Python files and create the symlink to liblldb.so for the Python API(hardlink on Windows)
|
|
|
|
add_custom_target( finish_swig ALL
|
|
|
|
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/scripts/finishSwigWrapperClasses.py --buildConfig=${CMAKE_BUILD_TYPE} "--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
|
|
|
|
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/scripts/finishSwigWrapperClasses.py
|
|
|
|
COMMENT "Python script sym-linking LLDB Python API")
|
|
|
|
add_dependencies(finish_swig liblldb argdumper)
|
|
|
|
endif ()
|