[CMake] Aggregate options for LLDB in LLDBConfig.cmake

Summary: In preparation for LLDB.framework changes, collect options for LLDB in LLDBConfig.cmake (used for both, standalone and in-tree builds of LLDB).

Reviewers: JDevlieghere, aprantl, xiaobai

Reviewed By: aprantl

Subscribers: srhines, mgorny, lldb-commits, #lldb

Differential Revision: https://reviews.llvm.org/D55317

llvm-svn: 350389
This commit is contained in:
Stefan Granitz 2019-01-04 12:46:34 +00:00
parent 90aeb4c8d9
commit fd6fedfbe0
2 changed files with 32 additions and 36 deletions

View File

@ -18,15 +18,6 @@ else()
add_definitions( -DLLDB_CONFIGURATION_RELEASE ) add_definitions( -DLLDB_CONFIGURATION_RELEASE )
endif() endif()
if (CMAKE_SYSTEM_NAME MATCHES "Windows|Android")
set(LLDB_DEFAULT_DISABLE_LIBEDIT 1)
else()
set(LLDB_DEFAULT_DISABLE_LIBEDIT 0)
endif ()
# We need libedit support to go down both the source and
# the scripts directories.
set(LLDB_DISABLE_LIBEDIT ${LLDB_DEFAULT_DISABLE_LIBEDIT} CACHE BOOL "Disables the use of editline.")
if (LLDB_DISABLE_LIBEDIT) if (LLDB_DISABLE_LIBEDIT)
add_definitions( -DLLDB_DISABLE_LIBEDIT ) add_definitions( -DLLDB_DISABLE_LIBEDIT )
else() else()
@ -42,16 +33,9 @@ endif()
add_custom_target(lldb-suite) add_custom_target(lldb-suite)
set(LLDB_SUITE_TARGET lldb-suite) set(LLDB_SUITE_TARGET lldb-suite)
option(LLDB_BUILD_FRAMEWORK "Build the Darwin LLDB.framework" Off)
if(LLDB_BUILD_FRAMEWORK) 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()
add_custom_target(lldb-framework) add_custom_target(lldb-framework)
# These are used to fill out LLDB-Info.plist. These are relevant when building # These are used to fill out LLDB-Info.plist. These are relevant when building
# the framework, and must be defined before building liblldb. # the framework, and must be defined before building liblldb.
set(PRODUCT_NAME "LLDB") set(PRODUCT_NAME "LLDB")

View File

@ -10,28 +10,42 @@ if (LLVM_COMPILER_IS_GCC_COMPATIBLE AND NOT "${CMAKE_SYSTEM_NAME}" MATCHES "Darw
set(LLDB_LINKER_SUPPORTS_GROUPS ON) set(LLDB_LINKER_SUPPORTS_GROUPS ON)
endif() endif()
set(LLDB_DEFAULT_DISABLE_PYTHON 0) set(default_disable_python OFF)
set(LLDB_DEFAULT_DISABLE_CURSES 0) set(default_disable_curses OFF)
set(default_disable_libedit OFF)
if ( CMAKE_SYSTEM_NAME MATCHES "Windows" ) if(DEFINED LLVM_ENABLE_LIBEDIT AND NOT LLVM_ENABLE_LIBEDIT)
set(LLDB_DEFAULT_DISABLE_CURSES 1) set(default_disable_libedit ON)
elseif (CMAKE_SYSTEM_NAME MATCHES "Android" )
set(LLDB_DEFAULT_DISABLE_PYTHON 1)
set(LLDB_DEFAULT_DISABLE_CURSES 1)
elseif(IOS)
set(LLDB_DEFAULT_DISABLE_PYTHON 1)
endif() endif()
set(LLDB_DISABLE_PYTHON ${LLDB_DEFAULT_DISABLE_PYTHON} CACHE BOOL if(CMAKE_SYSTEM_NAME MATCHES "Windows")
"Disables the Python scripting integration.") set(default_disable_curses ON)
set(LLDB_DISABLE_CURSES ${LLDB_DEFAULT_DISABLE_CURSES} CACHE BOOL set(default_disable_libedit ON)
"Disables the Curses integration.") elseif(CMAKE_SYSTEM_NAME MATCHES "Android")
set(default_disable_python ON)
set(default_disable_curses ON)
set(default_disable_libedit ON)
elseif(IOS)
set(default_disable_python ON)
endif()
set(LLDB_RELOCATABLE_PYTHON 0 CACHE BOOL option(LLDB_DISABLE_PYTHON "Disable Python scripting integration." ${default_disable_python})
"Causes LLDB to use the PYTHONHOME environment variable to locate Python.") option(LLDB_DISABLE_CURSES "Disable Curses integration." ${default_disable_curses})
option(LLDB_DISABLE_LIBEDIT "Disable the use of editline." ${default_disable_libedit})
option(LLDB_RELOCATABLE_PYTHON "Use the PYTHONHOME environment variable to locate Python." OFF)
option(LLDB_USE_SYSTEM_SIX "Use six.py shipped with system and do not install a copy of it" OFF)
option(LLDB_USE_ENTITLEMENTS "When codesigning, use entitlements if available" ON)
option(LLDB_BUILD_FRAMEWORK "Build LLDB.framework (Darwin only)" OFF)
set(LLDB_USE_SYSTEM_SIX 0 CACHE BOOL if(LLDB_BUILD_FRAMEWORK)
"Use six.py shipped with system and do not install a copy of it") if(NOT APPLE)
message(FATAL_ERROR "LLDB.framework can only be generated when targeting Apple platforms")
endif()
# CMake 3.6 did not correctly emit POST_BUILD commands for Apple Framework targets
if(CMAKE_VERSION VERSION_LESS 3.7)
message(FATAL_ERROR "LLDB_BUILD_FRAMEWORK is not supported on CMake < 3.7")
endif()
endif()
if (NOT CMAKE_SYSTEM_NAME MATCHES "Windows") if (NOT CMAKE_SYSTEM_NAME MATCHES "Windows")
set(LLDB_EXPORT_ALL_SYMBOLS 0 CACHE BOOL set(LLDB_EXPORT_ALL_SYMBOLS 0 CACHE BOOL
@ -50,8 +64,6 @@ if (LLDB_DISABLE_CURSES)
add_definitions( -DLLDB_DISABLE_CURSES ) add_definitions( -DLLDB_DISABLE_CURSES )
endif() endif()
option(LLDB_USE_ENTITLEMENTS "When code signing, use entitlements if available" ON)
# On Windows, we can't use the normal FindPythonLibs module that comes with CMake, # On Windows, we can't use the normal FindPythonLibs module that comes with CMake,
# for a number of reasons. # for a number of reasons.
# 1) Prior to MSVC 2015, it is only possible to embed Python if python itself was # 1) Prior to MSVC 2015, it is only possible to embed Python if python itself was