[clang-tools-extra] f726101 - [clangd] Fix shared-lib builds

Kadir Cetinkaya via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 24 04:05:39 PST 2020


Author: Kadir Cetinkaya
Date: 2020-11-24T13:05:20+01:00
New Revision: f726101b6240a6740b3c0926af759da5e7336f8a

URL: https://github.com/llvm/llvm-project/commit/f726101b6240a6740b3c0926af759da5e7336f8a
DIFF: https://github.com/llvm/llvm-project/commit/f726101b6240a6740b3c0926af759da5e7336f8a.diff

LOG: [clangd] Fix shared-lib builds

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

Added: 
    

Modified: 
    clang-tools-extra/clangd/CMakeLists.txt
    clang-tools-extra/clangd/index/remote/CMakeLists.txt
    clang-tools-extra/clangd/index/remote/marshalling/CMakeLists.txt
    clang-tools-extra/clangd/index/remote/server/CMakeLists.txt
    clang-tools-extra/clangd/unittests/CMakeLists.txt
    llvm/cmake/modules/FindGRPC.cmake

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/clangd/CMakeLists.txt b/clang-tools-extra/clangd/CMakeLists.txt
index b8300ddaf548..2ce5d31e623e 100644
--- a/clang-tools-extra/clangd/CMakeLists.txt
+++ b/clang-tools-extra/clangd/CMakeLists.txt
@@ -168,17 +168,18 @@ if ( CLANGD_BUILD_XPC )
   add_subdirectory(xpc)
 endif ()
 
+if (CLANGD_ENABLE_REMOTE)
+  include(FindGRPC)
+endif()
+
 if(CLANG_INCLUDE_TESTS)
-add_subdirectory(test)
-add_subdirectory(unittests)
+  add_subdirectory(test)
+  add_subdirectory(unittests)
 endif()
 
 # FIXME(kirillbobyrev): Document this in the LLVM docs once remote index is stable.
 option(CLANGD_ENABLE_REMOTE "Use gRPC library to enable remote index support for Clangd" OFF)
 set(GRPC_INSTALL_PATH "" CACHE PATH "Path to gRPC library manual installation.")
 
-if (CLANGD_ENABLE_REMOTE)
-  include(FindGRPC)
-endif()
 add_subdirectory(index/remote)
 add_subdirectory(index/dex/dexp)

diff  --git a/clang-tools-extra/clangd/index/remote/CMakeLists.txt b/clang-tools-extra/clangd/index/remote/CMakeLists.txt
index 8625fa8f351e..eaa000b745e5 100644
--- a/clang-tools-extra/clangd/index/remote/CMakeLists.txt
+++ b/clang-tools-extra/clangd/index/remote/CMakeLists.txt
@@ -3,6 +3,12 @@ if (CLANGD_ENABLE_REMOTE)
   generate_protos(RemoteIndexServiceProto "Service.proto"
     DEPENDS "Index.proto"
     GRPC)
+  # FIXME: Move this into generate_protos. Currently we only mention proto
+  # filename as a dependency, but linking requires target name.
+  target_link_libraries(RemoteIndexServiceProto
+    PRIVATE
+    RemoteIndexProto
+    )
   include_directories(${CMAKE_CURRENT_BINARY_DIR})
   include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../../)
 
@@ -18,8 +24,8 @@ if (CLANGD_ENABLE_REMOTE)
     RemoteIndexProto
     RemoteIndexServiceProto
     clangdRemoteMarshalling
-    protobuf
-    grpc++
+    clangBasic
+    clangDaemon
     clangdSupport
 
     DEPENDS

diff  --git a/clang-tools-extra/clangd/index/remote/marshalling/CMakeLists.txt b/clang-tools-extra/clangd/index/remote/marshalling/CMakeLists.txt
index 7b78ba3bb690..a5f6ebd179ec 100644
--- a/clang-tools-extra/clangd/index/remote/marshalling/CMakeLists.txt
+++ b/clang-tools-extra/clangd/index/remote/marshalling/CMakeLists.txt
@@ -4,7 +4,6 @@ add_clang_library(clangdRemoteMarshalling
   LINK_LIBS
   RemoteIndexProto
 
-  protobuf
   clangDaemon
   clangdSupport
 

diff  --git a/clang-tools-extra/clangd/index/remote/server/CMakeLists.txt b/clang-tools-extra/clangd/index/remote/server/CMakeLists.txt
index 595c406eff0f..e6959db6bbd8 100644
--- a/clang-tools-extra/clangd/index/remote/server/CMakeLists.txt
+++ b/clang-tools-extra/clangd/index/remote/server/CMakeLists.txt
@@ -17,6 +17,4 @@ target_link_libraries(clangd-index-server
   RemoteIndexProto
   RemoteIndexServiceProto
   clangdRemoteMarshalling
-
-  grpc++
   )

diff  --git a/clang-tools-extra/clangd/unittests/CMakeLists.txt b/clang-tools-extra/clangd/unittests/CMakeLists.txt
index e7baf880e504..72ce97ed31b6 100644
--- a/clang-tools-extra/clangd/unittests/CMakeLists.txt
+++ b/clang-tools-extra/clangd/unittests/CMakeLists.txt
@@ -146,7 +146,8 @@ target_link_libraries(ClangdTests
 if (CLANGD_ENABLE_REMOTE)
   target_link_libraries(ClangdTests
     PRIVATE
-    clangdRemoteMarshalling)
+    clangdRemoteMarshalling
+    RemoteIndexProto)
 endif()
 
 if (CLANGD_BUILD_XPC)

diff  --git a/llvm/cmake/modules/FindGRPC.cmake b/llvm/cmake/modules/FindGRPC.cmake
index f2c9bee38c93..7031c5f0016a 100644
--- a/llvm/cmake/modules/FindGRPC.cmake
+++ b/llvm/cmake/modules/FindGRPC.cmake
@@ -112,7 +112,7 @@ function(generate_protos LibraryName ProtoFile)
 
   add_clang_library(${LibraryName} ${GeneratedProtoSource}
     PARTIAL_SOURCES_INTENDED
-    LINK_LIBS grpc++ protobuf)
+    LINK_LIBS PUBLIC grpc++ protobuf)
 
   # Ensure dependency headers are generated before dependent protos are built.
   # DEPENDS arg is a list of "Foo.proto". While they're logically relative to


        


More information about the cfe-commits mailing list