• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1add_subdirectory(support)
2
3# Configure the Features.inc file.
4if (NOT DEFINED CLANGD_BUILD_XPC)
5  if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
6    set(CLANGD_BUILD_XPC_DEFAULT ON)
7  else ()
8    set(CLANGD_BUILD_XPC_DEFAULT OFF)
9  endif ()
10
11  llvm_canonicalize_cmake_booleans(CLANGD_BUILD_XPC_DEFAULT)
12
13  set(CLANGD_BUILD_XPC ${CLANGD_BUILD_XPC_DEFAULT} CACHE BOOL "Build XPC Support For Clangd." FORCE)
14  unset(CLANGD_BUILD_XPC_DEFAULT)
15endif ()
16
17llvm_canonicalize_cmake_booleans(
18  CLANGD_BUILD_XPC
19  CLANGD_ENABLE_REMOTE
20  LLVM_ENABLE_ZLIB
21)
22
23configure_file(
24  ${CMAKE_CURRENT_SOURCE_DIR}/Features.inc.in
25  ${CMAKE_CURRENT_BINARY_DIR}/Features.inc
26)
27
28set(LLVM_LINK_COMPONENTS
29  Support
30  AllTargetsInfos
31  FrontendOpenMP
32  Option
33  )
34
35include(${CMAKE_CURRENT_SOURCE_DIR}/quality/CompletionModel.cmake)
36gen_decision_forest(${CMAKE_CURRENT_SOURCE_DIR}/quality/model CompletionModel clang::clangd::Example)
37
38if(MSVC AND NOT CLANG_CL)
39 set_source_files_properties(CompileCommands.cpp PROPERTIES COMPILE_FLAGS -wd4130) # disables C4130: logical operation on address of string constant
40endif()
41
42include_directories(BEFORE "${CMAKE_CURRENT_BINARY_DIR}/../clang-tidy")
43
44add_clang_library(clangDaemon
45  AST.cpp
46  ClangdLSPServer.cpp
47  ClangdServer.cpp
48  CodeComplete.cpp
49  CodeCompletionStrings.cpp
50  CollectMacros.cpp
51  CompileCommands.cpp
52  Compiler.cpp
53  Config.cpp
54  ConfigCompile.cpp
55  ConfigProvider.cpp
56  ConfigYAML.cpp
57  Diagnostics.cpp
58  DraftStore.cpp
59  DumpAST.cpp
60  ExpectedTypes.cpp
61  FindSymbols.cpp
62  FindTarget.cpp
63  FileDistance.cpp
64  Format.cpp
65  FS.cpp
66  FuzzyMatch.cpp
67  GlobalCompilationDatabase.cpp
68  Headers.cpp
69  HeaderSourceSwitch.cpp
70  Hover.cpp
71  IncludeFixer.cpp
72  JSONTransport.cpp
73  PathMapping.cpp
74  Protocol.cpp
75  Quality.cpp
76  ParsedAST.cpp
77  Preamble.cpp
78  RIFF.cpp
79  Selection.cpp
80  SemanticHighlighting.cpp
81  SemanticSelection.cpp
82  SourceCode.cpp
83  QueryDriverDatabase.cpp
84  TidyProvider.cpp
85  TUScheduler.cpp
86  URI.cpp
87  XRefs.cpp
88  ${CMAKE_CURRENT_BINARY_DIR}/CompletionModel.cpp
89
90  index/Background.cpp
91  index/BackgroundIndexLoader.cpp
92  index/BackgroundIndexStorage.cpp
93  index/BackgroundQueue.cpp
94  index/BackgroundRebuild.cpp
95  index/CanonicalIncludes.cpp
96  index/FileIndex.cpp
97  index/Index.cpp
98  index/IndexAction.cpp
99  index/MemIndex.cpp
100  index/Merge.cpp
101  index/ProjectAware.cpp
102  index/Ref.cpp
103  index/Relation.cpp
104  index/Serialization.cpp
105  index/Symbol.cpp
106  index/SymbolCollector.cpp
107  index/SymbolID.cpp
108  index/SymbolLocation.cpp
109  index/SymbolOrigin.cpp
110  index/YAMLSerialization.cpp
111
112  index/dex/Dex.cpp
113  index/dex/Iterator.cpp
114  index/dex/PostingList.cpp
115  index/dex/Trigram.cpp
116
117  refactor/Rename.cpp
118  refactor/Tweak.cpp
119
120  DEPENDS
121  omp_gen
122  )
123
124# Include generated CompletionModel headers.
125target_include_directories(clangDaemon PUBLIC
126  $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
127)
128
129clang_target_link_libraries(clangDaemon
130  PRIVATE
131  clangAST
132  clangASTMatchers
133  clangBasic
134  clangDriver
135  clangFormat
136  clangFrontend
137  clangIndex
138  clangLex
139  clangSema
140  clangSerialization
141  clangTooling
142  clangToolingCore
143  clangToolingInclusions
144  clangToolingSyntax
145  )
146
147target_link_libraries(clangDaemon
148  PRIVATE
149  ${LLVM_PTHREAD_LIB}
150
151  clangTidy
152  ${ALL_CLANG_TIDY_CHECKS}
153
154  clangdSupport
155  )
156
157add_subdirectory(refactor/tweaks)
158if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
159  # FIXME: Make fuzzer not use linux-specific APIs, build it everywhere.
160  add_subdirectory(fuzzer)
161endif()
162add_subdirectory(tool)
163add_subdirectory(indexer)
164
165if (LLVM_INCLUDE_BENCHMARKS)
166  add_subdirectory(benchmarks)
167endif()
168if ( CLANGD_BUILD_XPC )
169  add_subdirectory(xpc)
170endif ()
171
172if (CLANGD_ENABLE_REMOTE)
173  include(FindGRPC)
174endif()
175
176if(CLANG_INCLUDE_TESTS)
177  add_subdirectory(test)
178  add_subdirectory(unittests)
179endif()
180
181# FIXME(kirillbobyrev): Document this in the LLVM docs once remote index is stable.
182option(CLANGD_ENABLE_REMOTE "Use gRPC library to enable remote index support for Clangd" OFF)
183set(GRPC_INSTALL_PATH "" CACHE PATH "Path to gRPC library manual installation.")
184
185add_subdirectory(index/remote)
186add_subdirectory(index/dex/dexp)
187