summaryrefslogtreecommitdiff
path: root/llvm/utils/gn/build/toolchain/target_flags.gni
blob: 6b6373a00937a808a4bf3aa8115c2d4eb3af03a3 (plain)
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
import("//llvm/triples.gni")
import("//llvm/utils/gn/build/toolchain/compiler.gni")

target_flags = []
target_cflags = []
target_ldflags = []

if (current_os == "android") {
  assert(current_cpu == "arm64", "current_cpu not supported")

  libcxx_path = "$android_ndk_path/sources/cxx-stl/llvm-libc++"
  platform_lib_path =
      "$android_ndk_path/platforms/android-21/arch-arm64/usr/lib"
  libgcc_path = "$android_ndk_path/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/lib/gcc/aarch64-linux-android/4.9.x"

  target_flags += [
    "--target=$llvm_current_triple",
    "--sysroot=$android_ndk_path/sysroot",
  ]
  target_cflags += [
    "-isystem",
    "$libcxx_path/include",
  ]
  target_ldflags += [
    "-B$platform_lib_path",
    "-L$platform_lib_path",
    "-L$libgcc_path",
  ]
  target_ldflags += [
    "-nostdlib++",
    "-L$libcxx_path/libs/arm64-v8a",
    "-l:libc++.a.21",
  ]
}