[Lldb-commits] [lldb] r373734 - [lldb] [cmake] Support linking against clang-cpp dylib

Michal Gorny via lldb-commits lldb-commits at lists.llvm.org
Fri Oct 4 05:03:04 PDT 2019


Author: mgorny
Date: Fri Oct  4 05:03:03 2019
New Revision: 373734

URL: http://llvm.org/viewvc/llvm-project?rev=373734&view=rev
Log:
[lldb] [cmake] Support linking against clang-cpp dylib

Link against clang-cpp dylib rather than split libs when
CLANG_LINK_CLANG_DYLIB is enabled.

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

Modified:
    lldb/trunk/cmake/modules/AddLLDB.cmake
    lldb/trunk/source/Core/CMakeLists.txt
    lldb/trunk/source/Plugins/ExpressionParser/Clang/CMakeLists.txt
    lldb/trunk/source/Plugins/Language/ObjC/CMakeLists.txt
    lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/CMakeLists.txt
    lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/CMakeLists.txt
    lldb/trunk/source/Plugins/Platform/MacOSX/CMakeLists.txt
    lldb/trunk/source/Plugins/SymbolFile/DWARF/CMakeLists.txt
    lldb/trunk/source/Plugins/SymbolFile/NativePDB/CMakeLists.txt
    lldb/trunk/source/Plugins/SymbolFile/PDB/CMakeLists.txt
    lldb/trunk/source/Symbol/CMakeLists.txt
    lldb/trunk/tools/lldb-instr/CMakeLists.txt

Modified: lldb/trunk/cmake/modules/AddLLDB.cmake
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/cmake/modules/AddLLDB.cmake?rev=373734&r1=373733&r2=373734&view=diff
==============================================================================
--- lldb/trunk/cmake/modules/AddLLDB.cmake (original)
+++ lldb/trunk/cmake/modules/AddLLDB.cmake Fri Oct  4 05:03:03 2019
@@ -37,7 +37,7 @@ function(add_lldb_library name)
   cmake_parse_arguments(PARAM
     "MODULE;SHARED;STATIC;OBJECT;PLUGIN"
     "INSTALL_PREFIX;ENTITLEMENTS"
-    "EXTRA_CXXFLAGS;DEPENDS;LINK_LIBS;LINK_COMPONENTS"
+    "EXTRA_CXXFLAGS;DEPENDS;LINK_LIBS;LINK_COMPONENTS;CLANG_LIBS"
     ${ARGN})
   llvm_process_sources(srcs ${PARAM_UNPARSED_ARGUMENTS})
   list(APPEND LLVM_LINK_COMPONENTS ${PARAM_LINK_COMPONENTS})
@@ -91,6 +91,12 @@ function(add_lldb_library name)
       ${pass_ENTITLEMENTS}
       ${pass_NO_INSTALL_RPATH}
     )
+
+    if(CLANG_LINK_CLANG_DYLIB)
+      target_link_libraries(${name} PRIVATE clang-cpp)
+    else()
+      target_link_libraries(${name} PRIVATE ${PARAM_CLANG_LIBS})
+    endif()
   endif()
 
   if(PARAM_SHARED)
@@ -136,7 +142,7 @@ function(add_lldb_executable name)
   cmake_parse_arguments(ARG
     "GENERATE_INSTALL"
     "INSTALL_PREFIX;ENTITLEMENTS"
-    "LINK_LIBS;LINK_COMPONENTS"
+    "LINK_LIBS;CLANG_LIBS;LINK_COMPONENTS"
     ${ARGN}
     )
 
@@ -156,6 +162,11 @@ function(add_lldb_executable name)
   )
 
   target_link_libraries(${name} PRIVATE ${ARG_LINK_LIBS})
+  if(CLANG_LINK_CLANG_DYLIB)
+    target_link_libraries(${name} PRIVATE clang-cpp)
+  else()
+    target_link_libraries(${name} PRIVATE ${ARG_CLANG_LIBS})
+  endif()
   set_target_properties(${name} PROPERTIES FOLDER "lldb executables")
 
   if(ARG_GENERATE_INSTALL)

Modified: lldb/trunk/source/Core/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/CMakeLists.txt?rev=373734&r1=373733&r2=373734&view=diff
==============================================================================
--- lldb/trunk/source/Core/CMakeLists.txt (original)
+++ lldb/trunk/source/Core/CMakeLists.txt Fri Oct  4 05:03:03 2019
@@ -69,7 +69,6 @@ add_lldb_library(lldbCore
     clang-tablegen-targets
 
   LINK_LIBS
-    clangDriver
     lldbBreakpoint
     lldbDataFormatters
     lldbExpression
@@ -82,6 +81,9 @@ add_lldb_library(lldbCore
     lldbPluginObjCLanguage
     ${LLDB_CURSES_LIBS}
 
+  CLANG_LIBS
+    clangDriver
+
   LINK_COMPONENTS
     Support
     Demangle

Modified: lldb/trunk/source/Plugins/ExpressionParser/Clang/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ExpressionParser/Clang/CMakeLists.txt?rev=373734&r1=373733&r2=373734&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ExpressionParser/Clang/CMakeLists.txt (original)
+++ lldb/trunk/source/Plugins/ExpressionParser/Clang/CMakeLists.txt Fri Oct  4 05:03:03 2019
@@ -27,6 +27,16 @@ add_lldb_library(lldbPluginExpressionPar
   ${tablegen_deps}
 
   LINK_LIBS
+    lldbCore
+    lldbExpression
+    lldbHost
+    lldbInterpreter
+    lldbSymbol
+    lldbTarget
+    lldbUtility
+    lldbPluginCPlusPlusLanguage
+    lldbPluginCPPRuntime
+  CLANG_LIBS
     clangAST
     clangCodeGen
     clangDriver
@@ -38,15 +48,6 @@ add_lldb_library(lldbPluginExpressionPar
     clangRewriteFrontend
     clangSema
     clangSerialization
-    lldbCore
-    lldbExpression
-    lldbHost
-    lldbInterpreter
-    lldbSymbol
-    lldbTarget
-    lldbUtility
-    lldbPluginCPlusPlusLanguage
-    lldbPluginCPPRuntime
   LINK_COMPONENTS
     Core
     ExecutionEngine

Modified: lldb/trunk/source/Plugins/Language/ObjC/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/ObjC/CMakeLists.txt?rev=373734&r1=373733&r2=373734&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Language/ObjC/CMakeLists.txt (original)
+++ lldb/trunk/source/Plugins/Language/ObjC/CMakeLists.txt Fri Oct  4 05:03:03 2019
@@ -22,7 +22,6 @@ add_lldb_library(lldbPluginObjCLanguage
   NSString.cpp
 
   LINK_LIBS
-    clangAST
     lldbCore
     lldbDataFormatters
     lldbExpression
@@ -32,6 +31,8 @@ add_lldb_library(lldbPluginObjCLanguage
     lldbUtility
     lldbPluginAppleObjCRuntime
     lldbPluginClangCommon
+  CLANG_LIBS
+    clangAST
 
   EXTRA_CXXFLAGS ${EXTRA_CXXFLAGS}
 )

Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/CMakeLists.txt?rev=373734&r1=373733&r2=373734&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/CMakeLists.txt (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/CMakeLists.txt Fri Oct  4 05:03:03 2019
@@ -9,7 +9,6 @@ add_lldb_library(lldbPluginAppleObjCRunt
   AppleObjCTypeEncodingParser.cpp
 
   LINK_LIBS
-    clangAST
     lldbBreakpoint
     lldbCore
     lldbExpression
@@ -20,6 +19,8 @@ add_lldb_library(lldbPluginAppleObjCRunt
     lldbUtility
     lldbPluginExpressionParserClang
     lldbPluginCPPRuntime
+  CLANG_LIBS
+    clangAST
   LINK_COMPONENTS
     Support
   )

Modified: lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/CMakeLists.txt?rev=373734&r1=373733&r2=373734&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/CMakeLists.txt (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/CMakeLists.txt Fri Oct  4 05:03:03 2019
@@ -13,7 +13,6 @@ add_lldb_library(lldbPluginRenderScriptR
   ${tablegen_deps}
 
   LINK_LIBS
-    clangBasic
     lldbBreakpoint
     lldbCore
     lldbDataFormatters
@@ -22,6 +21,8 @@ add_lldb_library(lldbPluginRenderScriptR
     lldbInterpreter
     lldbSymbol
     lldbTarget
+  CLANG_LIBS
+    clangBasic
   LINK_COMPONENTS
     Core
     IRReader

Modified: lldb/trunk/source/Plugins/Platform/MacOSX/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/CMakeLists.txt?rev=373734&r1=373733&r2=373734&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/MacOSX/CMakeLists.txt (original)
+++ lldb/trunk/source/Plugins/Platform/MacOSX/CMakeLists.txt Fri Oct  4 05:03:03 2019
@@ -39,7 +39,6 @@ add_lldb_library(lldbPluginPlatformMacOS
   ${PLUGIN_PLATFORM_MACOSX_SOURCES}
 
   LINK_LIBS
-    clangBasic
     lldbBreakpoint
     lldbCore
     lldbHost
@@ -49,6 +48,8 @@ add_lldb_library(lldbPluginPlatformMacOS
     lldbUtility
     lldbPluginPlatformPOSIX
     ${OBJC_LIBS}
+  CLANG_LIBS
+    clangBasic
   LINK_COMPONENTS
     Support
     )

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/CMakeLists.txt?rev=373734&r1=373733&r2=373734&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/CMakeLists.txt (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/CMakeLists.txt Fri Oct  4 05:03:03 2019
@@ -43,8 +43,6 @@ add_lldb_library(lldbPluginSymbolFileDWA
   UniqueDWARFASTType.cpp
 
   LINK_LIBS
-    clangAST
-    clangBasic
     lldbCore
     lldbExpression
     lldbHost
@@ -55,6 +53,9 @@ add_lldb_library(lldbPluginSymbolFileDWA
     lldbPluginObjCLanguage
     lldbPluginCPlusPlusLanguage
     lldbPluginExpressionParserClang
+  CLANG_LIBS
+    clangAST
+    clangBasic
   LINK_COMPONENTS
     DebugInfoDWARF
     Support

Modified: lldb/trunk/source/Plugins/SymbolFile/NativePDB/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/NativePDB/CMakeLists.txt?rev=373734&r1=373733&r2=373734&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/NativePDB/CMakeLists.txt (original)
+++ lldb/trunk/source/Plugins/SymbolFile/NativePDB/CMakeLists.txt Fri Oct  4 05:03:03 2019
@@ -11,11 +11,12 @@ add_lldb_library(lldbPluginSymbolFileNat
   UdtRecordCompleter.cpp
 
   LINK_LIBS
-    clangAST
-    clangLex
     lldbCore
     lldbSymbol
     lldbUtility
+  CLANG_LIBS
+    clangAST
+    clangLex
   LINK_COMPONENTS
     DebugInfoCodeView
     DebugInfoPDB

Modified: lldb/trunk/source/Plugins/SymbolFile/PDB/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/PDB/CMakeLists.txt?rev=373734&r1=373733&r2=373734&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/PDB/CMakeLists.txt (original)
+++ lldb/trunk/source/Plugins/SymbolFile/PDB/CMakeLists.txt Fri Oct  4 05:03:03 2019
@@ -4,12 +4,13 @@ add_lldb_library(lldbPluginSymbolFilePDB
   SymbolFilePDB.cpp
 
   LINK_LIBS
-    clangAST
-    clangLex
     lldbCore
+    lldbPluginSymbolFileNativePDB
     lldbSymbol
     lldbUtility
-  lldbPluginSymbolFileNativePDB
+  CLANG_LIBS
+    clangAST
+    clangLex
   LINK_COMPONENTS
     DebugInfoPDB
     Support

Modified: lldb/trunk/source/Symbol/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/CMakeLists.txt?rev=373734&r1=373733&r2=373734&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/CMakeLists.txt (original)
+++ lldb/trunk/source/Symbol/CMakeLists.txt Fri Oct  4 05:03:03 2019
@@ -46,9 +46,6 @@ add_lldb_library(lldbSymbol
   ${PLATFORM_SOURCES}
 
   LINK_LIBS
-    clangAST
-    clangBasic
-    clangFrontend
     lldbCore
     lldbExpression
     lldbHost
@@ -60,6 +57,11 @@ add_lldb_library(lldbSymbol
     lldbPluginObjCLanguage
     lldbPluginObjCRuntime
 
+  CLANG_LIBS
+    clangAST
+    clangBasic
+    clangFrontend
+
   LINK_COMPONENTS
     Support
   )

Modified: lldb/trunk/tools/lldb-instr/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-instr/CMakeLists.txt?rev=373734&r1=373733&r2=373734&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-instr/CMakeLists.txt (original)
+++ lldb/trunk/tools/lldb-instr/CMakeLists.txt Fri Oct  4 05:03:03 2019
@@ -1,7 +1,7 @@
 add_lldb_tool(lldb-instr
   Instrument.cpp
 
-  LINK_LIBS
+  CLANG_LIBS
     clangAST
     clangBasic
     clangCodeGen




More information about the lldb-commits mailing list