File: BUILD.gn

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (94 lines) | stat: -rw-r--r-- 3,137 bytes parent folder | download | duplicates (12)
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
94
import("//compiler-rt/target.gni")
import("//compiler-rt/test/test.gni")
import("//llvm/lib/Target/targets.gni")
import("//llvm/utils/gn/build/toolchain/compiler.gni")
import("//llvm/utils/gn/build/write_cmake_config.gni")
import("//llvm/version.gni")

write_cmake_config("lit_site_cfg") {
  input = "lit.site.cfg.py.in"
  output = "$target_gen_dir/lit.site.cfg.py"

  values = [
    "ASAN_LIT_SOURCE_DIR=" + rebase_path("."),
    "ASAN_TEST_CONFIG_SUFFIX=$crt_current_target_suffix",
    "ASAN_TEST_TARGET_CFLAGS=$target_flags_string",
    "ASAN_TEST_TARGET_CC=",
    "ASAN_TEST_BITS=64",
    "ASAN_TEST_APPLE_PLATFORM=",
    "ASAN_TEST_MIN_DEPLOYMENT_TARGET_FLAG=",
    "ASAN_TEST_TARGET_ARCH=$crt_current_target_arch",
    "COMPILER_RT_ARM_THUMB=",
    "COMPILER_RT_BINARY_DIR=" + rebase_path("$root_gen_dir/compiler-rt"),
    "LIT_SITE_CFG_IN_HEADER=## Autogenerated from $input, do not edit",
  ]
  if (host_os == "mac") {
    values += [ "ASAN_TEST_DYNAMIC=1" ]
  } else {
    values += [ "ASAN_TEST_DYNAMIC=0" ]
  }
}

if (current_toolchain != host_toolchain) {
  group("asan_toolchain") {
    deps = [
      ":lit_site_cfg",
      "//compiler-rt/include($host_toolchain)",
      "//compiler-rt/lib/asan",
      "//compiler-rt/lib/asan:ignorelist($host_toolchain)",
      "//compiler-rt/lib/profile",
      "//compiler-rt/test:lit_common_configured",
      "//llvm/tools/llvm-nm($host_toolchain)",
      "//llvm/tools/llvm-objdump($host_toolchain)",
      "//llvm/tools/llvm-readobj($host_toolchain)",
      "//llvm/tools/llvm-size($host_toolchain)",
      "//llvm/tools/llvm-symbolizer($host_toolchain)",
      "//llvm/tools/sancov($host_toolchain)",
      "//llvm/utils/FileCheck($host_toolchain)",
      "//llvm/utils/count($host_toolchain)",
      "//llvm/utils/llvm-lit($host_toolchain)",
      "//llvm/utils/not($host_toolchain)",
      "//llvm/utils/split-file($host_toolchain)",
    ]
  }
}

supported_toolchains = []
if (host_os == "linux" || host_os == "mac") {
  supported_toolchains += [ "//llvm/utils/gn/build/toolchain:stage2_unix" ]
} else if (host_os == "win") {
  supported_toolchains += [ "//llvm/utils/gn/build/toolchain:stage2_win_x64" ]
}

group("asan") {
  deps = []
  foreach(toolchain, supported_toolchains) {
    deps += [ ":asan_toolchain($toolchain)" ]
  }
}

if (supported_toolchains != []) {
  action("check-asan") {
    script = "$root_build_dir/bin/llvm-lit"
    if (host_os == "win") {
      script += ".py"
    }
    args = [ "-sv" ]
    foreach(toolchain, supported_toolchains) {
      args += [ rebase_path(
              get_label_info(":lit_site_cfg($toolchain)", "target_gen_dir"),
              root_build_dir) ]
    }
    outputs = [ "$target_gen_dir/run-lit" ]  # Non-existing, so that ninja runs
                                             # it each time.

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

    pool = "//:console"
  }
}