File: target_flags.gni

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 (62 lines) | stat: -rw-r--r-- 1,597 bytes parent folder | download | duplicates (2)
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
import("//llvm/triples.gni")
import("//llvm/utils/gn/build/mac_sdk.gni")
import("//llvm/utils/gn/build/toolchain/compiler.gni")

# Flags in this file are passed both to the compiler that's building
# compiler-rt at build time (via normal gn cflags/ldflags), as well as to the
# compiler building compiler-rt test programs at test time (via
# COMPILER_RT_TEST_COMPILER_CFLAGS).

target_flags = []
target_ldflags = []

if (current_os == "android") {
  target_flags += [
    "--target=$llvm_current_triple",
    "--sysroot=$android_ndk_path/toolchains/llvm/prebuilt/linux-x86_64/sysroot",
    "--gcc-toolchain=$android_ndk_path/toolchains/llvm/prebuilt/linux-x86_64",
    "-fno-emulated-tls",
  ]
  target_ldflags += [
    "-static-libstdc++",
    "--unwindlib=none",
  ]
  if (current_cpu == "arm") {
    target_flags += [ "-march=armv7-a" ]
  }
} else if (current_os == "ios" || current_os == "mac") {
  if (current_cpu == "arm64") {
    target_flags += [
      "-arch",
      "arm64",
    ]
    target_ldflags += [
      "-arch",
      "arm64",
    ]
  } else if (current_cpu == "x64") {
    target_flags += [
      "-arch",
      "x86_64",
    ]
    target_ldflags += [
      "-arch",
      "x86_64",
    ]
  }
  if (current_os == "mac") {
    target_flags += [
      "-isysroot",
      mac_sdk_path,
      # TODO(lgrey): We should be getting this from `compiler_defaults`. Why
      # aren't we?
    "-mmacos-version-min=10.10",
    ]
  }
} else if (current_os == "baremetal") {
  target_flags += [ "--target=$llvm_current_triple" ]
}

if (current_cpu == "x86") {
  target_flags += [ "-m32" ]
}