kbobyrev updated this revision to Diff 260188.
kbobyrev added a comment.

Slightly adjust the CMake scripts.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D78885/new/

https://reviews.llvm.org/D78885

Files:
  clang-tools-extra/clangd/index/remote/CMakeLists.txt
  clang-tools-extra/clangd/index/remote/Index.proto
  clang-tools-extra/clangd/index/remote/protos/CMakeLists.txt
  clang-tools-extra/clangd/index/remote/protos/Index.proto
  clang-tools-extra/clangd/index/remote/server/CMakeLists.txt
  llvm/cmake/modules/FindGRPC.cmake

Index: llvm/cmake/modules/FindGRPC.cmake
===================================================================
--- llvm/cmake/modules/FindGRPC.cmake
+++ llvm/cmake/modules/FindGRPC.cmake
@@ -45,6 +45,6 @@
           "${ProtoSourceAbsolutePath}"
           DEPENDS "${ProtoSourceAbsolutePath}")
 
-  add_library(${LibraryName} ${GeneratedProtoSource} ${GeneratedGRPCSource})
-  target_link_libraries(${LibraryName} grpc++ protobuf)
+  add_clang_library(${LibraryName} ${GeneratedProtoSource} ${GeneratedGRPCSource}
+    LINK_LIBS grpc++ protobuf)
 endfunction()
Index: clang-tools-extra/clangd/index/remote/server/CMakeLists.txt
===================================================================
--- clang-tools-extra/clangd/index/remote/server/CMakeLists.txt
+++ clang-tools-extra/clangd/index/remote/server/CMakeLists.txt
@@ -5,14 +5,12 @@
 add_clang_executable(clangd-index-server
   Server.cpp
   )
-target_compile_definitions(clangd-index-server PRIVATE -D GOOGLE_PROTOBUF_NO_RTTI=1)
-clang_target_link_libraries(clangd-index-server
-  PRIVATE
-  clangDaemon
-  )
 target_link_libraries(clangd-index-server
   PRIVATE
-  RemoteIndexProtos
+  clangDaemon
 
+  RemoteIndexProtos
   clangdRemoteMarshalling
+
+  grpc++
   )
Index: clang-tools-extra/clangd/index/remote/Index.proto
===================================================================
--- /dev/null
+++ clang-tools-extra/clangd/index/remote/Index.proto
@@ -1,69 +0,0 @@
-//===--- Index.proto - Remote index Protocol Buffers definition -----------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-syntax = "proto3";
-
-package clang.clangd.remote;
-
-service SymbolIndex {
-  rpc Lookup(LookupRequest) returns (stream LookupReply) {}
-
-  rpc FuzzyFind(FuzzyFindRequest) returns (stream FuzzyFindReply) {}
-
-  rpc Refs(RefsRequest) returns (stream RefsReply) {}
-}
-
-message LookupRequest { repeated string ids = 1; }
-
-// The response is a stream of symbol messages and the terminating message
-// indicating the end of stream.
-message LookupReply {
-  oneof kind {
-    Symbol stream_result = 1;
-    bool final_result = 2;
-  }
-}
-
-message FuzzyFindRequest {
-  string query = 1;
-  repeated string scopes = 2;
-  bool any_scope = 3;
-  uint32 limit = 4;
-  bool resricted_for_code_completion = 5;
-  repeated string proximity_paths = 6;
-  repeated string preferred_types = 7;
-}
-
-// The response is a stream of symbol messages, and one terminating has_more
-// message.
-message FuzzyFindReply {
-  oneof kind {
-    Symbol stream_result = 1;
-    bool final_result = 2; // HasMore
-  }
-}
-
-message RefsRequest {
-  repeated string ids = 1;
-  uint32 filter = 2;
-  uint32 limit = 3;
-}
-
-// The response is a stream of reference messages, and one terminating has_more
-// message.
-message RefsReply {
-  oneof kind {
-    Ref stream_result = 1;
-    bool final_result = 2; // HasMore
-  }
-}
-
-// FIXME(kirillbobyrev): Properly serialize symbols and refs instead of passing
-// YAML.
-message Ref { string yaml_serialization = 1; }
-message Symbol { string yaml_serialization = 1; }
Index: clang-tools-extra/clangd/index/remote/protos/CMakeLists.txt
===================================================================
--- /dev/null
+++ clang-tools-extra/clangd/index/remote/protos/CMakeLists.txt
@@ -0,0 +1 @@
+generate_grpc_protos(RemoteIndexProtos "Index.proto")
Index: clang-tools-extra/clangd/index/remote/CMakeLists.txt
===================================================================
--- clang-tools-extra/clangd/index/remote/CMakeLists.txt
+++ clang-tools-extra/clangd/index/remote/CMakeLists.txt
@@ -1,6 +1,5 @@
 if (CLANGD_ENABLE_REMOTE)
-  generate_grpc_protos(RemoteIndexProtos "Index.proto")
-  include_directories(${CMAKE_CURRENT_BINARY_DIR})
+  include_directories(${CMAKE_CURRENT_BINARY_DIR}/protos)
   include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../../)
 
   # FIXME(kirillbobyrev): target_compile_definitions is not working with
@@ -20,6 +19,7 @@
     clangDaemon
     )
 
+  add_subdirectory(protos)
   add_subdirectory(marshalling)
   add_subdirectory(server)
 else()
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to