[clangd] Fix shared-lib builds

Differential Revision: https://reviews.llvm.org/D91859
This commit is contained in:
Kadir Cetinkaya 2020-11-20 13:02:18 +01:00
parent 49e463ff80
commit f726101b62
No known key found for this signature in database
GPG Key ID: E39E36B8D2057ED6
6 changed files with 17 additions and 12 deletions

View File

@ -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)

View File

@ -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

View File

@ -4,7 +4,6 @@ add_clang_library(clangdRemoteMarshalling
LINK_LIBS
RemoteIndexProto
protobuf
clangDaemon
clangdSupport

View File

@ -17,6 +17,4 @@ target_link_libraries(clangd-index-server
RemoteIndexProto
RemoteIndexServiceProto
clangdRemoteMarshalling
grpc++
)

View File

@ -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)

View File

@ -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