1# Copyright 2013 The Chromium Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5import("//build/config/sysroot.gni")
6import("//build/toolchain/gcc_toolchain.gni")
7
8if (!is_arkui_x) {
9  import("//build/rust/rustc_toolchain.gni")
10}
11
12clang_toolchain("clang_arm") {
13  toolprefix = "arm-linux-gnueabihf-"
14  toolchain_args = {
15    current_cpu = "arm"
16    current_os = "linux"
17  }
18}
19
20clang_toolchain("clang_arm64") {
21  toolprefix = "aarch64-linux-gnu-"
22  toolchain_args = {
23    current_cpu = "arm64"
24    current_os = "linux"
25  }
26}
27
28clang_toolchain("clang_riscv64") {
29  toolprefix = "riscv64-unknown-linux-gnu-"
30  toolchain_args = {
31    current_cpu = "riscv64"
32    current_os = "linux"
33  }
34}
35
36gcc_toolchain("arm64") {
37  toolprefix = "aarch64-linux-gnu-"
38
39  cc = "${toolprefix}gcc"
40  cxx = "${toolprefix}g++"
41
42  ar = "${toolprefix}ar"
43  ld = cxx
44  readelf = "${toolprefix}readelf"
45  nm = "${toolprefix}nm"
46
47  toolchain_args = {
48    current_cpu = "arm64"
49    current_os = "linux"
50    is_clang = false
51  }
52}
53
54gcc_toolchain("arm") {
55  toolprefix = "arm-linux-gnueabihf-"
56
57  cc = "${toolprefix}gcc"
58  cxx = "${toolprefix}g++"
59
60  ar = "${toolprefix}ar"
61  ld = cxx
62  readelf = "${toolprefix}readelf"
63  nm = "${toolprefix}nm"
64
65  toolchain_args = {
66    current_cpu = "arm"
67    current_os = "linux"
68    is_clang = false
69  }
70}
71
72gcc_toolchain("riscv64") {
73  toolprefix = "riscv64-unknown-linux-gnu-"
74
75  cc = "${toolprefix}gcc"
76  cxx = "${toolprefix}g++"
77
78  ar = "${toolprefix}ar"
79  ld = cxx
80  readelf = "${toolprefix}readelf"
81  nm = "${toolprefix}nm"
82
83  toolchain_args = {
84    current_cpu = "riscv64"
85    current_os = "linux"
86    is_clang = false
87  }
88}
89
90clang_toolchain("clang_x86") {
91  # Output linker map files for binary size analysis.
92  enable_linker_map = true
93
94  toolchain_args = {
95    current_cpu = "x86"
96    current_os = "linux"
97  }
98}
99
100gcc_toolchain("x86") {
101  cc = "gcc"
102  cxx = "g++"
103
104  readelf = "readelf"
105  nm = "nm"
106  ar = "ar"
107  ld = cxx
108
109  # Output linker map files for binary size analysis.
110  enable_linker_map = true
111
112  toolchain_args = {
113    current_cpu = "x86"
114    current_os = "linux"
115    is_clang = false
116  }
117}
118
119clang_toolchain("clang_x64") {
120  # Output linker map files for binary size analysis.
121  enable_linker_map = true
122
123  strip = rebase_path("${clang_base_path}/bin/llvm-strip", root_build_dir)
124  toolchain_args = {
125    current_cpu = "x64"
126    current_os = "linux"
127  }
128  shlib_extension = ".so"
129  if (!is_arkui_x) {
130    rust_abi_target = "x86_64-unknown-linux-gnu"
131  }
132}
133
134gcc_toolchain("x64") {
135  cc = "gcc"
136  cxx = "g++"
137
138  readelf = "readelf"
139  nm = "nm"
140  ar = "ar"
141  ld = cxx
142
143  # Output linker map files for binary size analysis.
144  enable_linker_map = true
145
146  toolchain_args = {
147    current_cpu = "x64"
148    current_os = "linux"
149    is_clang = false
150  }
151}
152