1set(LLVM_LINK_COMPONENTS 2 support 3 AllTargetsInfos 4 FrontendOpenMP 5 ) 6 7get_filename_component(CLANGD_SOURCE_DIR 8 ${CMAKE_CURRENT_SOURCE_DIR}/../../clangd REALPATH) 9get_filename_component(CLANGD_BINARY_DIR 10 ${CMAKE_CURRENT_BINARY_DIR}/../../clangd REALPATH) 11include_directories( 12 ${CLANGD_SOURCE_DIR} 13 ${CLANGD_BINARY_DIR} 14 ) 15 16if(CLANG_BUILT_STANDALONE) 17 # LLVMTestingSupport library is needed for clangd tests. 18 if (EXISTS ${LLVM_MAIN_SRC_DIR}/lib/Testing/Support 19 AND NOT TARGET LLVMTestingSupport) 20 add_subdirectory(${LLVM_MAIN_SRC_DIR}/lib/Testing/Support 21 lib/Testing/Support) 22 endif() 23endif() 24 25if (CLANGD_ENABLE_REMOTE) 26 include_directories(${CMAKE_CURRENT_BINARY_DIR}/../index/remote) 27 add_definitions(-DGOOGLE_PROTOBUF_NO_RTTI=1) 28 set(REMOTE_TEST_SOURCES remote/MarshallingTests.cpp) 29endif() 30 31include(${CMAKE_CURRENT_SOURCE_DIR}/../quality/CompletionModel.cmake) 32gen_decision_forest(${CMAKE_CURRENT_SOURCE_DIR}/decision_forest_model DecisionForestRuntimeTest ::ns1::ns2::test::Example) 33 34add_custom_target(ClangdUnitTests) 35add_unittest(ClangdUnitTests ClangdTests 36 Annotations.cpp 37 ASTTests.cpp 38 BackgroundIndexTests.cpp 39 CallHierarchyTests.cpp 40 CanonicalIncludesTests.cpp 41 ClangdTests.cpp 42 ClangdLSPServerTests.cpp 43 CodeCompleteTests.cpp 44 CodeCompletionStringsTests.cpp 45 CollectMacrosTests.cpp 46 CompileCommandsTests.cpp 47 CompilerTests.cpp 48 ConfigCompileTests.cpp 49 ConfigProviderTests.cpp 50 ConfigYAMLTests.cpp 51 DecisionForestTests.cpp 52 DexTests.cpp 53 DiagnosticsTests.cpp 54 DraftStoreTests.cpp 55 DumpASTTests.cpp 56 ExpectedTypeTest.cpp 57 FileDistanceTests.cpp 58 FileIndexTests.cpp 59 FindSymbolsTests.cpp 60 FindTargetTests.cpp 61 FormatTests.cpp 62 FSTests.cpp 63 FuzzyMatchTests.cpp 64 GlobalCompilationDatabaseTests.cpp 65 HeadersTests.cpp 66 HeaderSourceSwitchTests.cpp 67 HoverTests.cpp 68 IndexActionTests.cpp 69 IndexTests.cpp 70 JSONTransportTests.cpp 71 LoggerTests.cpp 72 LSPClient.cpp 73 ModulesTests.cpp 74 ParsedASTTests.cpp 75 PathMappingTests.cpp 76 PreambleTests.cpp 77 PrintASTTests.cpp 78 ProjectAwareIndexTests.cpp 79 QualityTests.cpp 80 RenameTests.cpp 81 RIFFTests.cpp 82 SelectionTests.cpp 83 SemanticHighlightingTests.cpp 84 SemanticSelectionTests.cpp 85 SerializationTests.cpp 86 SourceCodeTests.cpp 87 SymbolCollectorTests.cpp 88 SymbolInfoTests.cpp 89 SyncAPI.cpp 90 TUSchedulerTests.cpp 91 TestFS.cpp 92 TestIndex.cpp 93 TestTU.cpp 94 TestWorkspace.cpp 95 TypeHierarchyTests.cpp 96 URITests.cpp 97 XRefsTests.cpp 98 ${CMAKE_CURRENT_BINARY_DIR}/DecisionForestRuntimeTest.cpp 99 100 support/CancellationTests.cpp 101 support/ContextTests.cpp 102 support/FunctionTests.cpp 103 support/MarkupTests.cpp 104 support/MemoryTreeTests.cpp 105 support/ThreadingTests.cpp 106 support/TestTracer.cpp 107 support/TraceTests.cpp 108 109 tweaks/AddUsingTests.cpp 110 tweaks/AnnotateHighlightingsTests.cpp 111 tweaks/DefineInlineTests.cpp 112 tweaks/DefineOutlineTests.cpp 113 tweaks/DumpASTTests.cpp 114 tweaks/DumpRecordLayoutTests.cpp 115 tweaks/DumpSymbolTests.cpp 116 tweaks/ExpandAutoTypeTests.cpp 117 tweaks/ExpandMacroTests.cpp 118 tweaks/ExtractFunctionTests.cpp 119 tweaks/ExtractVariableTests.cpp 120 tweaks/ObjCLocalizeStringLiteralTests.cpp 121 tweaks/PopulateSwitchTests.cpp 122 tweaks/RawStringLiteralTests.cpp 123 tweaks/RemoveUsingNamespaceTests.cpp 124 tweaks/ShowSelectionTreeTests.cpp 125 tweaks/SwapIfBranchesTests.cpp 126 tweaks/TweakTesting.cpp 127 tweaks/TweakTests.cpp 128 129 ${REMOTE_TEST_SOURCES} 130 131 $<TARGET_OBJECTS:obj.clangDaemonTweaks> 132 ) 133 134# Include generated ComletionModel headers. 135target_include_directories(ClangdTests PUBLIC 136 $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}> 137) 138 139clang_target_link_libraries(ClangdTests 140 PRIVATE 141 clangAST 142 clangASTMatchers 143 clangBasic 144 clangFormat 145 clangFrontend 146 clangIndex 147 clangLex 148 clangSema 149 clangSerialization 150 clangTooling 151 clangToolingCore 152 clangToolingInclusions 153 clangToolingRefactoring 154 clangToolingSyntax 155 ) 156target_link_libraries(ClangdTests 157 PRIVATE 158 clangDaemon 159 clangdSupport 160 clangTidy 161 LLVMTestingSupport 162 ) 163 164if (CLANGD_ENABLE_REMOTE) 165 target_link_libraries(ClangdTests 166 PRIVATE 167 clangdRemoteMarshalling 168 RemoteIndexProto) 169endif() 170 171if (CLANGD_BUILD_XPC) 172 add_subdirectory(xpc) 173endif () 174 175configure_lit_site_cfg( 176 ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in 177 ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg.py) 178