BUILD.gn 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435
  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. import("//build/config/dcheck_always_on.gni")
  5. import("//build/config/ozone.gni")
  6. import("//build/config/sysroot.gni")
  7. import("//build/config/ui.gni")
  8. import("//build/toolchain/gcc_toolchain.gni")
  9. clang_toolchain("clang_ppc64") {
  10. enable_linker_map = true
  11. toolchain_args = {
  12. current_cpu = "ppc64"
  13. current_os = "linux"
  14. }
  15. }
  16. clang_toolchain("clang_arm") {
  17. toolchain_args = {
  18. current_cpu = "arm"
  19. current_os = "linux"
  20. }
  21. }
  22. clang_toolchain("clang_arm64") {
  23. toolchain_args = {
  24. current_cpu = "arm64"
  25. current_os = "linux"
  26. }
  27. }
  28. gcc_toolchain("arm64") {
  29. toolprefix = "aarch64-linux-gnu-"
  30. cc = "${toolprefix}gcc"
  31. cxx = "${toolprefix}g++"
  32. ar = "${toolprefix}ar"
  33. ld = cxx
  34. readelf = "${toolprefix}readelf"
  35. nm = "${toolprefix}nm"
  36. toolchain_args = {
  37. current_cpu = "arm64"
  38. current_os = "linux"
  39. # reclient does not support gcc.
  40. use_remoteexec = false
  41. is_clang = false
  42. }
  43. }
  44. gcc_toolchain("arm") {
  45. toolprefix = "arm-linux-gnueabihf-"
  46. cc = "${toolprefix}gcc"
  47. cxx = "${toolprefix}g++"
  48. ar = "${toolprefix}ar"
  49. ld = cxx
  50. readelf = "${toolprefix}readelf"
  51. nm = "${toolprefix}nm"
  52. toolchain_args = {
  53. current_cpu = "arm"
  54. current_os = "linux"
  55. # reclient does not support gcc.
  56. use_remoteexec = false
  57. is_clang = false
  58. }
  59. }
  60. clang_toolchain("clang_x86") {
  61. # Output linker map files for binary size analysis.
  62. enable_linker_map = true
  63. toolchain_args = {
  64. current_cpu = "x86"
  65. current_os = "linux"
  66. }
  67. }
  68. gcc_toolchain("x86") {
  69. cc = "gcc"
  70. cxx = "g++"
  71. readelf = "readelf"
  72. nm = "nm"
  73. ar = "ar"
  74. ld = cxx
  75. # Output linker map files for binary size analysis.
  76. enable_linker_map = true
  77. toolchain_args = {
  78. current_cpu = "x86"
  79. current_os = "linux"
  80. # reclient does not support gcc.
  81. use_remoteexec = false
  82. is_clang = false
  83. }
  84. }
  85. clang_toolchain("clang_x64") {
  86. # Output linker map files for binary size analysis.
  87. enable_linker_map = true
  88. toolchain_args = {
  89. current_cpu = "x64"
  90. current_os = "linux"
  91. }
  92. }
  93. template("clang_v8_toolchain") {
  94. clang_toolchain(target_name) {
  95. toolchain_args = {
  96. current_os = "linux"
  97. forward_variables_from(invoker.toolchain_args, "*")
  98. }
  99. }
  100. }
  101. clang_v8_toolchain("clang_x86_v8_arm") {
  102. toolchain_args = {
  103. current_cpu = "x86"
  104. v8_current_cpu = "arm"
  105. }
  106. }
  107. clang_v8_toolchain("clang_x86_v8_mipsel") {
  108. toolchain_args = {
  109. current_cpu = "x86"
  110. v8_current_cpu = "mipsel"
  111. }
  112. }
  113. clang_v8_toolchain("clang_x86_v8_mips") {
  114. toolchain_args = {
  115. current_cpu = "x86"
  116. v8_current_cpu = "mips"
  117. }
  118. }
  119. clang_v8_toolchain("clang_x64_v8_arm64") {
  120. toolchain_args = {
  121. current_cpu = "x64"
  122. v8_current_cpu = "arm64"
  123. }
  124. }
  125. clang_v8_toolchain("clang_x64_v8_mips64el") {
  126. toolchain_args = {
  127. current_cpu = "x64"
  128. v8_current_cpu = "mips64el"
  129. }
  130. }
  131. clang_v8_toolchain("clang_x64_v8_mips64") {
  132. toolchain_args = {
  133. current_cpu = "x64"
  134. v8_current_cpu = "mips64"
  135. }
  136. }
  137. clang_v8_toolchain("clang_x64_v8_riscv64") {
  138. toolchain_args = {
  139. current_cpu = "x64"
  140. v8_current_cpu = "riscv64"
  141. use_lld = false
  142. }
  143. }
  144. clang_v8_toolchain("clang_x64_v8_loong64") {
  145. toolchain_args = {
  146. current_cpu = "x64"
  147. v8_current_cpu = "loong64"
  148. }
  149. }
  150. # In a LaCrOS build, this toolchain is intended to be used as an alternate
  151. # toolchain to build Ash-Chrome in a subdirectory.
  152. clang_toolchain("ash_clang_x64") {
  153. toolchain_args = {
  154. # This turns the toolchain into the "Linux ChromeOS" build
  155. current_os = "chromeos"
  156. target_os = "chromeos"
  157. current_cpu = current_cpu
  158. # This turns off all of the LaCrOS-specific flags.
  159. also_build_ash_chrome = false
  160. chromeos_is_browser_only = false
  161. use_clang_coverage = false
  162. }
  163. }
  164. # In an ash build, this toolchain is intended to be used as an alternate
  165. # toolchain to build lacros-Chrome in a subdirectory.
  166. clang_toolchain("lacros_clang_x64") {
  167. toolchain_args = {
  168. # This turns the toolchain into the "Lacros" build
  169. current_os = "chromeos"
  170. target_os = "chromeos"
  171. current_cpu = current_cpu
  172. # This turns on the LaCrOS-specific flag.
  173. also_build_lacros_chrome = false
  174. chromeos_is_browser_only = true
  175. use_clang_coverage = false
  176. dcheck_always_on = false
  177. symbol_level = 1
  178. }
  179. }
  180. gcc_toolchain("x64") {
  181. cc = "gcc"
  182. cxx = "g++"
  183. readelf = "readelf"
  184. nm = "nm"
  185. ar = "ar"
  186. ld = cxx
  187. # Output linker map files for binary size analysis.
  188. enable_linker_map = true
  189. toolchain_args = {
  190. current_cpu = "x64"
  191. current_os = "linux"
  192. # reclient does not support gcc.
  193. use_remoteexec = false
  194. is_clang = false
  195. }
  196. }
  197. clang_toolchain("clang_mipsel") {
  198. toolchain_args = {
  199. current_cpu = "mipsel"
  200. current_os = "linux"
  201. }
  202. }
  203. clang_toolchain("clang_mips64el") {
  204. toolchain_args = {
  205. current_cpu = "mips64el"
  206. current_os = "linux"
  207. }
  208. }
  209. gcc_toolchain("mipsel") {
  210. toolprefix = "mipsel-linux-gnu-"
  211. cc = "${toolprefix}gcc"
  212. cxx = " ${toolprefix}g++"
  213. ar = "${toolprefix}ar"
  214. ld = cxx
  215. readelf = "${toolprefix}readelf"
  216. nm = "${toolprefix}nm"
  217. toolchain_args = {
  218. cc_wrapper = ""
  219. current_cpu = "mipsel"
  220. current_os = "linux"
  221. # reclient does not support gcc.
  222. use_remoteexec = false
  223. is_clang = false
  224. use_goma = false
  225. }
  226. }
  227. gcc_toolchain("mips64el") {
  228. toolprefix = "mips64el-linux-gnuabi64-"
  229. cc = "${toolprefix}gcc"
  230. cxx = "${toolprefix}g++"
  231. ar = "${toolprefix}ar"
  232. ld = cxx
  233. readelf = "${toolprefix}readelf"
  234. nm = "${toolprefix}nm"
  235. toolchain_args = {
  236. cc_wrapper = ""
  237. current_cpu = "mips64el"
  238. current_os = "linux"
  239. # reclient does not support gcc.
  240. use_remoteexec = false
  241. is_clang = false
  242. use_goma = false
  243. }
  244. }
  245. clang_toolchain("clang_riscv64") {
  246. enable_linker_map = true
  247. toolchain_args = {
  248. current_cpu = "riscv64"
  249. current_os = "linux"
  250. is_clang = true
  251. }
  252. }
  253. gcc_toolchain("riscv64") {
  254. toolprefix = "riscv64-linux-gnu"
  255. cc = "${toolprefix}-gcc"
  256. cxx = "${toolprefix}-g++"
  257. readelf = "${toolprefix}-readelf"
  258. nm = "${toolprefix}-nm"
  259. ar = "${toolprefix}-ar"
  260. ld = cxx
  261. toolchain_args = {
  262. current_cpu = "riscv64"
  263. current_os = "linux"
  264. is_clang = false
  265. }
  266. }
  267. clang_toolchain("clang_s390x") {
  268. toolchain_args = {
  269. current_cpu = "s390x"
  270. current_os = "linux"
  271. is_clang = true
  272. }
  273. }
  274. gcc_toolchain("s390x") {
  275. cc = "gcc"
  276. cxx = "g++"
  277. readelf = "readelf"
  278. nm = "nm"
  279. ar = "ar"
  280. ld = cxx
  281. toolchain_args = {
  282. current_cpu = "s390x"
  283. current_os = "linux"
  284. # reclient does not support gcc.
  285. use_remoteexec = false
  286. is_clang = false
  287. }
  288. }
  289. gcc_toolchain("ppc64") {
  290. cc = "gcc"
  291. cxx = "g++"
  292. readelf = "readelf"
  293. nm = "nm"
  294. ar = "ar"
  295. ld = cxx
  296. toolchain_args = {
  297. current_cpu = "ppc64"
  298. current_os = "linux"
  299. # reclient does not support gcc.
  300. use_remoteexec = false
  301. is_clang = false
  302. }
  303. }
  304. gcc_toolchain("mips") {
  305. toolprefix = "mips-linux-gnu-"
  306. cc = "${toolprefix}gcc"
  307. cxx = "${toolprefix}g++"
  308. readelf = "${toolprefix}readelf"
  309. nm = "${toolprefix}nm"
  310. ar = "${toolprefix}ar"
  311. ld = cxx
  312. toolchain_args = {
  313. current_cpu = "mips"
  314. current_os = "linux"
  315. # reclient does not support gcc.
  316. use_remoteexec = false
  317. is_clang = false
  318. }
  319. }
  320. gcc_toolchain("mips64") {
  321. toolprefix = "mips64-linux-gnuabi64-"
  322. cc = "${toolprefix}gcc"
  323. cxx = "${toolprefix}g++"
  324. readelf = "${toolprefix}readelf"
  325. nm = "${toolprefix}nm"
  326. ar = "${toolprefix}ar"
  327. ld = cxx
  328. toolchain_args = {
  329. current_cpu = "mips64"
  330. current_os = "linux"
  331. # reclient does not support gcc.
  332. use_remoteexec = false
  333. is_clang = false
  334. }
  335. }
  336. clang_toolchain("clang_loong64") {
  337. toolchain_args = {
  338. current_cpu = "loong64"
  339. current_os = "linux"
  340. }
  341. }
  342. gcc_toolchain("loong64") {
  343. toolprefix = "loongarch64-linux-gnu"
  344. cc = "${toolprefix}-gcc"
  345. cxx = "${toolprefix}-g++"
  346. readelf = "${toolprefix}-readelf"
  347. nm = "${toolprefix}-nm"
  348. ar = "${toolprefix}-ar"
  349. ld = cxx
  350. toolchain_args = {
  351. current_cpu = "loong64"
  352. current_os = "linux"
  353. is_clang = false
  354. }
  355. }