import("//llvm/utils/gn/build/write_cmake_config.gni")
import("//third-party/unittest/unittest.gni")

write_cmake_config("config") {
  input = "config.h.cmake"
  output = "$target_gen_dir/config.h"
  values = [ "CLANG_DOC_TEST_ASSET_DIR=" +
             rebase_path("//clang-tools-extra/clang-doc/assets") ]
}

unittest("ClangDocTests") {
  configs += [ "//llvm/utils/gn/build:clang_code" ]
  deps = [
    ":config",
    "//clang-tools-extra/clang-doc",
    "//clang/lib/AST",
    "//clang/lib/ASTMatchers",
    "//clang/lib/Basic",
    "//clang/lib/Format",
    "//clang/lib/Frontend",
    "//clang/lib/Rewrite",
    "//clang/lib/Serialization",
    "//clang/lib/Tooling",
    "//clang/lib/Tooling/Core",
    "//llvm/lib/Bitcode/Reader",
    "//llvm/lib/Bitcode/Writer",
    "//llvm/lib/Support",
    "//llvm/lib/Testing/Support",
  ]

  include_dirs = [
    "//clang-tools-extra/clang-doc",

    # To pick up generated config.h.
    target_gen_dir,
  ]

  sources = [
    "BitcodeTest.cpp",
    "ClangDocTest.cpp",
    "GeneratorTest.cpp",
    "HTMLGeneratorTest.cpp",
    "HTMLMustacheGeneratorTest.cpp",
    "JSONGeneratorTest.cpp",
    "MDGeneratorTest.cpp",
    "MergeTest.cpp",
    "SerializeTest.cpp",
    "YAMLGeneratorTest.cpp",
  ]
}
