[cmake] Add a big warning about a libstdc++ issue
Summary:
Recent increase in the usage of std::weak_ptr has caused us to rediscover an issue in libstdc++
versions prior to 4.9 <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59656>, which make this class
unusable without exceptions in the presence of multiple threads. It's virtualy impossible to work
around this issue without implementing our own shared_ptr/weak_ptr substitutes, which does not
seem like a good idea.
Therefore, I am adding a big CMake warning which warns you about this issue if you're attempting
a to do a build which is suceptible to this problem and suggests possible alternatives. Right
now, nothing spectacular will happen if you ignore this warning (all the crashes I have seen
occur during process shutdown), but there's no guarantee the situation will not change in the
future.
Reviewers: tberghammer, tfiala, nitesh.jain, omjavaid, emaste, krytarowski
Subscribers: lldb-commits
Differential Revision: http://reviews.llvm.org/D20671
llvm-svn: 270854
2016-05-26 23:16:11 +08:00
|
|
|
include(CheckCXXSymbolExists)
|
|
|
|
|
2015-05-14 03:45:06 +08:00
|
|
|
set(LLDB_PROJECT_ROOT ${CMAKE_CURRENT_SOURCE_DIR})
|
|
|
|
set(LLDB_SOURCE_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/source")
|
|
|
|
set(LLDB_INCLUDE_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/include")
|
|
|
|
|
2015-07-17 23:26:27 +08:00
|
|
|
set(LLDB_LINKER_SUPPORTS_GROUPS OFF)
|
|
|
|
if (LLVM_COMPILER_IS_GCC_COMPATIBLE AND NOT "${CMAKE_SYSTEM_NAME}" MATCHES "Darwin")
|
|
|
|
# The Darwin linker doesn't understand --start-group/--end-group.
|
|
|
|
set(LLDB_LINKER_SUPPORTS_GROUPS ON)
|
|
|
|
endif()
|
|
|
|
|
2017-07-19 05:15:53 +08:00
|
|
|
set(LLDB_DEFAULT_DISABLE_PYTHON 0)
|
|
|
|
set(LLDB_DEFAULT_DISABLE_CURSES 0)
|
|
|
|
|
2015-05-14 03:45:06 +08:00
|
|
|
if ( CMAKE_SYSTEM_NAME MATCHES "Windows" )
|
|
|
|
set(LLDB_DEFAULT_DISABLE_CURSES 1)
|
2017-01-17 19:55:00 +08:00
|
|
|
elseif (CMAKE_SYSTEM_NAME MATCHES "Android" )
|
|
|
|
set(LLDB_DEFAULT_DISABLE_PYTHON 1)
|
|
|
|
set(LLDB_DEFAULT_DISABLE_CURSES 1)
|
2017-07-19 05:15:53 +08:00
|
|
|
elseif(IOS)
|
|
|
|
set(LLDB_DEFAULT_DISABLE_PYTHON 1)
|
|
|
|
endif()
|
|
|
|
|
2015-05-14 03:45:06 +08:00
|
|
|
set(LLDB_DISABLE_PYTHON ${LLDB_DEFAULT_DISABLE_PYTHON} CACHE BOOL
|
|
|
|
"Disables the Python scripting integration.")
|
|
|
|
set(LLDB_DISABLE_CURSES ${LLDB_DEFAULT_DISABLE_CURSES} CACHE BOOL
|
|
|
|
"Disables the Curses integration.")
|
|
|
|
|
|
|
|
set(LLDB_RELOCATABLE_PYTHON 0 CACHE BOOL
|
|
|
|
"Causes LLDB to use the PYTHONHOME environment variable to locate Python.")
|
|
|
|
|
2017-02-04 08:20:24 +08:00
|
|
|
set(LLDB_USE_SYSTEM_SIX 0 CACHE BOOL
|
|
|
|
"Use six.py shipped with system and do not install a copy of it")
|
|
|
|
|
2015-10-14 22:52:15 +08:00
|
|
|
if (NOT CMAKE_SYSTEM_NAME MATCHES "Windows")
|
|
|
|
set(LLDB_EXPORT_ALL_SYMBOLS 0 CACHE BOOL
|
|
|
|
"Causes lldb to export all symbols when building liblldb.")
|
|
|
|
else()
|
|
|
|
# Windows doesn't support toggling this, so don't bother making it a
|
|
|
|
# cache variable.
|
|
|
|
set(LLDB_EXPORT_ALL_SYMBOLS 0)
|
|
|
|
endif()
|
|
|
|
|
2015-05-14 03:45:06 +08:00
|
|
|
if ((NOT MSVC) OR MSVC12)
|
|
|
|
add_definitions( -DHAVE_ROUND )
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if (LLDB_DISABLE_CURSES)
|
|
|
|
add_definitions( -DLLDB_DISABLE_CURSES )
|
|
|
|
endif()
|
|
|
|
|
[CMake] Streamline code signing for debugserver #2
Summary:
Major fixes after D54476 (use Diff1 as base for comparison to see only recent changes):
* In standalone builds target directory for debugserver must be LLDB's bin, not LLVM's bin
* Default identity for code signing must not force-override LLVM_CODESIGNING_IDENTITY globally
We have a lot of cases, make them explicit:
* ID used for code signing (debugserver and in tests):
** `LLDB_CODESIGN_IDENTITY` if set explicitly, or otherwise
** `LLVM_CODESIGNING_IDENTITY` if set explicitly, or otherwise
** `lldb_codesign` as the default
* On Darwin we have a debugserver target that:
* On other systems, the debugserver target is not defined, which is equivalent to **[3A]**
Common configurations on Darwin:
* **[1A]** `cmake -GNinja ../llvm` builds debugserver from source and signs with `lldb_codesign`, no code signing for other binaries (prints status: //lldb debugserver: /path/to/bin/debugserver//)
* **[1A]** `cmake -GNinja -DLLVM_CODESIGNING_IDENTITY=- -DLLDB_CODESIGN_IDENTITY=lldb_codesign ../llvm` builds debugserver from source and signs with `lldb_codesign`, ad-hoc code signing for other binaries (prints status: //lldb debugserver: /path/to/bin/debugserver//)
* **[2A]** `cmake -GNinja -DLLVM_CODESIGNING_IDENTITY=- -DLLDB_USE_SYSTEM_DEBUGSERVER=ON ../llvm` copies debugserver from system, ad-hoc code signing for other binaries (prints status: //Copy system debugserver from: /path/to/system/debugserver//)
* **[2B]** `cmake -GNinja -DLLVM_CODESIGNING_IDENTITY=- ../llvm` same, but prints additional warning: //Cannot code sign debugserver with identity '-'. Will fall back to system's debugserver. Pass -DLLDB_CODESIGN_IDENTITY=lldb_codesign to override the LLVM value for debugserver.//
* **[3A]** `cmake -GNinja -DLLVM_CODESIGNING_IDENTITY=- -DLLDB_NO_DEBUGSERVER=ON ../llvm` debugserver not available (prints status: //lldb debugserver will not be available)//
Reviewers: JDevlieghere, beanz, davide, vsk, aprantl, labath
Reviewed By: JDevlieghere, labath
Subscribers: mgorny, #lldb, lldb-commits
Differential Revision: https://reviews.llvm.org/D55013
llvm-svn: 350388
2019-01-04 20:46:30 +08:00
|
|
|
option(LLDB_USE_ENTITLEMENTS "When code signing, use entitlements if available" ON)
|
|
|
|
|
2015-10-07 05:11:15 +08:00
|
|
|
# On Windows, we can't use the normal FindPythonLibs module that comes with CMake,
|
|
|
|
# for a number of reasons.
|
|
|
|
# 1) Prior to MSVC 2015, it is only possible to embed Python if python itself was
|
|
|
|
# compiled with an identical version (and build configuration) of MSVC as LLDB.
|
|
|
|
# The standard algorithm does not take into account the differences between
|
|
|
|
# a binary release distribution of python and a custom built distribution.
|
|
|
|
# 2) From MSVC 2015 and onwards, it is only possible to use Python 3.5 or later.
|
|
|
|
# 3) FindPythonLibs queries the registry to locate Python, and when looking for a
|
|
|
|
# 64-bit version of Python, since cmake.exe is a 32-bit executable, it will see
|
|
|
|
# a 32-bit view of the registry. As such, it is impossible for FindPythonLibs to
|
|
|
|
# locate 64-bit Python libraries.
|
|
|
|
# This function is designed to address those limitations. Currently it only partially
|
|
|
|
# addresses them, but it can be improved and extended on an as-needed basis.
|
|
|
|
function(find_python_libs_windows)
|
|
|
|
if ("${PYTHON_HOME}" STREQUAL "")
|
|
|
|
message("LLDB embedded Python on Windows requires specifying a value for PYTHON_HOME. Python support disabled.")
|
|
|
|
set(LLDB_DISABLE_PYTHON 1 PARENT_SCOPE)
|
|
|
|
return()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
file(TO_CMAKE_PATH "${PYTHON_HOME}/Include" PYTHON_INCLUDE_DIRS)
|
|
|
|
|
|
|
|
if(EXISTS "${PYTHON_INCLUDE_DIRS}/patchlevel.h")
|
|
|
|
file(STRINGS "${PYTHON_INCLUDE_DIRS}/patchlevel.h" python_version_str
|
|
|
|
REGEX "^#define[ \t]+PY_VERSION[ \t]+\"[^\"]+\"")
|
2015-12-17 22:13:39 +08:00
|
|
|
string(REGEX REPLACE "^#define[ \t]+PY_VERSION[ \t]+\"([^\"+]+)[+]?\".*" "\\1"
|
|
|
|
PYTHONLIBS_VERSION_STRING "${python_version_str}")
|
2015-10-07 05:11:15 +08:00
|
|
|
message("-- Found Python version ${PYTHONLIBS_VERSION_STRING}")
|
|
|
|
string(REGEX REPLACE "([0-9]+)[.]([0-9]+)[.][0-9]+" "python\\1\\2" PYTHONLIBS_BASE_NAME "${PYTHONLIBS_VERSION_STRING}")
|
|
|
|
unset(python_version_str)
|
|
|
|
else()
|
|
|
|
message("Unable to find ${PYTHON_INCLUDE_DIRS}/patchlevel.h, Python installation is corrupt.")
|
|
|
|
message("Python support will be disabled for this build.")
|
|
|
|
set(LLDB_DISABLE_PYTHON 1 PARENT_SCOPE)
|
|
|
|
return()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
file(TO_CMAKE_PATH "${PYTHON_HOME}" PYTHON_HOME)
|
|
|
|
file(TO_CMAKE_PATH "${PYTHON_HOME}/python_d.exe" PYTHON_DEBUG_EXE)
|
|
|
|
file(TO_CMAKE_PATH "${PYTHON_HOME}/libs/${PYTHONLIBS_BASE_NAME}_d.lib" PYTHON_DEBUG_LIB)
|
|
|
|
file(TO_CMAKE_PATH "${PYTHON_HOME}/${PYTHONLIBS_BASE_NAME}_d.dll" PYTHON_DEBUG_DLL)
|
|
|
|
|
|
|
|
file(TO_CMAKE_PATH "${PYTHON_HOME}/python.exe" PYTHON_RELEASE_EXE)
|
|
|
|
file(TO_CMAKE_PATH "${PYTHON_HOME}/libs/${PYTHONLIBS_BASE_NAME}.lib" PYTHON_RELEASE_LIB)
|
|
|
|
file(TO_CMAKE_PATH "${PYTHON_HOME}/${PYTHONLIBS_BASE_NAME}.dll" PYTHON_RELEASE_DLL)
|
|
|
|
|
2015-10-08 16:50:20 +08:00
|
|
|
if (NOT EXISTS ${PYTHON_DEBUG_EXE})
|
|
|
|
message("Unable to find ${PYTHON_DEBUG_EXE}")
|
|
|
|
unset(PYTHON_DEBUG_EXE)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if (NOT EXISTS ${PYTHON_RELEASE_EXE})
|
|
|
|
message("Unable to find ${PYTHON_RELEASE_EXE}")
|
|
|
|
unset(PYTHON_RELEASE_EXE)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if (NOT EXISTS ${PYTHON_DEBUG_LIB})
|
|
|
|
message("Unable to find ${PYTHON_DEBUG_LIB}")
|
|
|
|
unset(PYTHON_DEBUG_LIB)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if (NOT EXISTS ${PYTHON_RELEASE_LIB})
|
|
|
|
message("Unable to find ${PYTHON_RELEASE_LIB}")
|
|
|
|
unset(PYTHON_RELEASE_LIB)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if (NOT EXISTS ${PYTHON_DEBUG_DLL})
|
|
|
|
message("Unable to find ${PYTHON_DEBUG_DLL}")
|
|
|
|
unset(PYTHON_DEBUG_DLL)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if (NOT EXISTS ${PYTHON_RELEASE_DLL})
|
|
|
|
message("Unable to find ${PYTHON_RELEASE_DLL}")
|
|
|
|
unset(PYTHON_RELEASE_DLL)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if (NOT (PYTHON_DEBUG_EXE AND PYTHON_RELEASE_EXE AND PYTHON_DEBUG_LIB AND PYTHON_RELEASE_LIB AND PYTHON_DEBUG_DLL AND PYTHON_RELEASE_DLL))
|
|
|
|
message("Python installation is corrupt. Python support will be disabled for this build.")
|
|
|
|
set(LLDB_DISABLE_PYTHON 1 PARENT_SCOPE)
|
|
|
|
return()
|
|
|
|
endif()
|
|
|
|
|
2015-10-07 05:11:15 +08:00
|
|
|
# Generator expressions are evaluated in the context of each build configuration generated
|
|
|
|
# by CMake. Here we use the $<CONFIG:Debug>:VALUE logical generator expression to ensure
|
|
|
|
# that the debug Python library, DLL, and executable are used in the Debug build configuration.
|
|
|
|
#
|
|
|
|
# Generator expressions can be difficult to grok at first so here's a breakdown of the one
|
|
|
|
# used for PYTHON_LIBRARY:
|
|
|
|
#
|
|
|
|
# 1. $<CONFIG:Debug> evaluates to 1 when the Debug configuration is being generated,
|
|
|
|
# or 0 in all other cases.
|
|
|
|
# 2. $<$<CONFIG:Debug>:${PYTHON_DEBUG_LIB}> expands to ${PYTHON_DEBUG_LIB} when the Debug
|
|
|
|
# configuration is being generated, or nothing (literally) in all other cases.
|
|
|
|
# 3. $<$<NOT:$<CONFIG:Debug>>:${PYTHON_RELEASE_LIB}> expands to ${PYTHON_RELEASE_LIB} when
|
|
|
|
# any configuration other than Debug is being generated, or nothing in all other cases.
|
|
|
|
# 4. The conditionals in 2 & 3 are mutually exclusive.
|
|
|
|
# 5. A logical expression with a conditional that evaluates to 0 yields no value at all.
|
|
|
|
#
|
|
|
|
# Due to 4 & 5 it's possible to concatenate 2 & 3 to obtain a single value specific to each
|
|
|
|
# build configuration. In this example the value will be ${PYTHON_DEBUG_LIB} when generating the
|
|
|
|
# Debug configuration, or ${PYTHON_RELEASE_LIB} when generating any other configuration.
|
|
|
|
# Note that it's imperative that there is no whitespace between the two expressions, otherwise
|
|
|
|
# CMake will insert a semicolon between the two.
|
|
|
|
set (PYTHON_EXECUTABLE $<$<CONFIG:Debug>:${PYTHON_DEBUG_EXE}>$<$<NOT:$<CONFIG:Debug>>:${PYTHON_RELEASE_EXE}>)
|
|
|
|
set (PYTHON_LIBRARY $<$<CONFIG:Debug>:${PYTHON_DEBUG_LIB}>$<$<NOT:$<CONFIG:Debug>>:${PYTHON_RELEASE_LIB}>)
|
|
|
|
set (PYTHON_DLL $<$<CONFIG:Debug>:${PYTHON_DEBUG_DLL}>$<$<NOT:$<CONFIG:Debug>>:${PYTHON_RELEASE_DLL}>)
|
|
|
|
|
|
|
|
set (PYTHON_EXECUTABLE ${PYTHON_EXECUTABLE} PARENT_SCOPE)
|
|
|
|
set (PYTHON_LIBRARY ${PYTHON_LIBRARY} PARENT_SCOPE)
|
|
|
|
set (PYTHON_DLL ${PYTHON_DLL} PARENT_SCOPE)
|
|
|
|
set (PYTHON_INCLUDE_DIRS ${PYTHON_INCLUDE_DIRS} PARENT_SCOPE)
|
|
|
|
|
2015-10-08 16:50:20 +08:00
|
|
|
message("-- LLDB Found PythonExecutable: ${PYTHON_RELEASE_EXE} and ${PYTHON_DEBUG_EXE}")
|
|
|
|
message("-- LLDB Found PythonLibs: ${PYTHON_RELEASE_LIB} and ${PYTHON_DEBUG_LIB}")
|
|
|
|
message("-- LLDB Found PythonDLL: ${PYTHON_RELEASE_DLL} and ${PYTHON_DEBUG_DLL}")
|
2015-10-07 05:11:15 +08:00
|
|
|
message("-- LLDB Found PythonIncludeDirs: ${PYTHON_INCLUDE_DIRS}")
|
|
|
|
endfunction(find_python_libs_windows)
|
|
|
|
|
2015-05-14 03:45:06 +08:00
|
|
|
if (NOT LLDB_DISABLE_PYTHON)
|
2015-07-17 23:26:27 +08:00
|
|
|
|
2015-05-14 03:45:06 +08:00
|
|
|
if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows")
|
2015-10-07 05:11:15 +08:00
|
|
|
find_python_libs_windows()
|
2015-07-17 23:26:27 +08:00
|
|
|
|
2015-10-07 05:11:15 +08:00
|
|
|
if (NOT LLDB_RELOCATABLE_PYTHON)
|
2015-10-10 03:45:26 +08:00
|
|
|
file(TO_CMAKE_PATH "${PYTHON_HOME}" LLDB_PYTHON_HOME)
|
|
|
|
add_definitions( -DLLDB_PYTHON_HOME="${LLDB_PYTHON_HOME}" )
|
2015-05-14 03:45:06 +08:00
|
|
|
endif()
|
|
|
|
else()
|
|
|
|
find_package(PythonLibs REQUIRED)
|
2015-10-07 05:11:15 +08:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if (PYTHON_INCLUDE_DIRS)
|
2015-05-14 03:45:06 +08:00
|
|
|
include_directories(${PYTHON_INCLUDE_DIRS})
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if (LLDB_DISABLE_PYTHON)
|
2015-10-07 05:11:15 +08:00
|
|
|
unset(PYTHON_INCLUDE_DIRS)
|
2015-05-14 03:45:06 +08:00
|
|
|
unset(PYTHON_LIBRARY)
|
|
|
|
add_definitions( -DLLDB_DISABLE_PYTHON )
|
|
|
|
endif()
|
|
|
|
|
2015-10-29 08:48:38 +08:00
|
|
|
if (LLVM_EXTERNAL_CLANG_SOURCE_DIR)
|
|
|
|
include_directories(${LLVM_EXTERNAL_CLANG_SOURCE_DIR}/include)
|
|
|
|
else ()
|
|
|
|
include_directories(${CMAKE_SOURCE_DIR}/tools/clang/include)
|
|
|
|
endif ()
|
2015-05-14 03:45:06 +08:00
|
|
|
include_directories("${CMAKE_CURRENT_BINARY_DIR}/../clang/include")
|
|
|
|
|
|
|
|
# Disable GCC warnings
|
|
|
|
check_cxx_compiler_flag("-Wno-deprecated-declarations"
|
|
|
|
CXX_SUPPORTS_NO_DEPRECATED_DECLARATIONS)
|
|
|
|
if (CXX_SUPPORTS_NO_DEPRECATED_DECLARATIONS)
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-declarations")
|
|
|
|
endif ()
|
|
|
|
|
|
|
|
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 ()
|
|
|
|
|
2015-10-23 18:34:53 +08:00
|
|
|
check_cxx_compiler_flag("-Wno-strict-aliasing"
|
|
|
|
CXX_SUPPORTS_NO_STRICT_ALIASING)
|
|
|
|
if (CXX_SUPPORTS_NO_STRICT_ALIASING)
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-strict-aliasing")
|
|
|
|
endif ()
|
|
|
|
|
2015-05-14 03:45:06 +08:00
|
|
|
# Disable Clang warnings
|
|
|
|
check_cxx_compiler_flag("-Wno-deprecated-register"
|
|
|
|
CXX_SUPPORTS_NO_DEPRECATED_REGISTER)
|
|
|
|
if (CXX_SUPPORTS_NO_DEPRECATED_REGISTER)
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-register")
|
|
|
|
endif ()
|
|
|
|
|
2015-09-02 07:43:51 +08:00
|
|
|
check_cxx_compiler_flag("-Wno-vla-extension"
|
|
|
|
CXX_SUPPORTS_NO_VLA_EXTENSION)
|
|
|
|
if (CXX_SUPPORTS_NO_VLA_EXTENSION)
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-vla-extension")
|
|
|
|
endif ()
|
|
|
|
|
2017-12-08 02:57:09 +08:00
|
|
|
check_cxx_compiler_flag("-Wno-gnu-anonymous-struct"
|
|
|
|
CXX_SUPPORTS_NO_GNU_ANONYMOUS_STRUCT)
|
|
|
|
|
|
|
|
check_cxx_compiler_flag("-Wno-nested-anon-types"
|
|
|
|
CXX_SUPPORTS_NO_NESTED_ANON_TYPES)
|
|
|
|
|
2015-05-14 03:45:06 +08:00
|
|
|
# Disable MSVC warnings
|
|
|
|
if( MSVC )
|
|
|
|
add_definitions(
|
|
|
|
-wd4018 # Suppress 'warning C4018: '>=' : signed/unsigned mismatch'
|
|
|
|
-wd4068 # Suppress 'warning C4068: unknown pragma'
|
|
|
|
-wd4150 # Suppress 'warning C4150: deletion of pointer to incomplete type'
|
2018-12-22 07:59:24 +08:00
|
|
|
-wd4201 # Suppress 'warning C4201: nonstandard extension used: nameless struct/union'
|
2015-05-14 03:45:06 +08:00
|
|
|
-wd4251 # Suppress 'warning C4251: T must have dll-interface to be used by clients of class U.'
|
|
|
|
-wd4521 # Suppress 'warning C4521: 'type' : multiple copy constructors specified'
|
|
|
|
-wd4530 # Suppress 'warning C4530: C++ exception handler used, but unwind semantics are not enabled.'
|
|
|
|
)
|
2015-07-17 23:26:27 +08:00
|
|
|
endif()
|
2015-05-14 03:45:06 +08:00
|
|
|
|
2016-03-23 01:58:09 +08:00
|
|
|
# Use the Unicode (UTF-16) APIs by default on Win32
|
|
|
|
if (CMAKE_SYSTEM_NAME MATCHES "Windows")
|
2016-12-15 23:00:41 +08:00
|
|
|
add_definitions( -D_UNICODE -DUNICODE )
|
2016-03-23 01:58:09 +08:00
|
|
|
endif()
|
|
|
|
|
2015-05-14 03:45:06 +08:00
|
|
|
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()
|
|
|
|
|
2018-11-13 00:22:28 +08:00
|
|
|
# If LLDB_VERSION_* is specified, use it, if not use LLVM_VERSION_*.
|
|
|
|
if(NOT DEFINED LLDB_VERSION_MAJOR)
|
|
|
|
set(LLDB_VERSION_MAJOR ${LLVM_VERSION_MAJOR})
|
|
|
|
endif()
|
|
|
|
if(NOT DEFINED LLDB_VERSION_MINOR)
|
|
|
|
set(LLDB_VERSION_MINOR ${LLVM_VERSION_MINOR})
|
|
|
|
endif()
|
|
|
|
if(NOT DEFINED LLDB_VERSION_PATCH)
|
|
|
|
set(LLDB_VERSION_PATCH ${LLVM_VERSION_PATCH})
|
|
|
|
endif()
|
|
|
|
if(NOT DEFINED LLDB_VERSION_SUFFIX)
|
|
|
|
set(LLDB_VERSION_SUFFIX ${LLVM_VERSION_SUFFIX})
|
|
|
|
endif()
|
|
|
|
set(LLDB_VERSION "${LLDB_VERSION_MAJOR}.${LLDB_VERSION_MINOR}.${LLDB_VERSION_PATCH}${LLDB_VERSION_SUFFIX}")
|
2015-05-14 03:45:06 +08:00
|
|
|
message(STATUS "LLDB version: ${LLDB_VERSION}")
|
|
|
|
|
|
|
|
include_directories(BEFORE
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/include
|
2017-04-15 06:03:45 +08:00
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/include
|
2015-05-14 03:45:06 +08:00
|
|
|
)
|
|
|
|
|
2015-06-29 19:03:21 +08:00
|
|
|
if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
|
|
|
|
install(DIRECTORY include/
|
2018-03-08 23:52:46 +08:00
|
|
|
COMPONENT lldb-headers
|
2015-06-29 19:03:21 +08:00
|
|
|
DESTINATION include
|
|
|
|
FILES_MATCHING
|
|
|
|
PATTERN "*.h"
|
|
|
|
PATTERN ".svn" EXCLUDE
|
2017-04-15 06:03:45 +08:00
|
|
|
PATTERN ".cmake" EXCLUDE
|
|
|
|
PATTERN "Config.h" EXCLUDE
|
|
|
|
)
|
|
|
|
|
|
|
|
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include/
|
2018-03-08 23:52:46 +08:00
|
|
|
COMPONENT lldb-headers
|
2017-04-15 06:03:45 +08:00
|
|
|
DESTINATION include
|
|
|
|
FILES_MATCHING
|
|
|
|
PATTERN "*.h"
|
|
|
|
PATTERN ".svn" EXCLUDE
|
|
|
|
PATTERN ".cmake" EXCLUDE
|
2015-06-29 19:03:21 +08:00
|
|
|
)
|
2018-03-08 23:52:46 +08:00
|
|
|
|
|
|
|
add_custom_target(lldb-headers)
|
|
|
|
set_target_properties(lldb-headers PROPERTIES FOLDER "Misc")
|
|
|
|
|
|
|
|
if (NOT CMAKE_CONFIGURATION_TYPES)
|
|
|
|
add_llvm_install_targets(install-lldb-headers
|
|
|
|
COMPONENT lldb-headers)
|
|
|
|
endif()
|
2015-06-29 19:03:21 +08:00
|
|
|
endif()
|
2015-04-16 23:51:33 +08:00
|
|
|
|
2018-12-19 04:51:00 +08:00
|
|
|
if (NOT LIBXML2_FOUND)
|
2015-04-16 23:51:33 +08:00
|
|
|
find_package(LibXml2)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# Find libraries or frameworks that may be needed
|
2017-07-19 05:15:53 +08:00
|
|
|
if (APPLE)
|
|
|
|
if(NOT IOS)
|
|
|
|
find_library(CARBON_LIBRARY Carbon)
|
|
|
|
find_library(CORE_SERVICES_LIBRARY CoreServices)
|
|
|
|
find_library(DEBUG_SYMBOLS_LIBRARY DebugSymbols PATHS "/System/Library/PrivateFrameworks")
|
|
|
|
endif()
|
2015-05-14 03:45:06 +08:00
|
|
|
find_library(FOUNDATION_LIBRARY Foundation)
|
|
|
|
find_library(CORE_FOUNDATION_LIBRARY CoreFoundation)
|
2015-04-16 23:51:33 +08:00
|
|
|
find_library(SECURITY_LIBRARY Security)
|
|
|
|
|
2016-09-22 05:02:16 +08:00
|
|
|
set(LLDB_FRAMEWORK_INSTALL_DIR Library/Frameworks CACHE STRING "Output directory for LLDB.framework")
|
|
|
|
set(LLDB_FRAMEWORK_VERSION A CACHE STRING "LLDB.framework version (default is A)")
|
|
|
|
set(LLDB_FRAMEWORK_RESOURCE_DIR
|
2018-07-28 07:38:58 +08:00
|
|
|
LLDB.framework/Versions/${LLDB_FRAMEWORK_VERSION}/Resources)
|
2016-09-22 05:02:16 +08:00
|
|
|
|
2015-04-16 23:51:33 +08:00
|
|
|
add_definitions( -DLIBXML2_DEFINED )
|
2017-07-19 05:15:53 +08:00
|
|
|
list(APPEND system_libs xml2
|
|
|
|
${CURSES_LIBRARIES}
|
|
|
|
${FOUNDATION_LIBRARY}
|
|
|
|
${CORE_FOUNDATION_LIBRARY}
|
|
|
|
${CORE_SERVICES_LIBRARY}
|
|
|
|
${SECURITY_LIBRARY}
|
|
|
|
${DEBUG_SYMBOLS_LIBRARY})
|
2018-08-23 06:25:45 +08:00
|
|
|
include_directories(${LIBXML2_INCLUDE_DIR})
|
2018-12-19 04:51:00 +08:00
|
|
|
elseif(LIBXML2_FOUND AND LIBXML2_VERSION_STRING VERSION_GREATER 2.8)
|
|
|
|
add_definitions( -DLIBXML2_DEFINED )
|
|
|
|
list(APPEND system_libs ${LIBXML2_LIBRARIES})
|
|
|
|
include_directories(${LIBXML2_INCLUDE_DIR})
|
2015-04-16 23:51:33 +08:00
|
|
|
endif()
|
|
|
|
|
2018-03-14 18:08:21 +08:00
|
|
|
if( WIN32 AND NOT CYGWIN )
|
|
|
|
set(PURE_WINDOWS 1)
|
|
|
|
endif()
|
2015-06-04 11:12:37 +08:00
|
|
|
|
2018-03-14 18:08:21 +08:00
|
|
|
if(NOT PURE_WINDOWS)
|
|
|
|
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
|
|
|
|
find_package(Threads REQUIRED)
|
|
|
|
list(APPEND system_libs ${CMAKE_THREAD_LIBS_INIT})
|
2015-06-04 11:12:37 +08:00
|
|
|
endif()
|
|
|
|
|
2018-03-14 18:08:21 +08:00
|
|
|
list(APPEND system_libs ${CMAKE_DL_LIBS})
|
|
|
|
|
2018-08-24 02:05:45 +08:00
|
|
|
SET(SKIP_LLDB_SERVER_BUILD OFF CACHE BOOL "Skip building lldb-server")
|
|
|
|
|
2015-09-16 23:34:06 +08:00
|
|
|
# Figure out if lldb could use lldb-server. If so, then we'll
|
|
|
|
# ensure we build lldb-server when an lldb target is being built.
|
2017-01-17 19:55:00 +08:00
|
|
|
if (CMAKE_SYSTEM_NAME MATCHES "Android|Darwin|FreeBSD|Linux|NetBSD")
|
2015-09-16 23:34:06 +08:00
|
|
|
set(LLDB_CAN_USE_LLDB_SERVER 1)
|
|
|
|
else()
|
|
|
|
set(LLDB_CAN_USE_LLDB_SERVER 0)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# Figure out if lldb could use debugserver. If so, then we'll
|
|
|
|
# ensure we build debugserver when we build lldb.
|
|
|
|
if ( CMAKE_SYSTEM_NAME MATCHES "Darwin" )
|
|
|
|
set(LLDB_CAN_USE_DEBUGSERVER 1)
|
|
|
|
else()
|
|
|
|
set(LLDB_CAN_USE_DEBUGSERVER 0)
|
|
|
|
endif()
|
2015-11-15 09:53:23 +08:00
|
|
|
|
|
|
|
if (NOT LLDB_DISABLE_CURSES)
|
|
|
|
find_package(Curses REQUIRED)
|
|
|
|
|
|
|
|
find_library(CURSES_PANEL_LIBRARY NAMES panel DOC "The curses panel library")
|
|
|
|
if (NOT CURSES_PANEL_LIBRARY)
|
|
|
|
message(FATAL_ERROR "A required curses' panel library not found.")
|
|
|
|
endif ()
|
|
|
|
|
|
|
|
# Add panels to the library path
|
|
|
|
set (CURSES_LIBRARIES ${CURSES_LIBRARIES} ${CURSES_PANEL_LIBRARY})
|
|
|
|
|
|
|
|
list(APPEND system_libs ${CURSES_LIBRARIES})
|
|
|
|
include_directories(${CURSES_INCLUDE_DIR})
|
|
|
|
endif ()
|
[cmake] Add a big warning about a libstdc++ issue
Summary:
Recent increase in the usage of std::weak_ptr has caused us to rediscover an issue in libstdc++
versions prior to 4.9 <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59656>, which make this class
unusable without exceptions in the presence of multiple threads. It's virtualy impossible to work
around this issue without implementing our own shared_ptr/weak_ptr substitutes, which does not
seem like a good idea.
Therefore, I am adding a big CMake warning which warns you about this issue if you're attempting
a to do a build which is suceptible to this problem and suggests possible alternatives. Right
now, nothing spectacular will happen if you ignore this warning (all the crashes I have seen
occur during process shutdown), but there's no guarantee the situation will not change in the
future.
Reviewers: tberghammer, tfiala, nitesh.jain, omjavaid, emaste, krytarowski
Subscribers: lldb-commits
Differential Revision: http://reviews.llvm.org/D20671
llvm-svn: 270854
2016-05-26 23:16:11 +08:00
|
|
|
|
|
|
|
check_cxx_symbol_exists("__GLIBCXX__" "string" LLDB_USING_LIBSTDCXX)
|
|
|
|
if(LLDB_USING_LIBSTDCXX)
|
|
|
|
# There doesn't seem to be an easy way to check the library version. Instead, we rely on the
|
|
|
|
# fact that std::set did not have the allocator constructor available until version 4.9
|
|
|
|
check_cxx_source_compiles("
|
|
|
|
#include <set>
|
|
|
|
std::set<int> s = std::set<int>(std::allocator<int>());
|
|
|
|
int main() { return 0; }"
|
|
|
|
LLDB_USING_LIBSTDCXX_4_9)
|
|
|
|
if (NOT LLDB_USING_LIBSTDCXX_4_9 AND NOT LLVM_ENABLE_EH)
|
|
|
|
message(WARNING
|
|
|
|
"You appear to be linking to libstdc++ version lesser than 4.9 without exceptions "
|
|
|
|
"enabled. These versions of the library have an issue, which causes occasional "
|
|
|
|
"lldb crashes. See <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59656> for "
|
|
|
|
"details. Possible courses of action are:\n"
|
|
|
|
"- use libstdc++ version 4.9 or newer\n"
|
|
|
|
"- use libc++ (via LLVM_ENABLE_LIBCXX)\n"
|
|
|
|
"- enable exceptions (via LLVM_ENABLE_EH)\n"
|
|
|
|
"- ignore this warning and accept occasional instability")
|
|
|
|
endif()
|
|
|
|
endif()
|
2016-08-26 17:47:58 +08:00
|
|
|
|
2017-01-27 20:58:23 +08:00
|
|
|
if ((CMAKE_SYSTEM_NAME MATCHES "Android") AND LLVM_BUILD_STATIC AND
|
|
|
|
((ANDROID_ABI MATCHES "armeabi") OR (ANDROID_ABI MATCHES "mips")))
|
2017-01-27 23:19:03 +08:00
|
|
|
add_definitions(-DANDROID_USE_ACCEPT_WORKAROUND)
|
2017-01-27 20:23:51 +08:00
|
|
|
endif()
|
|
|
|
|
2016-12-17 20:48:06 +08:00
|
|
|
find_package(Backtrace)
|
2017-04-28 00:04:26 +08:00
|
|
|
include(LLDBGenerateConfig)
|