summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2018-07-28 11:09:23 +0000
committerDimitry Andric <dim@FreeBSD.org>2018-07-28 11:09:23 +0000
commitf73363f1dd94996356cefbf24388f561891acf0b (patch)
treee3c31248bdb36eaec5fd833490d4278162dba2a0 /CMakeLists.txt
parent160ee69dd7ae18978f4068116777639ea98dc951 (diff)
downloadsrc-test2-f73363f1dd94996356cefbf24388f561891acf0b.tar.gz
src-test2-f73363f1dd94996356cefbf24388f561891acf0b.zip
Notes
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt109
1 files changed, 97 insertions, 12 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c6b082e104e5..00ddcdc1488f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -29,13 +29,39 @@ endif ()
set(LLDB_DISABLE_LIBEDIT ${LLDB_DEFAULT_DISABLE_LIBEDIT} CACHE BOOL "Disables the use of editline.")
if (LLDB_DISABLE_LIBEDIT)
add_definitions( -DLLDB_DISABLE_LIBEDIT )
+else()
+ find_package(LibEdit REQUIRED)
endif()
if(APPLE)
add_definitions(-DLLDB_USE_OS_LOG)
endif()
-# add_subdirectory(include)
+# lldb-suite is a dummy target that encompasses all the necessary tools and
+# libraries for building a fully-functioning liblldb.
+add_custom_target(lldb-suite)
+set(LLDB_SUITE_TARGET lldb-suite)
+
+option(LLDB_BUILD_FRAMEWORK "Build the Darwin LLDB.framework" Off)
+if(LLDB_BUILD_FRAMEWORK)
+ if (CMAKE_VERSION VERSION_LESS 3.7)
+ message(FATAL_ERROR "LLDB_BUILD_FRAMEWORK is not supported on CMake < 3.7")
+ endif()
+ if (NOT APPLE)
+ message(FATAL_ERROR "LLDB.framework can only be generated when targeting Apple platforms")
+ endif()
+
+ # These are used to fill out LLDB-Info.plist. These are relevant when building
+ # the framework, and must be defined before building liblldb.
+ set(PRODUCT_NAME "LLDB")
+ set(EXECUTABLE_NAME "LLDB")
+ set(CURRENT_PROJECT_VERSION "360.99.0")
+ set(LLDB_SUITE_TARGET lldb-framework)
+
+ set(LLDB_FRAMEWORK_DIR
+ ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${LLDB_FRAMEWORK_INSTALL_DIR})
+endif()
+
add_subdirectory(docs)
if (NOT LLDB_DISABLE_PYTHON)
if(LLDB_USE_SYSTEM_SIX)
@@ -45,8 +71,7 @@ if (NOT LLDB_DISABLE_PYTHON)
set(LLDB_PYTHON_TARGET_DIR ${LLDB_BINARY_DIR}/scripts)
set(LLDB_WRAP_PYTHON ${LLDB_BINARY_DIR}/scripts/LLDBWrapPython.cpp)
if(LLDB_BUILD_FRAMEWORK)
- set(LLDB_PYTHON_TARGET_DIR
- ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${LLDB_FRAMEWORK_INSTALL_DIR})
+ set(LLDB_PYTHON_TARGET_DIR ${LLDB_FRAMEWORK_DIR})
set(LLDB_WRAP_PYTHON ${LLDB_PYTHON_TARGET_DIR}/LLDBWrapPython.cpp)
else()
# Don't set -m when building the framework.
@@ -56,31 +81,90 @@ if (NOT LLDB_DISABLE_PYTHON)
add_subdirectory(scripts)
endif ()
+
add_subdirectory(source)
add_subdirectory(tools)
option(LLDB_INCLUDE_TESTS "Generate build targets for the LLDB unit tests."
${LLVM_INCLUDE_TESTS})
+option(LLDB_TEST_USE_CUSTOM_C_COMPILER "Use the C compiler provided via LLDB_TEST_C_COMPILER for building test inferiors (instead of the just-built compiler). Defaults to OFF." OFF)
+option(LLDB_TEST_USE_CUSTOM_CXX_COMPILER "Use the C++ compiler provided via LLDB_TEST_CXX_COMPILER for building test inferiors (instead of the just-built compiler). Defaults to OFF." OFF)
if(LLDB_INCLUDE_TESTS)
- if (TARGET clang)
- set(LLDB_DEFAULT_TEST_C_COMPILER "${LLVM_BINARY_DIR}/bin/clang${CMAKE_EXECUTABLE_SUFFIX}")
- set(LLDB_DEFAULT_TEST_CXX_COMPILER "${LLVM_BINARY_DIR}/bin/clang++${CMAKE_EXECUTABLE_SUFFIX}")
+
+ # The difference between the following two paths is significant. The path to
+ # LLDB will point to LLDB's binary directory, while the other will point to
+ # LLVM's binary directory in case the two differ.
+ set(LLDB_DEFAULT_TEST_EXECUTABLE "${LLVM_RUNTIME_OUTPUT_INTDIR}/lldb${CMAKE_EXECUTABLE_SUFFIX}")
+ set(LLDB_DEFAULT_TEST_DSYMUTIL "${LLVM_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin/dsymutil${CMAKE_EXECUTABLE_SUFFIX}")
+
+ if (NOT LLDB_TEST_USE_CUSTOM_C_COMPILER AND TARGET clang)
+ set(LLDB_DEFAULT_TEST_C_COMPILER "${LLVM_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin/clang${CMAKE_EXECUTABLE_SUFFIX}")
else()
set(LLDB_DEFAULT_TEST_C_COMPILER "")
+ endif()
+
+ if (NOT LLDB_TEST_USE_CUSTOM_CXX_COMPILER AND TARGET clang)
+ set(LLDB_DEFAULT_TEST_CXX_COMPILER "${LLVM_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin/clang++${CMAKE_EXECUTABLE_SUFFIX}")
+ else()
set(LLDB_DEFAULT_TEST_CXX_COMPILER "")
endif()
+ set(LLDB_TEST_EXECUTABLE "${LLDB_DEFAULT_TEST_EXECUTABLE}" CACHE PATH "lldb executable used for testing")
set(LLDB_TEST_C_COMPILER "${LLDB_DEFAULT_TEST_C_COMPILER}" CACHE PATH "C Compiler to use for building LLDB test inferiors")
set(LLDB_TEST_CXX_COMPILER "${LLDB_DEFAULT_TEST_CXX_COMPILER}" CACHE PATH "C++ Compiler to use for building LLDB test inferiors")
+ set(LLDB_TEST_DSYMUTIL "${LLDB_DEFAULT_TEST_DSYMUTIL}" CACHE PATH "dsymutil used for generating dSYM bundles")
if (("${LLDB_TEST_C_COMPILER}" STREQUAL "") OR
("${LLDB_TEST_CXX_COMPILER}" STREQUAL ""))
message(FATAL_ERROR "LLDB test compilers not specified. Tests will not run")
endif()
+ set(LLDB_TEST_DEPS lldb)
+
+ # darwin-debug is an hard dependency for the testsuite.
+ if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
+ list(APPEND LLDB_TEST_DEPS darwin-debug)
+ endif()
+
+ if(TARGET lldb-server)
+ list(APPEND LLDB_TEST_DEPS lldb-server)
+ endif()
+
+ if(TARGET debugserver)
+ if(NOT CMAKE_HOST_APPLE OR LLDB_CODESIGN_IDENTITY)
+ list(APPEND LLDB_TEST_DEPS debugserver)
+ endif()
+ endif()
+
+ if(TARGET lldb-mi)
+ list(APPEND LLDB_TEST_DEPS lldb-mi)
+ endif()
+
+ if(NOT LLDB_BUILT_STANDALONE)
+ list(APPEND LLDB_TEST_DEPS yaml2obj)
+ endif()
+
+ if(TARGET liblldb)
+ list(APPEND LLDB_TEST_DEPS liblldb)
+ endif()
+
+ if(TARGET clang)
+ list(APPEND LLDB_TEST_DEPS clang)
+ endif()
+
+ if(TARGET dsymutil)
+ list(APPEND LLDB_TEST_DEPS dsymutil)
+ endif()
+
add_subdirectory(test)
add_subdirectory(unittests)
add_subdirectory(lit)
+ add_subdirectory(utils/lldb-dotest)
+endif()
+
+if (LLDB_BUILD_FRAMEWORK)
+ add_custom_target(lldb-framework)
+ include(LLDBFramework)
endif()
if (NOT LLDB_DISABLE_PYTHON)
@@ -91,7 +175,7 @@ if (NOT LLDB_DISABLE_PYTHON)
${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/scripts/finishSwigWrapperClasses.py
--srcRoot=${LLDB_SOURCE_DIR}
--targetDir=${LLDB_PYTHON_TARGET_DIR}
- --cfgBldDir=${CMAKE_CURRENT_BINARY_DIR}/scripts
+ --cfgBldDir=${LLDB_PYTHON_TARGET_DIR}
--prefix=${CMAKE_BINARY_DIR}
--cmakeBuildConfiguration=${CMAKE_CFG_INTDIR}
--lldbLibDir=lib${LLVM_LIBDIR_SUFFIX}
@@ -99,10 +183,11 @@ if (NOT LLDB_DISABLE_PYTHON)
${FINISH_EXTRA_ARGS}
VERBATIM
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/scripts/finishSwigWrapperClasses.py
- DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/scripts/lldb.py
+ DEPENDS ${LLDB_PYTHON_TARGET_DIR}/lldb.py
COMMENT "Python script sym-linking LLDB Python API")
- # We depend on liblldb being built before we can do this step.
- add_dependencies(finish_swig liblldb lldb-argdumper)
+
+ # We depend on liblldb and lldb-argdumper being built before we can do this step.
+ add_dependencies(finish_swig ${LLDB_SUITE_TARGET})
# If we build the readline module, we depend on that happening
# first.
@@ -113,8 +198,8 @@ if (NOT LLDB_DISABLE_PYTHON)
# Ensure we do the python post-build step when building lldb.
add_dependencies(lldb finish_swig)
- if(LLDB_BUILD_FRAMEWORK)
- # The target to install libLLDB needs to depend on finish swig so that the
+ if (LLDB_BUILD_FRAMEWORK)
+ # The target to install libLLDB needs to depend on finish_swig so that the
# framework build properly copies over the Python files.
add_dependencies(install-liblldb finish_swig)
endif()