File: BUILD.gn

package info (click to toggle)
llvm-toolchain-15 1%3A15.0.6-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,554,644 kB
  • sloc: cpp: 5,922,452; ansic: 1,012,136; asm: 674,362; python: 191,568; objc: 73,855; f90: 42,327; lisp: 31,913; pascal: 11,973; javascript: 10,144; sh: 9,421; perl: 7,447; ml: 5,527; awk: 3,523; makefile: 2,520; xml: 885; cs: 573; fortran: 567
file content (93 lines) | stat: -rw-r--r-- 3,142 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
import("//llvm/triples.gni")
import("//llvm/utils/gn/build/write_cmake_config.gni")
import("clang_pseudo_lit_site_cfg_files.gni")

template("write_lit_config") {
  write_cmake_config(target_name) {
    input = invoker.input
    output = invoker.output
    values = [
      "LIT_SITE_CFG_IN_HEADER=## Autogenerated from $input, do not edit",
      "LLVM_LIBS_DIR=",  # needed only for shared builds
    ]
    values += invoker.extra_values
  }
}

write_lit_config("lit_site_cfg") {
  # Fully-qualified instead of relative for LIT_SITE_CFG_IN_HEADER.
  input = "//clang-tools-extra/pseudo/test/lit.site.cfg.py.in"
  output = clang_pseudo_lit_site_cfg_file

  extra_values = [
    "CMAKE_CURRENT_BINARY_DIR=" +
        rebase_path(get_label_info("//clang-tools-extra/pseudo/test",
                                   "target_out_dir")),
    "CMAKE_CURRENT_SOURCE_DIR=" +
        rebase_path("//clang-tools-extra/pseudo/test"),

    "CURRENT_TOOLS_DIR=",
    "LLVM_LIT_TOOLS_DIR=",  # Intentionally empty, matches cmake build.
    "LLVM_TOOLS_DIR=" + rebase_path("$root_out_dir/bin"),
    "TARGET_TRIPLE=$llvm_target_triple",
    "Python3_EXECUTABLE=$python_path",
  ]
}

write_lit_config("lit_unit_site_cfg") {
  # Fully-qualified instead of relative for LIT_SITE_CFG_IN_HEADER.
  input = "//clang-tools-extra/pseudo/test/Unit/lit.site.cfg.py.in"
  output = clang_pseudo_lit_unit_site_cfg_file
  extra_values = [
    "CMAKE_CURRENT_BINARY_DIR=" +
        rebase_path(get_label_info("//clang-tools-extra/pseudo/unittests",
                                   "target_out_dir")),
    "CMAKE_CURRENT_SOURCE_DIR=" +
        rebase_path("//clang-tools-extra/pseudo/test"),
  ]
  if (host_os == "win") {
    # See comment for Windows solink in llvm/utils/gn/build/toolchain/BUILD.gn
    extra_values += [ "SHLIBDIR=" + rebase_path("$root_out_dir/bin") ]
  } else {
    extra_values += [ "SHLIBDIR=" + rebase_path("$root_out_dir/lib") ]
  }
}

# This target should contain all dependencies of check-pseudo.
# //:default depends on it, so that ninja's default target builds all
# prerequisites for check-clang but doesn't run check-clang itself.
group("test") {
  deps = [
    ":lit_site_cfg",
    ":lit_unit_site_cfg",
    "//clang-tools-extra/pseudo/tool:clang-pseudo",
    "//clang-tools-extra/pseudo/unittests:ClangPseudoTests",
    "//llvm/utils/FileCheck",
    "//llvm/utils/llvm-lit",
    "//llvm/utils/not",
  ]
  testonly = true
}

action("check-clang-pseudo") {
  script = "$root_out_dir/bin/llvm-lit"
  if (host_os == "win") {
    script += ".py"
  }
  args = [
    "-sv",
    rebase_path(get_path_info(clang_pseudo_lit_site_cfg_file, "dir"),
                root_out_dir),
  ]
  outputs = [ "$target_gen_dir/run-lit" ]  # Non-existing, so that ninja runs it
                                           # each time.

  # Since check-clang-pseudo is always dirty, //:default doesn't depend on it so
  # that it's not part of the default ninja target.  Hence, check-clang-pseudo
  # shouldn't have any deps except :test. so that the default target is sure to
  # build all the deps.
  deps = [ ":test" ]
  testonly = true

  pool = "//:console"
}