[clang-tools-extra] 9ff3f33 - [clangd] Fix remote index build without shared libs mode
Kirill Bobyrev via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 28 10:17:06 PDT 2020
Author: Kirill Bobyrev
Date: 2020-04-28T19:16:37+02:00
New Revision: 9ff3f339e881b65217272cb11714493d0e5f1c70
URL: https://github.com/llvm/llvm-project/commit/9ff3f339e881b65217272cb11714493d0e5f1c70
DIFF: https://github.com/llvm/llvm-project/commit/9ff3f339e881b65217272cb11714493d0e5f1c70.diff
LOG: [clangd] Fix remote index build without shared libs mode
Summary:
Generated Protobuf library has to be in CLANG_EXPORTS and should also be
installed appropriately. The easiest way to do that is via CMake's
add_clang_library. That unfortunately applies "one directory - one
clang_(library|tool)" policy so .proto files should be in a separate directory
and complicates the layout.
This setup works both in shared and static libs mode.
Resolves: https://github.com/clangd/clangd/issues/351
Reviewers: sammccall
Reviewed By: sammccall
Subscribers: mgorny, ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits, llvm-commits
Tags: #clang, #llvm
Differential Revision: https://reviews.llvm.org/D78885
Added:
Modified:
clang-tools-extra/clangd/index/remote/server/CMakeLists.txt
llvm/cmake/modules/FindGRPC.cmake
llvm/cmake/modules/LLVMProcessSources.cmake
Removed:
################################################################################
diff --git a/clang-tools-extra/clangd/index/remote/server/CMakeLists.txt b/clang-tools-extra/clangd/index/remote/server/CMakeLists.txt
index 378ea2946839..019b77eb98ba 100644
--- a/clang-tools-extra/clangd/index/remote/server/CMakeLists.txt
+++ b/clang-tools-extra/clangd/index/remote/server/CMakeLists.txt
@@ -5,14 +5,12 @@ set(LLVM_LINK_COMPONENTS
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++
)
diff --git a/llvm/cmake/modules/FindGRPC.cmake b/llvm/cmake/modules/FindGRPC.cmake
index b70356696298..a5f4b5b5bb14 100644
--- a/llvm/cmake/modules/FindGRPC.cmake
+++ b/llvm/cmake/modules/FindGRPC.cmake
@@ -45,6 +45,7 @@ function(generate_grpc_protos LibraryName ProtoFile)
"${ProtoSourceAbsolutePath}"
DEPENDS "${ProtoSourceAbsolutePath}")
- add_library(${LibraryName} ${GeneratedProtoSource} ${GeneratedGRPCSource})
- target_link_libraries(${LibraryName} grpc++ protobuf)
+ add_clang_library(${LibraryName} ${GeneratedProtoSource} ${GeneratedGRPCSource}
+ PARTIAL_SOURCES_INTENDED
+ LINK_LIBS grpc++ protobuf)
endfunction()
diff --git a/llvm/cmake/modules/LLVMProcessSources.cmake b/llvm/cmake/modules/LLVMProcessSources.cmake
index d0be0e8b3ba3..ba8dca313c86 100644
--- a/llvm/cmake/modules/LLVMProcessSources.cmake
+++ b/llvm/cmake/modules/LLVMProcessSources.cmake
@@ -57,10 +57,12 @@ endfunction(find_all_header_files)
function(llvm_process_sources OUT_VAR)
- cmake_parse_arguments(ARG "" "" "ADDITIONAL_HEADERS;ADDITIONAL_HEADER_DIRS" ${ARGN})
+ cmake_parse_arguments(ARG "PARTIAL_SOURCES_INTENDED" "" "ADDITIONAL_HEADERS;ADDITIONAL_HEADER_DIRS" ${ARGN})
set(sources ${ARG_UNPARSED_ARGUMENTS})
- llvm_check_source_file_list( ${sources} )
-
+ if (NOT ARG_PARTIAL_SOURCES_INTENDED)
+ llvm_check_source_file_list(${sources})
+ endif()
+
# This adds .td and .h files to the Visual Studio solution:
add_td_sources(sources)
find_all_header_files(hdrs "${ARG_ADDITIONAL_HEADER_DIRS}")
More information about the cfe-commits
mailing list