[CMake] Add checks for libcompression

This enables libcompression when available in the CMake build system.

llvm-svn: 309395
This commit is contained in:
Chris Bieneman 2017-07-28 15:39:51 +00:00
parent 0025f3f6ba
commit 8c01cc54eb
4 changed files with 27 additions and 5 deletions

View File

@ -3,6 +3,7 @@
include(CheckSymbolExists)
include(CheckIncludeFile)
include(CheckIncludeFiles)
include(CheckLibraryExists)
set(CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE)
check_symbol_exists(ppoll poll.h HAVE_PPOLL)
@ -21,6 +22,8 @@ check_cxx_source_compiles("
int main() { return __NR_process_vm_readv; }"
HAVE_NR_PROCESS_VM_READV)
check_library_exists(compression compression_encode_buffer "" HAVE_LIBCOMPRESSION)
# These checks exist in LLVM's configuration, so I want to match the LLVM names
# so that the check isn't duplicated, but we translate them into the LLDB names
# so that I don't have to change all the uses at the moment.

View File

@ -24,4 +24,6 @@
#cmakedefine01 HAVE_NR_PROCESS_VM_READV
#cmakedefine HAVE_LIBCOMPRESSION
#endif // #ifndef LLDB_HOST_CONFIG_H

View File

@ -7,6 +7,10 @@ set(LLDB_PLUGINS
lldbPluginPlatformMacOSX
)
if(HAVE_LIBCOMPRESSION)
set(LIBCOMPRESSION compression)
endif()
add_lldb_library(lldbPluginProcessGDBRemote PLUGIN
GDBRemoteClientBase.cpp
GDBRemoteCommunication.cpp
@ -30,6 +34,7 @@ add_lldb_library(lldbPluginProcessGDBRemote PLUGIN
lldbTarget
lldbUtility
${LLDB_PLUGINS}
${LIBCOMPRESSION}
LINK_COMPONENTS
Support
)

View File

@ -1,4 +1,5 @@
include(CheckCXXCompilerFlag)
include(CheckLibraryExists)
include_directories(${CMAKE_CURRENT_BINARY_DIR}/..)
include_directories(${LLDB_SOURCE_DIR}/source)
include_directories(MacOSX/DarwinLog)
@ -26,6 +27,8 @@ if (CXX_SUPPORTS_NO_EXTENDED_OFFSETOF)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-extended-offsetof")
endif ()
check_library_exists(compression compression_encode_buffer "" HAVE_LIBCOMPRESSION)
add_subdirectory(MacOSX)
set(generated_mach_interfaces
@ -123,8 +126,12 @@ if(NOT SKIP_DEBUGSERVER)
${MOBILESERVICES_LIBRARY}
${LOCKDOWN_LIBRARY}
lldbDebugserverArchSupport
lldbDebugserverDarwin_DarwinLog)
lldbDebugserverDarwin_DarwinLog
compression)
if(HAVE_LIBCOMPRESSION)
set_property(TARGET lldbDebugserverCommon APPEND PROPERTY
COMPILE_DEFINITIONS HAVE_LIBCOMPRESSION)
endif()
set(LLVM_OPTIONAL_SOURCES ${lldbDebugserverCommonSources})
add_lldb_tool(debugserver INCLUDE_IN_FRAMEWORK
debugserver.cpp
@ -151,9 +158,14 @@ if(IOS)
${CORE_FOUNDATION_LIBRARY}
${FOUNDATION_LIBRARY}
lldbDebugserverArchSupport
lldbDebugserverDarwin_DarwinLog)
lldbDebugserverDarwin_DarwinLog
compression)
if(HAVE_LIBCOMPRESSION)
set_property(TARGET lldbDebugserverCommon_NonUI APPEND PROPERTY
COMPILE_DEFINITIONS HAVE_LIBCOMPRESSION)
endif()
add_lldb_tool(debugserver_nonui INCLUDE_IN_FRAMEWORK
add_lldb_tool(debugserver-nonui INCLUDE_IN_FRAMEWORK
debugserver.cpp
LINK_LIBS
@ -183,7 +195,7 @@ if (NOT ("${LLDB_CODESIGN_IDENTITY}" STREQUAL ""))
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/bin
)
if(IOS)
add_custom_command(TARGET debugserver_nonui
add_custom_command(TARGET debugserver-nonui
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E env CODESIGN_ALLOCATE=${CODESIGN_ALLOCATE}
codesign --force --sign ${LLDB_CODESIGN_IDENTITY}