brintos

brintos / llvm-project-archived public Read only

0
0
Text · 5.5 KiB · d7ec853 Raw
232 lines · plain
1# This is a no-op for building files in this dir, but is inherited by subdirs.2include_directories(${CMAKE_CURRENT_SOURCE_DIR})3include_directories(${CMAKE_CURRENT_BINARY_DIR})4 5add_subdirectory(support)6 7# Configure the Features.inc file.8if (NOT DEFINED CLANGD_BUILD_XPC)9  if("${CMAKE_SYSTEM_NAME}" MATCHES "Darwin")10    set(CLANGD_BUILD_XPC_DEFAULT ON)11  else ()12    set(CLANGD_BUILD_XPC_DEFAULT OFF)13  endif ()14 15  llvm_canonicalize_cmake_booleans(CLANGD_BUILD_XPC_DEFAULT)16 17  set(CLANGD_BUILD_XPC ${CLANGD_BUILD_XPC_DEFAULT} CACHE BOOL "Build XPC Support For Clangd." FORCE)18  unset(CLANGD_BUILD_XPC_DEFAULT)19endif ()20 21# This involves generating and compiling large source files, which can run into toolchain limitations.22option(CLANGD_DECISION_FOREST "Enable decision forest model for ranking code completion items" ON)23option(CLANGD_MALLOC_TRIM "Call malloc_trim(3) periodically in Clangd. (only takes effect when using glibc)" ON)24# -DCLANG_TIDY_CHECKS=Off avoids a dependency on clang-tidy, reducing rebuilds.25option(CLANGD_TIDY_CHECKS "Link all clang-tidy checks into clangd" ON)26 27llvm_canonicalize_cmake_booleans(28  CLANGD_BUILD_XPC29  CLANGD_ENABLE_REMOTE30  ENABLE_GRPC_REFLECTION31  CLANGD_MALLOC_TRIM32  CLANGD_TIDY_CHECKS33  LLVM_ENABLE_ZLIB34  CLANGD_DECISION_FOREST35)36 37configure_file(38  ${CMAKE_CURRENT_SOURCE_DIR}/Features.inc.in39  ${CMAKE_CURRENT_BINARY_DIR}/Features.inc40)41 42set(LLVM_LINK_COMPONENTS43  Support44  AllTargetsInfos45  FrontendOpenMP46  Option47  TargetParser48  )49 50set(COMPLETIONMODEL_SOURCES)51if(CLANGD_DECISION_FOREST)52  include(${CMAKE_CURRENT_SOURCE_DIR}/quality/CompletionModel.cmake)53  gen_decision_forest(${CMAKE_CURRENT_SOURCE_DIR}/quality/model CompletionModel clang::clangd::Example)54  list(APPEND COMPLETIONMODEL_SOURCES ${CMAKE_CURRENT_BINARY_DIR}/CompletionModel.cpp)55endif()56 57if(MSVC AND NOT CLANG_CL)58 set_source_files_properties(CompileCommands.cpp PROPERTIES COMPILE_FLAGS -wd4130) # disables C4130: logical operation on address of string constant59endif()60 61include_directories(BEFORE "${CMAKE_CURRENT_BINARY_DIR}/../clang-tidy")62include_directories(BEFORE "${CMAKE_CURRENT_SOURCE_DIR}/../include-cleaner/include")63 64add_clang_library(clangDaemon STATIC65  AST.cpp66  ASTSignals.cpp67  ClangdLSPServer.cpp68  ClangdServer.cpp69  CodeComplete.cpp70  CodeCompletionStrings.cpp71  CollectMacros.cpp72  CompileCommands.cpp73  Compiler.cpp74  Config.cpp75  ConfigCompile.cpp76  ConfigProvider.cpp77  ConfigYAML.cpp78  DecisionForest.cpp79  Diagnostics.cpp80  DraftStore.cpp81  DumpAST.cpp82  ExpectedTypes.cpp83  FeatureModule.cpp84  Feature.cpp85  FindSymbols.cpp86  FindTarget.cpp87  FileDistance.cpp88  Format.cpp89  FS.cpp90  FuzzyMatch.cpp91  GlobalCompilationDatabase.cpp92  Headers.cpp93  HeaderSourceSwitch.cpp94  Hover.cpp95  IncludeCleaner.cpp96  IncludeFixer.cpp97  InlayHints.cpp98  JSONTransport.cpp99  ModulesBuilder.cpp100  PathMapping.cpp101  Protocol.cpp102  Quality.cpp103  ParsedAST.cpp104  Preamble.cpp105  RIFF.cpp106  ScanningProjectModules.cpp107  Selection.cpp108  SemanticHighlighting.cpp109  SemanticSelection.cpp110  SourceCode.cpp111  SymbolDocumentation.cpp112  SystemIncludeExtractor.cpp113  TidyProvider.cpp114  TUScheduler.cpp115  URI.cpp116  XRefs.cpp117  ${COMPLETIONMODEL_SOURCES}118 119  index/Background.cpp120  index/BackgroundIndexLoader.cpp121  index/BackgroundIndexStorage.cpp122  index/BackgroundQueue.cpp123  index/BackgroundRebuild.cpp124  index/CanonicalIncludes.cpp125  index/FileIndex.cpp126  index/Index.cpp127  index/IndexAction.cpp128  index/MemIndex.cpp129  index/Merge.cpp130  index/ProjectAware.cpp131  index/Ref.cpp132  index/Relation.cpp133  index/Serialization.cpp134  index/StdLib.cpp135  index/Symbol.cpp136  index/SymbolCollector.cpp137  index/SymbolID.cpp138  index/SymbolLocation.cpp139  index/SymbolOrigin.cpp140  index/YAMLSerialization.cpp141 142  index/dex/Dex.cpp143  index/dex/Iterator.cpp144  index/dex/PostingList.cpp145  index/dex/Trigram.cpp146 147  refactor/InsertionPoint.cpp148  refactor/Rename.cpp149  refactor/Tweak.cpp150 151  DEPENDS152  omp_gen153  ClangDriverOptions154  )155 156# Include generated CompletionModel headers.157target_include_directories(clangDaemon PUBLIC158  $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>159)160 161clang_target_link_libraries(clangDaemon162  PRIVATE163  clangAST164  clangASTMatchers165  clangBasic166  clangDependencyScanning167  clangDriver168  clangOptions169  clangFormat170  clangFrontend171  clangIndex172  clangLex173  clangSema174  clangSerialization175  clangTooling176  clangToolingCore177  clangToolingInclusions178  clangToolingInclusionsStdlib179  clangToolingSyntax180  )181 182target_link_libraries(clangDaemon183  PRIVATE184  ${LLVM_PTHREAD_LIB}185 186  clangIncludeCleaner187  clangTidy188  clangTidyUtils189 190  clangdSupport191  )192if(CLANGD_TIDY_CHECKS)193  target_link_libraries(clangDaemon PRIVATE ${ALL_CLANG_TIDY_CHECKS})194endif()195 196add_subdirectory(refactor/tweaks)197if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")198  # FIXME: Make fuzzer not use linux-specific APIs, build it everywhere.199  add_subdirectory(fuzzer)200endif()201add_subdirectory(tool)202add_subdirectory(indexer)203 204if (LLVM_INCLUDE_BENCHMARKS)205  add_subdirectory(benchmarks)206endif()207if ( CLANGD_BUILD_XPC )208  add_subdirectory(xpc)209endif ()210 211if (CLANGD_ENABLE_REMOTE)212  include(AddGRPC)213endif()214 215option(CLANGD_BUILD_DEXP "Build the dexp tool as part of Clangd" ON)216llvm_canonicalize_cmake_booleans(CLANGD_BUILD_DEXP)217 218if(CLANG_INCLUDE_TESTS)219  add_subdirectory(test)220  add_subdirectory(unittests)221endif()222 223# FIXME(kirillbobyrev): Document this in the LLVM docs once remote index is stable.224option(CLANGD_ENABLE_REMOTE "Use gRPC library to enable remote index support for Clangd" OFF)225set(GRPC_INSTALL_PATH "" CACHE PATH "Path to gRPC library manual installation.")226 227add_subdirectory(index/remote)228 229if(CLANGD_BUILD_DEXP)230  add_subdirectory(index/dex/dexp)231endif()232