Skip to content

Commit

Permalink
[CMake] Add accurate dependency specifications
Browse files Browse the repository at this point in the history
Summary:
This patch adds accurate dependency specifications to the mail LLDB libraries and tools.

In all cases except lldb-server, these dependencies are added in addition to existing dependencies (making this low risk), and I performed some code cleanup along the way.

For lldb-server I've cleaned up the LLVM dependencies down to just the minimum actually required. This is more than lldb-server actually directly references, and I've left a todo in the code to clean that up.

Reviewers: labath, zturner

Subscribers: lldb-commits, danalbert, srhines, ki.stfu, mgorny, jgosnell

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

llvm-svn: 293686
  • Loading branch information
Chris Bieneman committed Jan 31, 2017
1 parent eb1ad40 commit 494f277
Show file tree
Hide file tree
Showing 17 changed files with 249 additions and 177 deletions.
12 changes: 12 additions & 0 deletions lldb/source/Breakpoint/CMakeLists.txt
Expand Up @@ -20,4 +20,16 @@ add_lldb_library(lldbBreakpoint
Watchpoint.cpp
WatchpointList.cpp
WatchpointOptions.cpp

LINK_LIBS
lldbCore
lldbExpression
lldbInterpreter
lldbSymbol
lldbTarget
lldbPluginCPlusPlusLanguage
lldbPluginObjCLanguage

LINK_COMPONENTS
Support
)
15 changes: 15 additions & 0 deletions lldb/source/Commands/CMakeLists.txt
Expand Up @@ -29,4 +29,19 @@ add_lldb_library(lldbCommands
CommandObjectWatchpoint.cpp
CommandObjectWatchpointCommand.cpp
CommandObjectLanguage.cpp

LINK_LIBS
lldbBreakpoint
lldbCore
lldbDataFormatters
lldbExpression
lldbHost
lldbInterpreter
lldbSymbol
lldbTarget
lldbUtility
lldbPluginExpressionParserClang

LINK_COMPONENTS
Support
)
19 changes: 19 additions & 0 deletions lldb/source/Core/CMakeLists.txt
Expand Up @@ -69,5 +69,24 @@ add_lldb_library(lldbCore
ValueObjectSyntheticFilter.cpp
ValueObjectVariable.cpp
VMRange.cpp

LINK_LIBS
lldbBreakpoint
lldbDataFormatters
lldbExpression
lldbHost
lldbInterpreter
lldbSymbol
lldbTarget
lldbUtility
lldbPluginProcessUtility
lldbPluginCPlusPlusLanguage
lldbPluginObjCLanguage
lldbPluginObjectFileJIT
lldbPluginExpressionParserClang

LINK_COMPONENTS
Support
Demangle
)

10 changes: 10 additions & 0 deletions lldb/source/DataFormatters/CMakeLists.txt
Expand Up @@ -16,4 +16,14 @@ add_lldb_library(lldbDataFormatters
TypeValidator.cpp
ValueObjectPrinter.cpp
VectorType.cpp

LINK_LIBS
lldbCore
lldbInterpreter
lldbSymbol
lldbTarget
lldbUtility

LINK_COMPONENTS
Support
)
14 changes: 14 additions & 0 deletions lldb/source/Expression/CMakeLists.txt
Expand Up @@ -21,4 +21,18 @@ add_lldb_library(lldbExpression

DEPENDS
${tablegen_deps}

LINK_LIBS
lldbCore
lldbHost
lldbInterpreter
lldbSymbol
lldbTarget
lldbUtility
lldbPluginExpressionParserClang

LINK_COMPONENTS
Core
ExecutionEngine
Support
)
21 changes: 20 additions & 1 deletion lldb/source/Host/CMakeLists.txt
Expand Up @@ -55,6 +55,10 @@ add_host_subdirectory(posix
posix/ConnectionFileDescriptorPosix.cpp
)

if(NOT LLDB_DISABLE_PYTHON)
list(APPEND LLDB_PLUGINS lldbPluginScriptInterpreterPython)
endif()

if (CMAKE_SYSTEM_NAME MATCHES "Windows")
add_host_subdirectory(windows
windows/ConnectionGenericFileWindows.cpp
Expand Down Expand Up @@ -110,6 +114,7 @@ else()
macosx/cfcpp/CFCString.cpp
)


elseif (CMAKE_SYSTEM_NAME MATCHES "Linux|Android")
add_host_subdirectory(linux
linux/AbstractSocket.cpp
Expand All @@ -120,6 +125,7 @@ else()
linux/ProcessLauncherLinux.cpp
linux/ThisThread.cpp
)
list(APPEND LLDB_PLUGINS lldbPluginProcessLinux)
if (CMAKE_SYSTEM_NAME MATCHES "Android")
add_host_subdirectory(android
android/HostInfoAndroid.cpp
Expand Down Expand Up @@ -157,7 +163,20 @@ if (${get_python_libdir})
endif()
endif()

add_lldb_library(lldbHost ${HOST_SOURCES})
add_lldb_library(lldbHost
${HOST_SOURCES}

LINK_LIBS
lldbCore
lldbInterpreter
lldbSymbol
lldbTarget
lldbUtility
${LLDB_PLUGINS}

LINK_COMPONENTS
Support
)

if (CMAKE_SYSTEM_NAME MATCHES "NetBSD")
target_link_libraries(lldbHost kvm)
Expand Down
31 changes: 31 additions & 0 deletions lldb/source/Initialization/CMakeLists.txt
@@ -1,5 +1,36 @@
if ( CMAKE_SYSTEM_NAME MATCHES "Darwin" )
list(APPEND EXTRA_PLUGINS lldbPluginObjectFileMachO)
endif()

if ( CMAKE_SYSTEM_NAME MATCHES "Linux|Android|FreeBSD|NetBSD" )
list(APPEND EXTRA_PLUGINS lldbPluginProcessPOSIX)
endif()

if ( CMAKE_SYSTEM_NAME MATCHES "Windows" )
list(APPEND LLDB_USED_LIBS
lldbPluginProcessWindowsCommon
ws2_32
rpcrt4
)
endif ()

add_lldb_library(lldbInitialization
SystemInitializerCommon.cpp
SystemInitializer.cpp
SystemLifetimeManager.cpp

LINK_LIBS
lldbCore
lldbHost
lldbPluginInstructionARM
lldbPluginInstructionMIPS
lldbPluginInstructionMIPS64
lldbPluginObjectContainerBSDArchive
lldbPluginObjectContainerMachOArchive
lldbPluginObjectFileELF
lldbPluginObjectFilePECOFF
lldbPluginProcessGDBRemote
${EXTRA_PLUGINS}
LINK_COMPONENTS
Support
)
11 changes: 11 additions & 0 deletions lldb/source/Interpreter/CMakeLists.txt
Expand Up @@ -43,4 +43,15 @@ add_lldb_library(lldbInterpreter
Options.cpp
Property.cpp
ScriptInterpreter.cpp

LINK_LIBS
lldbCommands
lldbCore
lldbDataFormatters
lldbHost
lldbTarget
lldbUtility

LINK_COMPONENTS
Support
)
21 changes: 21 additions & 0 deletions lldb/source/Symbol/CMakeLists.txt
Expand Up @@ -36,4 +36,25 @@ add_lldb_library(lldbSymbol
Variable.cpp
VariableList.cpp
VerifyDecl.cpp

LINK_LIBS
clangAST
clangBasic
clangFrontend
lldbCore
lldbDataFormatters
lldbExpression
lldbHost
lldbTarget
lldbUtility
lldbPluginExpressionParserClang
lldbPluginExpressionParserGo
lldbPluginSymbolFileDWARF
lldbPluginSymbolFilePDB
lldbPluginObjectContainerBSDArchive
lldbPluginCPlusPlusLanguage
lldbPluginObjCLanguage

LINK_COMPONENTS
Support
)
16 changes: 16 additions & 0 deletions lldb/source/Target/CMakeLists.txt
Expand Up @@ -58,4 +58,20 @@ add_lldb_library(lldbTarget
ThreadSpec.cpp
UnixSignals.cpp
UnwindAssembly.cpp

LINK_LIBS
lldbBreakpoint
lldbCore
lldbExpression
lldbHost
lldbInterpreter
lldbSymbol
lldbUtility
lldbPluginExpressionParserClang
lldbPluginCPlusPlusLanguage
lldbPluginObjCLanguage
lldbPluginProcessUtility

LINK_COMPONENTS
Support
)
8 changes: 8 additions & 0 deletions lldb/source/Utility/CMakeLists.txt
Expand Up @@ -16,4 +16,12 @@ add_lldb_library(lldbUtility
StringLexer.cpp
TaskPool.cpp
UriParser.cpp

LINK_LIBS
lldbCore
lldbHost
lldbTarget

LINK_COMPONENTS
Support
)
11 changes: 4 additions & 7 deletions lldb/tools/argdumper/CMakeLists.txt
Expand Up @@ -2,12 +2,9 @@ include(${LLDB_PROJECT_ROOT}/cmake/LLDBDependencies.cmake)

add_lldb_tool(lldb-argdumper INCLUDE_IN_FRAMEWORK
argdumper.cpp
)

if (LLDB_LINKER_SUPPORTS_GROUPS)
target_link_libraries(lldb-argdumper -Wl,--start-group ${LLDB_USED_LIBS} -Wl,--end-group)
else()
target_link_libraries(lldb-argdumper ${LLDB_USED_LIBS})
endif()
llvm_config(lldb-argdumper ${LLVM_LINK_COMPONENTS})
LINK_LIBS
lldbCore
lldbUtility
)

19 changes: 13 additions & 6 deletions lldb/tools/debugserver/source/CMakeLists.txt
Expand Up @@ -33,7 +33,12 @@ if (NOT CMAKE_SYSTEM_NAME MATCHES "Darwin")
)
endif ()

add_library(lldbDebugserverCommon
if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
find_library(COCOA_LIBRARY Cocoa)
add_subdirectory(MacOSX)
endif()

add_lldb_library(lldbDebugserverCommon
debugserver.cpp
DNBArch.cpp
DNBBreakpoint.cpp
Expand All @@ -58,11 +63,13 @@ add_library(lldbDebugserverCommon
RNBSocket.cpp
SysSignal.cpp
TTYState.cpp

LINK_LIBS
lldbHost
${COCOA_LIBRARY}
)

if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
find_library(COCOA_LIBRARY Cocoa)
target_link_libraries(lldbDebugserverCommon ${COCOA_LIBRARY})
add_subdirectory(MacOSX)
endif()




16 changes: 6 additions & 10 deletions lldb/tools/debugserver/source/MacOSX/CMakeLists.txt
Expand Up @@ -28,14 +28,6 @@ add_custom_command(OUTPUT ${DEBUGSERVER_VERS_GENERATED_FILE}
${LLDB_SOURCE_DIR}/lldb.xcodeproj/project.pbxproj
)

set(DEBUGSERVER_USED_LIBS
lldbDebugserverCommon
lldbUtility
lldbDebugserverMacOSX_I386
lldbDebugserverMacOSX_X86_64
lldbDebugserverMacOSX_DarwinLog
)

add_lldb_tool(debugserver INCLUDE_IN_FRAMEWORK
HasAVX.s
CFBundle.cpp
Expand All @@ -51,6 +43,12 @@ add_lldb_tool(debugserver INCLUDE_IN_FRAMEWORK
OsLogger.cpp
${generated_mach_interfaces}
${DEBUGSERVER_VERS_GENERATED_FILE}

LINK_LIBS
lldbDebugserverCommon
lldbDebugserverMacOSX_I386
lldbDebugserverMacOSX_X86_64
lldbDebugserverMacOSX_DarwinLog
)

set_source_files_properties(
Expand All @@ -59,8 +57,6 @@ set_source_files_properties(
PROPERTIES LANGUAGE C COMPILE_FLAGS "-x assembler-with-cpp"
)

target_link_libraries(debugserver ${DEBUGSERVER_USED_LIBS})

set(LLDB_CODESIGN_IDENTITY "lldb_codesign"
CACHE STRING "Identity used for code signing. Set to empty string to skip the signing step.")
if (NOT ("${LLDB_CODESIGN_IDENTITY}" STREQUAL ""))
Expand Down
28 changes: 17 additions & 11 deletions lldb/tools/driver/CMakeLists.txt
@@ -1,8 +1,25 @@
include(${LLDB_PROJECT_ROOT}/cmake/LLDBDependencies.cmake)

if ((CMAKE_SYSTEM_NAME MATCHES "Windows") OR
(CMAKE_SYSTEM_NAME MATCHES "NetBSD" ))
# These targets do not have getopt support, so they rely on the one provided by
# liblldb. However, getopt is not a part of the liblldb interface, so we have
# to link against the constituent libraries manually. Note that this is
# extremely scary as it introduces ODR violations, and it should go away as
# soon as possible.
set(host_lib lldbHost)
endif()

add_lldb_tool(lldb
Driver.cpp
Platform.cpp

LINK_LIBS
liblldb
${host_lib}

LINK_COMPONENTS
Support
)

if ( CMAKE_SYSTEM_NAME MATCHES "Windows" )
Expand All @@ -19,16 +36,5 @@ if ( LLDB_CAN_USE_DEBUGSERVER )
add_dependencies(lldb debugserver)
endif()

target_link_libraries(lldb liblldb)
if ((CMAKE_SYSTEM_NAME MATCHES "Windows") OR
(CMAKE_SYSTEM_NAME MATCHES "NetBSD" ))
# These targets do not have getopt support, so they rely on the one provided by
# liblldb. However, getopt is not a part of the liblldb interface, so we have
# to link against the constituent libraries manually. Note that this is
# extremely scary as it introduces ODR violations, and it should go away as
# soon as possible.
target_link_libraries(lldb ${LLDB_USED_LIBS})
endif()

set_target_properties(lldb PROPERTIES VERSION ${LLDB_VERSION})

0 comments on commit 494f277

Please sign in to comment.