Author: cbieneman Date: Wed Feb 8 15:00:46 2017 New Revision: 294515 URL: http://llvm.org/viewvc/llvm-project?rev=294515&view=rev Log: [CMake] Final dependency cleanup patch!
Summary: This patch removes the over-specified dependencies from LLDBDependencies and instead relies on the dependencies as expressed in each library and tool. This also removes the library looping in favor of allowing CMake to do its thing. I've tested this patch on Darwin, and found no issues, but since linker semantics vary by system I'll also work on testing it on other platforms too. Help testing would be greatly appreciated. Reviewers: labath, zturner Subscribers: danalbert, srhines, mgorny, jgosnell, lldb-commits Differential Revision: https://reviews.llvm.org/D29352 Modified: lldb/trunk/cmake/LLDBDependencies.cmake lldb/trunk/cmake/modules/AddLLDB.cmake lldb/trunk/source/API/CMakeLists.txt lldb/trunk/source/Initialization/CMakeLists.txt lldb/trunk/source/Plugins/Process/CMakeLists.txt lldb/trunk/source/Plugins/Process/Windows/Common/CMakeLists.txt lldb/trunk/tools/intel-mpx/CMakeLists.txt lldb/trunk/tools/lldb-server/CMakeLists.txt lldb/trunk/unittests/CMakeLists.txt Modified: lldb/trunk/cmake/LLDBDependencies.cmake URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/cmake/LLDBDependencies.cmake?rev=294515&r1=294514&r2=294515&view=diff ============================================================================== --- lldb/trunk/cmake/LLDBDependencies.cmake (original) +++ lldb/trunk/cmake/LLDBDependencies.cmake Wed Feb 8 15:00:46 2017 @@ -1,152 +1,13 @@ -set( LLDB_USED_LIBS - lldbBase - lldbBreakpoint - lldbCommands - lldbDataFormatters - lldbHost - lldbCore - lldbExpression - lldbInitialization - lldbInterpreter - lldbSymbol - lldbTarget - lldbUtility - - # Plugins - lldbPluginDisassemblerLLVM - lldbPluginSymbolFileDWARF - lldbPluginSymbolFilePDB - lldbPluginSymbolFileSymtab - lldbPluginDynamicLoaderStatic - lldbPluginDynamicLoaderPosixDYLD - lldbPluginDynamicLoaderHexagonDYLD - lldbPluginDynamicLoaderWindowsDYLD - - lldbPluginCPlusPlusLanguage - lldbPluginGoLanguage - lldbPluginJavaLanguage - lldbPluginObjCLanguage - lldbPluginObjCPlusPlusLanguage - lldbPluginOCamlLanguage - - lldbPluginObjectFileELF - lldbPluginObjectFileJIT - lldbPluginSymbolVendorELF - lldbPluginObjectContainerBSDArchive - lldbPluginObjectContainerMachOArchive - lldbPluginProcessGDBRemote - lldbPluginProcessUtility - lldbPluginPlatformAndroid - lldbPluginPlatformGDB - lldbPluginPlatformFreeBSD - lldbPluginPlatformKalimba - lldbPluginPlatformLinux - lldbPluginPlatformNetBSD - lldbPluginPlatformPOSIX - lldbPluginPlatformWindows - lldbPluginObjectContainerMachOArchive - lldbPluginObjectContainerBSDArchive - lldbPluginPlatformMacOSX - lldbPluginStructuredDataDarwinLog - lldbPluginDynamicLoaderMacOSXDYLD - lldbPluginUnwindAssemblyInstEmulation - lldbPluginUnwindAssemblyX86 - lldbPluginAppleObjCRuntime - lldbPluginRenderScriptRuntime - lldbPluginLanguageRuntimeGo - lldbPluginLanguageRuntimeJava - lldbPluginCXXItaniumABI - lldbPluginABIMacOSX_arm - lldbPluginABIMacOSX_arm64 - lldbPluginABIMacOSX_i386 - lldbPluginABISysV_arm - lldbPluginABISysV_arm64 - lldbPluginABISysV_i386 - lldbPluginABISysV_x86_64 - lldbPluginABISysV_hexagon - lldbPluginABISysV_ppc - lldbPluginABISysV_ppc64 - lldbPluginABISysV_mips - lldbPluginABISysV_mips64 - lldbPluginABISysV_s390x - lldbPluginInstructionARM - lldbPluginInstructionARM64 - lldbPluginInstructionMIPS - lldbPluginInstructionMIPS64 - lldbPluginObjectFilePECOFF - lldbPluginOSGo - lldbPluginOSPython - lldbPluginMemoryHistoryASan - lldbPluginInstrumentationRuntimeAddressSanitizer - lldbPluginInstrumentationRuntimeThreadSanitizer - lldbPluginSystemRuntimeMacOSX - lldbPluginProcessElfCore - lldbPluginProcessMinidump - lldbPluginJITLoaderGDB - lldbPluginExpressionParserClang - lldbPluginExpressionParserGo - ) +set(LLDB_SYSTEM_LIBS) # Windows-only libraries if ( CMAKE_SYSTEM_NAME MATCHES "Windows" ) - list(APPEND LLDB_USED_LIBS - lldbPluginProcessWindowsCommon + list(APPEND LLDB_SYSTEM_LIBS ws2_32 rpcrt4 ) endif () -# Linux-only libraries -if ( CMAKE_SYSTEM_NAME MATCHES "Linux|Android" ) - list(APPEND LLDB_USED_LIBS - lldbPluginProcessLinux - lldbPluginProcessPOSIX - ) -endif () - -# FreeBSD-only libraries -if ( CMAKE_SYSTEM_NAME MATCHES "FreeBSD" ) - list(APPEND LLDB_USED_LIBS - lldbPluginProcessFreeBSD - lldbPluginProcessPOSIX - ) -endif () - -# NetBSD-only libraries -if ( CMAKE_SYSTEM_NAME MATCHES "NetBSD" ) - list(APPEND LLDB_USED_LIBS - lldbPluginProcessPOSIX - ) -endif () - -# Darwin-only libraries -if ( CMAKE_SYSTEM_NAME MATCHES "Darwin" ) - list(APPEND LLDB_USED_LIBS - lldbPluginDynamicLoaderDarwinKernel - lldbPluginObjectFileMachO - lldbPluginProcessMachCore - lldbPluginProcessMacOSXKernel - lldbPluginSymbolVendorMacOSX - ) -endif() - -set( CLANG_USED_LIBS - clangAnalysis - clangAST - clangBasic - clangCodeGen - clangDriver - clangEdit - clangFrontend - clangLex - clangParse - clangRewrite - clangRewriteFrontend - clangSema - clangSerialization - ) - -set(LLDB_SYSTEM_LIBS) if (NOT LLDB_DISABLE_LIBEDIT) list(APPEND LLDB_SYSTEM_LIBS edit) endif() @@ -178,29 +39,6 @@ if (LLVM_BUILD_STATIC) endif() endif() -set(LLVM_LINK_COMPONENTS - ${LLVM_TARGETS_TO_BUILD} - interpreter - asmparser - bitreader - bitwriter - codegen - demangle - ipo - selectiondag - bitreader - mc - mcjit - core - mcdisassembler - executionengine - runtimedyld - option - support - coverage - target - ) - if ( NOT LLDB_DISABLE_PYTHON ) set_source_files_properties(${LLDB_WRAP_PYTHON} PROPERTIES GENERATED 1) if (CLANG_CL) Modified: lldb/trunk/cmake/modules/AddLLDB.cmake URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/cmake/modules/AddLLDB.cmake?rev=294515&r1=294514&r2=294515&view=diff ============================================================================== --- lldb/trunk/cmake/modules/AddLLDB.cmake (original) +++ lldb/trunk/cmake/modules/AddLLDB.cmake Wed Feb 8 15:00:46 2017 @@ -1,22 +1,3 @@ -function(lldb_link_common_libs name targetkind) - if (NOT LLDB_USED_LIBS) - return() - endif() - - if(${targetkind} MATCHES "SHARED") - set(LINK_KEYWORD PRIVATE) - endif() - - if(${targetkind} MATCHES "SHARED" OR ${targetkind} MATCHES "EXE") - if (LLDB_LINKER_SUPPORTS_GROUPS) - target_link_libraries(${name} ${LINK_KEYWORD} - -Wl,--start-group ${LLDB_USED_LIBS} -Wl,--end-group) - else() - target_link_libraries(${name} ${LINK_KEYWORD} ${LLDB_USED_LIBS}) - endif() - endif() -endfunction(lldb_link_common_libs) - function(add_lldb_library name) # only supported parameters to this macro are the optional # MODULE;SHARED;STATIC library type and source files @@ -61,17 +42,7 @@ function(add_lldb_library name) if (PARAM_OBJECT) add_library(${name} ${libkind} ${srcs}) else() - if (PARAM_SHARED AND LLDB_LINKER_SUPPORTS_GROUPS) - set(start_group -Wl,--start-group) - set(end_group -Wl,--end-group) - endif() llvm_add_library(${name} ${libkind} ${srcs} LINK_LIBS - ${start_group} - ${LLDB_USED_LIBS} - ${end_group} - ${start_group} - ${CLANG_USED_LIBS} - ${end_group} ${PARAM_LINK_LIBS} DEPENDS ${PARAM_DEPENDS}) Modified: lldb/trunk/source/API/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/CMakeLists.txt?rev=294515&r1=294514&r2=294515&view=diff ============================================================================== --- lldb/trunk/source/API/CMakeLists.txt (original) +++ lldb/trunk/source/API/CMakeLists.txt Wed Feb 8 15:00:46 2017 @@ -16,6 +16,8 @@ if (LLDB_BUILD_FRAMEWORK AND NOT APPLE) message(FATAL_ERROR "LLDB.framework cannot be generated unless targeting Apple platforms.") endif() +get_property(LLDB_ALL_PLUGINS GLOBAL PROPERTY LLDB_PLUGINS) + add_lldb_library(liblldb SHARED SBAddress.cpp SBAttachInfo.cpp @@ -80,6 +82,21 @@ add_lldb_library(liblldb SHARED SBUnixSignals.cpp SystemInitializerFull.cpp ${LLDB_WRAP_PYTHON} + + LINK_LIBS + lldbBase + lldbBreakpoint + lldbCore + lldbDataFormatters + lldbExpression + lldbHost + lldbInitialization + lldbInterpreter + lldbSymbol + lldbTarget + ${LLDB_ALL_PLUGINS} + LINK_COMPONENTS + Support ) if (LLVM_ENABLE_WERROR) Modified: lldb/trunk/source/Initialization/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Initialization/CMakeLists.txt?rev=294515&r1=294514&r2=294515&view=diff ============================================================================== --- lldb/trunk/source/Initialization/CMakeLists.txt (original) +++ lldb/trunk/source/Initialization/CMakeLists.txt Wed Feb 8 15:00:46 2017 @@ -7,11 +7,7 @@ if ( CMAKE_SYSTEM_NAME MATCHES "Linux|An endif() if ( CMAKE_SYSTEM_NAME MATCHES "Windows" ) - list(APPEND LLDB_USED_LIBS - lldbPluginProcessWindowsCommon - ws2_32 - rpcrt4 - ) + list(APPEND EXTRA_PLUGINS lldbPluginProcessWindowsCommon) endif () add_lldb_library(lldbInitialization @@ -31,6 +27,7 @@ add_lldb_library(lldbInitialization lldbPluginObjectFilePECOFF lldbPluginProcessGDBRemote ${EXTRA_PLUGINS} + ${LLDB_SYSTEM_LIBS} LINK_COMPONENTS Support ) Modified: lldb/trunk/source/Plugins/Process/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/CMakeLists.txt?rev=294515&r1=294514&r2=294515&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/CMakeLists.txt (original) +++ lldb/trunk/source/Plugins/Process/CMakeLists.txt Wed Feb 8 15:00:46 2017 @@ -10,9 +10,9 @@ elseif (CMAKE_SYSTEM_NAME MATCHES "Windo add_subdirectory(Windows/Common) elseif (CMAKE_SYSTEM_NAME MATCHES "Darwin") add_subdirectory(MacOSX-Kernel) + add_subdirectory(mach-core) endif() add_subdirectory(gdb-remote) add_subdirectory(Utility) -add_subdirectory(mach-core) add_subdirectory(elf-core) add_subdirectory(minidump) Modified: lldb/trunk/source/Plugins/Process/Windows/Common/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Windows/Common/CMakeLists.txt?rev=294515&r1=294514&r2=294515&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Windows/Common/CMakeLists.txt (original) +++ lldb/trunk/source/Plugins/Process/Windows/Common/CMakeLists.txt Wed Feb 8 15:00:46 2017 @@ -28,6 +28,8 @@ add_lldb_library(lldbPluginProcessWindow lldbHost lldbInterpreter lldbTarget + ws2_32 + rpcrt4 LINK_COMPONENTS Support ) Modified: lldb/trunk/tools/intel-mpx/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/intel-mpx/CMakeLists.txt?rev=294515&r1=294514&r2=294515&view=diff ============================================================================== --- lldb/trunk/tools/intel-mpx/CMakeLists.txt (original) +++ lldb/trunk/tools/intel-mpx/CMakeLists.txt Wed Feb 8 15:00:46 2017 @@ -8,16 +8,8 @@ add_library(lldb-intel-mpxtable SHARED IntelMPXTablePlugin.cpp ) -target_link_libraries(lldb-intel-mpxtable PUBLIC liblldb) - -if (LLDB_LINKER_SUPPORTS_GROUPS) - target_link_libraries(lldb-intel-mpxtable PUBLIC - -Wl,--start-group ${LLDB_USED_LIBS} -Wl,--end-group) -else() - target_link_libraries(lldb-intel-mpxtable PUBLIC ${LLDB_USED_LIBS}) -endif() -llvm_config(lldb-intel-mpxtable ${LLVM_LINK_COMPONENTS}) - +target_link_libraries(lldb-intel-mpxtable + PUBLIC liblldb LLVMSupport) install(TARGETS lldb-intel-mpxtable LIBRARY DESTINATION bin) Modified: lldb/trunk/tools/lldb-server/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-server/CMakeLists.txt?rev=294515&r1=294514&r2=294515&view=diff ============================================================================== --- lldb/trunk/tools/lldb-server/CMakeLists.txt (original) +++ lldb/trunk/tools/lldb-server/CMakeLists.txt Wed Feb 8 15:00:46 2017 @@ -23,90 +23,6 @@ endif () include_directories(../../source) - -set( LLDB_USED_LIBS - lldbBase - lldbBreakpoint - lldbCommands - lldbDataFormatters - lldbHost - lldbCore - lldbExpression - lldbInitialization - lldbInterpreter - lldbSymbol - lldbTarget - lldbUtility - - # Plugins - lldbPluginDisassemblerLLVM - lldbPluginSymbolFileDWARF - lldbPluginSymbolFilePDB - lldbPluginSymbolFileSymtab - lldbPluginDynamicLoaderPosixDYLD - - lldbPluginCPlusPlusLanguage - lldbPluginGoLanguage - lldbPluginJavaLanguage - lldbPluginObjCLanguage - lldbPluginObjCPlusPlusLanguage - lldbPluginOCamlLanguage - - lldbPluginObjectFileELF - lldbPluginObjectFileJIT - lldbPluginSymbolVendorELF - lldbPluginPlatformPOSIX - lldbPluginObjectContainerBSDArchive - lldbPluginObjectContainerMachOArchive - lldbPluginProcessGDBRemote - lldbPluginProcessUtility - lldbPluginObjectContainerMachOArchive - lldbPluginObjectContainerBSDArchive - lldbPluginPlatformMacOSX - lldbPluginUnwindAssemblyInstEmulation - lldbPluginUnwindAssemblyX86 - lldbPluginAppleObjCRuntime - lldbPluginCXXItaniumABI - lldbPluginInstructionARM - lldbPluginInstructionARM64 - lldbPluginInstructionMIPS - lldbPluginInstructionMIPS64 - lldbPluginObjectFilePECOFF - lldbPluginExpressionParserClang - lldbPluginExpressionParserGo - ) - -# Linux-only libraries -if ( CMAKE_SYSTEM_NAME MATCHES "Linux|Android" ) - list(APPEND LLDB_USED_LIBS - lldbPluginProcessLinux - lldbPluginProcessPOSIX - ) -endif () - -# Darwin-only libraries -if ( CMAKE_SYSTEM_NAME MATCHES "Darwin" ) - list(APPEND LLDB_USED_LIBS - lldbPluginObjectFileMachO - ) -endif() - -set( CLANG_USED_LIBS - clangAnalysis - clangAST - clangBasic - clangCodeGen - clangDriver - clangEdit - clangFrontend - clangLex - clangParse - clangRewrite - clangRewriteFrontend - clangSema - clangSerialization - ) - set(LLDB_SYSTEM_LIBS) if (NOT LLDB_DISABLE_LIBEDIT) list(APPEND LLDB_SYSTEM_LIBS edit) @@ -142,53 +58,24 @@ if (LLVM_BUILD_STATIC) endif() endif() -set(LLVM_LINK_COMPONENTS - ${LLVM_TARGETS_TO_BUILD} - interpreter - asmparser - bitreader - bitwriter - codegen - demangle - ipo - selectiondag - bitreader - mc - mcjit - core - mcdisassembler - executionengine - runtimedyld - option - support - coverage - target - ) - add_lldb_tool(lldb-server INCLUDE_IN_FRAMEWORK Acceptor.cpp lldb-gdbserver.cpp lldb-platform.cpp lldb-server.cpp LLDBServerUtilities.cpp -) -# The Darwin linker doesn't understand --start-group/--end-group. -if (LLDB_LINKER_SUPPORTS_GROUPS) - target_link_libraries(lldb-server - -Wl,--start-group ${LLDB_USED_LIBS} -Wl,--end-group) - target_link_libraries(lldb-server - -Wl,--start-group ${CLANG_USED_LIBS} -Wl,--end-group) -else() - target_link_libraries(lldb-server ${LLDB_USED_LIBS}) - target_link_libraries(lldb-server ${CLANG_USED_LIBS}) -endif() -if(NOT LLVM_LINK_LLVM_DYLIB) - # This is necessary in !LLVM_LINK_LLVM_DYLIB as LLDB's libs do not track their - # dependencies properly. It is conditional because in a LLVM_LINK_LLVM_DYLIB - # build it would introduce duplicate symbols (add_lldb_tool links to libLLVM, - # and this would add the individual .a files as well). - llvm_config(lldb-server ${LLVM_LINK_COMPONENTS}) -endif() + LINK_LIBS + lldbBase + lldbCore + lldbHost + lldbInitialization + lldbInterpreter + ${EXTRA_LLDB_LIBS} + ${LLDB_SYSTEM_LIBS} + + LINK_COMPONENTS + Support +) target_link_libraries(lldb-server ${LLDB_SYSTEM_LIBS}) Modified: lldb/trunk/unittests/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/CMakeLists.txt?rev=294515&r1=294514&r2=294515&view=diff ============================================================================== --- lldb/trunk/unittests/CMakeLists.txt (original) +++ lldb/trunk/unittests/CMakeLists.txt Wed Feb 8 15:00:46 2017 @@ -39,7 +39,6 @@ function(add_lldb_unittest test_name) POST_BUILD COMMAND "${CMAKE_COMMAND}" -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/Inputs) - lldb_link_common_libs(${test_name} EXE) target_link_libraries(${test_name} ${ARG_LINK_LIBS} ${CLANG_USED_LIBS} ${LLDB_SYSTEM_LIBS}) endfunction() _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits