dd3e02713559028aee73945c972d08d385a0f448
[lldb.git] / clang-tools-extra / clangd / CMakeLists.txt
1 add_subdirectory(support)
2
3 # Configure the Features.inc file.
4 if (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)
15 endif ()
16
17 llvm_canonicalize_cmake_booleans(CLANGD_BUILD_XPC)
18
19 configure_file(
20   ${CMAKE_CURRENT_SOURCE_DIR}/Features.inc.in
21   ${CMAKE_CURRENT_BINARY_DIR}/Features.inc
22 )
23
24 set(LLVM_LINK_COMPONENTS
25   Support
26   AllTargetsInfos
27   FrontendOpenMP
28   )
29
30 add_clang_library(clangDaemon
31   AST.cpp
32   ClangdLSPServer.cpp
33   ClangdServer.cpp
34   CodeComplete.cpp
35   CodeCompletionStrings.cpp
36   CollectMacros.cpp
37   CompileCommands.cpp
38   Compiler.cpp
39   Diagnostics.cpp
40   DraftStore.cpp
41   ExpectedTypes.cpp
42   FindSymbols.cpp
43   FindTarget.cpp
44   FileDistance.cpp
45   Format.cpp
46   FS.cpp
47   FuzzyMatch.cpp
48   GlobalCompilationDatabase.cpp
49   Headers.cpp
50   HeaderSourceSwitch.cpp
51   Hover.cpp
52   IncludeFixer.cpp
53   JSONTransport.cpp
54   PathMapping.cpp
55   Protocol.cpp
56   Quality.cpp
57   ParsedAST.cpp
58   Preamble.cpp
59   RIFF.cpp
60   Selection.cpp
61   SemanticHighlighting.cpp
62   SemanticSelection.cpp
63   SourceCode.cpp
64   QueryDriverDatabase.cpp
65   TUScheduler.cpp
66   URI.cpp
67   XRefs.cpp
68
69   index/Background.cpp
70   index/BackgroundIndexLoader.cpp
71   index/BackgroundIndexStorage.cpp
72   index/BackgroundQueue.cpp
73   index/BackgroundRebuild.cpp
74   index/CanonicalIncludes.cpp
75   index/FileIndex.cpp
76   index/Index.cpp
77   index/IndexAction.cpp
78   index/MemIndex.cpp
79   index/Merge.cpp
80   index/Ref.cpp
81   index/Relation.cpp
82   index/Serialization.cpp
83   index/Symbol.cpp
84   index/SymbolCollector.cpp
85   index/SymbolID.cpp
86   index/SymbolLocation.cpp
87   index/SymbolOrigin.cpp
88   index/YAMLSerialization.cpp
89
90   index/dex/Dex.cpp
91   index/dex/Iterator.cpp
92   index/dex/PostingList.cpp
93   index/dex/Trigram.cpp
94
95   refactor/Rename.cpp
96   refactor/Tweak.cpp
97
98   LINK_LIBS
99   clangAST
100   clangASTMatchers
101   clangBasic
102   clangDriver
103   clangFormat
104   clangFrontend
105   clangIndex
106   clangLex
107   clangSema
108   clangSerialization
109   clangTidy
110   clangTooling
111   clangToolingCore
112   clangToolingInclusions
113   clangToolingRefactoring
114   clangToolingSyntax
115   clangdSupport
116   ${LLVM_PTHREAD_LIB}
117   ${ALL_CLANG_TIDY_CHECKS}
118   )
119
120 add_subdirectory(refactor/tweaks)
121 if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
122   # FIXME: Make fuzzer not use linux-specific APIs, build it everywhere.
123   add_subdirectory(fuzzer)
124 endif()
125 add_subdirectory(tool)
126 add_subdirectory(indexer)
127
128 if (LLVM_INCLUDE_BENCHMARKS)
129   add_subdirectory(benchmarks)
130 endif()
131 if ( CLANGD_BUILD_XPC )
132   add_subdirectory(xpc)
133 endif ()
134
135 if(CLANG_INCLUDE_TESTS)
136 add_subdirectory(test)
137 add_subdirectory(unittests)
138 endif()
139
140 # FIXME(kirillbobyrev): Document this in the LLVM docs once remote index is stable.
141 option(CLANGD_ENABLE_REMOTE "Use gRPC library to enable remote index support for Clangd" OFF)
142 set(GRPC_INSTALL_PATH "" CACHE PATH "Path to gRPC library manual installation.")
143
144 if (CLANGD_ENABLE_REMOTE)
145   include(FindGRPC)
146 endif()
147 add_subdirectory(index/remote)
148 add_subdirectory(index/dex/dexp)