[lldb] [cmake] Support linking against clang-cpp dylib
authorMichal Gorny <mgorny@gentoo.org>
Fri, 4 Oct 2019 12:03:03 +0000 (12:03 +0000)
committerMichal Gorny <mgorny@gentoo.org>
Fri, 4 Oct 2019 12:03:03 +0000 (12:03 +0000)
Link against clang-cpp dylib rather than split libs when
CLANG_LINK_CLANG_DYLIB is enabled.

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

llvm-svn: 373734

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

index a0b007c..c6a7979 100644 (file)
@@ -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)
index e45b5e7..f3ce87a 100644 (file)
@@ -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
index b114ce7..81d9166 100644 (file)
@@ -27,6 +27,16 @@ add_lldb_library(lldbPluginExpressionParserClang PLUGIN
   ${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(lldbPluginExpressionParserClang PLUGIN
     clangRewriteFrontend
     clangSema
     clangSerialization
-    lldbCore
-    lldbExpression
-    lldbHost
-    lldbInterpreter
-    lldbSymbol
-    lldbTarget
-    lldbUtility
-    lldbPluginCPlusPlusLanguage
-    lldbPluginCPPRuntime
   LINK_COMPONENTS
     Core
     ExecutionEngine
index afb68d4..ebb96c2 100644 (file)
@@ -22,7 +22,6 @@ add_lldb_library(lldbPluginObjCLanguage PLUGIN
   NSString.cpp
 
   LINK_LIBS
-    clangAST
     lldbCore
     lldbDataFormatters
     lldbExpression
@@ -32,6 +31,8 @@ add_lldb_library(lldbPluginObjCLanguage PLUGIN
     lldbUtility
     lldbPluginAppleObjCRuntime
     lldbPluginClangCommon
+  CLANG_LIBS
+    clangAST
 
   EXTRA_CXXFLAGS ${EXTRA_CXXFLAGS}
 )
index 29d9ba1..bcf3240 100644 (file)
@@ -9,7 +9,6 @@ add_lldb_library(lldbPluginAppleObjCRuntime PLUGIN
   AppleObjCTypeEncodingParser.cpp
 
   LINK_LIBS
-    clangAST
     lldbBreakpoint
     lldbCore
     lldbExpression
@@ -20,6 +19,8 @@ add_lldb_library(lldbPluginAppleObjCRuntime PLUGIN
     lldbUtility
     lldbPluginExpressionParserClang
     lldbPluginCPPRuntime
+  CLANG_LIBS
+    clangAST
   LINK_COMPONENTS
     Support
   )
index 1a6c499..c122e09 100644 (file)
@@ -13,7 +13,6 @@ add_lldb_library(lldbPluginRenderScriptRuntime PLUGIN
   ${tablegen_deps}
 
   LINK_LIBS
-    clangBasic
     lldbBreakpoint
     lldbCore
     lldbDataFormatters
@@ -22,6 +21,8 @@ add_lldb_library(lldbPluginRenderScriptRuntime PLUGIN
     lldbInterpreter
     lldbSymbol
     lldbTarget
+  CLANG_LIBS
+    clangBasic
   LINK_COMPONENTS
     Core
     IRReader
index 49084dc..d5a84d8 100644 (file)
@@ -39,7 +39,6 @@ add_lldb_library(lldbPluginPlatformMacOSX PLUGIN
   ${PLUGIN_PLATFORM_MACOSX_SOURCES}
 
   LINK_LIBS
-    clangBasic
     lldbBreakpoint
     lldbCore
     lldbHost
@@ -49,6 +48,8 @@ add_lldb_library(lldbPluginPlatformMacOSX PLUGIN
     lldbUtility
     lldbPluginPlatformPOSIX
     ${OBJC_LIBS}
+  CLANG_LIBS
+    clangBasic
   LINK_COMPONENTS
     Support
     )
index 1107e53..4a3bc81 100644 (file)
@@ -43,8 +43,6 @@ add_lldb_library(lldbPluginSymbolFileDWARF PLUGIN
   UniqueDWARFASTType.cpp
 
   LINK_LIBS
-    clangAST
-    clangBasic
     lldbCore
     lldbExpression
     lldbHost
@@ -55,6 +53,9 @@ add_lldb_library(lldbPluginSymbolFileDWARF PLUGIN
     lldbPluginObjCLanguage
     lldbPluginCPlusPlusLanguage
     lldbPluginExpressionParserClang
+  CLANG_LIBS
+    clangAST
+    clangBasic
   LINK_COMPONENTS
     DebugInfoDWARF
     Support
index 52b431d..aaecec4 100644 (file)
@@ -11,11 +11,12 @@ add_lldb_library(lldbPluginSymbolFileNativePDB PLUGIN
   UdtRecordCompleter.cpp
 
   LINK_LIBS
-    clangAST
-    clangLex
     lldbCore
     lldbSymbol
     lldbUtility
+  CLANG_LIBS
+    clangAST
+    clangLex
   LINK_COMPONENTS
     DebugInfoCodeView
     DebugInfoPDB
index 64168d0..79bdce4 100644 (file)
@@ -4,12 +4,13 @@ add_lldb_library(lldbPluginSymbolFilePDB PLUGIN
   SymbolFilePDB.cpp
 
   LINK_LIBS
-    clangAST
-    clangLex
     lldbCore
+    lldbPluginSymbolFileNativePDB
     lldbSymbol
     lldbUtility
-  lldbPluginSymbolFileNativePDB
+  CLANG_LIBS
+    clangAST
+    clangLex
   LINK_COMPONENTS
     DebugInfoPDB
     Support
index 42ae414..ead43ac 100644 (file)
@@ -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
   )
index e3dbeba..8da453b 100644 (file)
@@ -1,7 +1,7 @@
 add_lldb_tool(lldb-instr
   Instrument.cpp
 
-  LINK_LIBS
+  CLANG_LIBS
     clangAST
     clangBasic
     clangCodeGen