1# Set CLANG_TOOLS_DIR to buildtree/bin, or buildtree/%(build_mode)s/bin if the
2# location is dynamic. The latter must be interpolated by lit configs.
3# FIXME: this is duplicated in many places.
4if (CMAKE_CFG_INTDIR STREQUAL ".")
5  set(LLVM_BUILD_MODE ".")
6else ()
7  set(LLVM_BUILD_MODE "%(build_mode)s")
8endif ()
9string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} CLANG_TOOLS_DIR ${LLVM_RUNTIME_OUTPUT_INTDIR})
10
11set(CLANGD_TEST_DEPS
12  clangd
13  ClangdTests
14  clangd-indexer
15  # No tests for it, but we should still make sure they build.
16  dexp
17  )
18
19if(CLANGD_BUILD_XPC)
20  list(APPEND CLANGD_TEST_DEPS clangd-xpc-test-client)
21  list(APPEND CLANGD_TEST_DEPS ClangdXpcUnitTests)
22endif()
23
24if(CLANGD_ENABLE_REMOTE)
25  list(APPEND CLANGD_TEST_DEPS clangd-index-server)
26endif()
27
28foreach(dep FileCheck count not llvm-config)
29  if(TARGET ${dep})
30    list(APPEND CLANGD_TEST_DEPS ${dep})
31  endif()
32endforeach()
33
34configure_lit_site_cfg(
35  ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in
36  ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg.py
37  MAIN_CONFIG
38  ${CMAKE_CURRENT_SOURCE_DIR}/lit.cfg.py
39  )
40
41add_lit_testsuite(check-clangd "Running the Clangd regression tests"
42  # clangd doesn't put unittest configs in test/unit like every other project.
43  # Because of that, this needs to pass two folders here, while every other
44  # project only needs to pass CMAKE_CURRENT_BINARY_DIR.
45  ${CMAKE_CURRENT_BINARY_DIR}/../unittests;${CMAKE_CURRENT_BINARY_DIR}
46  DEPENDS ${CLANGD_TEST_DEPS})
47