| OLD | NEW |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import("//build/toolchain/gcc_toolchain.gni") | 5 import("//build/toolchain/gcc_toolchain.gni") |
| 6 | 6 |
| 7 declare_args() { | 7 declare_args() { |
| 8 # The CrOS build system supports many different kinds of targets across | 8 # The CrOS build system supports many different kinds of targets across |
| 9 # many different architectures. Bringing your own toolchain is also supported, | 9 # many different architectures. Bringing your own toolchain is also supported, |
| 10 # so it's actually impossible to enumerate all toolchains for all targets | 10 # so it's actually impossible to enumerate all toolchains for all targets |
| 11 # as GN toolchain specifications. | 11 # as GN toolchain specifications. |
| 12 # These arguments provide a mechanism for specifying your CC, CXX and AR at | 12 # These arguments provide a mechanism for specifying your CC, CXX and AR at |
| 13 # buildfile-generation time, allowing the CrOS build system to always use | 13 # buildfile-generation time, allowing the CrOS build system to always use |
| 14 # the right tools for the current target. | 14 # the right tools for the current target. |
| 15 cros_target_cc = "" | 15 cros_target_cc = "" |
| 16 cros_target_cxx = "" | 16 cros_target_cxx = "" |
| 17 cros_target_ar = "" | 17 cros_target_ar = "" |
| 18 } | 18 } |
| 19 | 19 |
| 20 gcc_toolchain("target") { | 20 clang_toolchain("clang_x64") { |
| 21 assert(cros_target_cc != "", "Must provide target CC.") | 21 toolchain_cpu = "x64" |
| 22 assert(cros_target_cxx != "", "Must provide target CXX.") | 22 toolchain_os = "linux" |
| 23 assert(cros_target_ar != "", "Must provide target AR.") | 23 } |
| 24 | 24 |
| 25 cc = "${cros_target_cc}" | 25 gcc_toolchain("x64") { |
| 26 cxx = "${cros_target_cxx}" | 26 # These defaults permit building on a Linux host. |
| 27 cc = "gcc" |
| 28 cxx = "g++" |
| 29 ar = "ar" |
| 27 | 30 |
| 28 ar = "${cros_target_ar}" | 31 # But to build for a specific board, the cros_* args will need to be defined. |
| 32 if (cros_target_cc != "") { |
| 33 cc = "${cros_target_cc}" |
| 34 } |
| 35 if (cros_target_cxx != "") { |
| 36 cxx = "${cros_target_cxx}" |
| 37 } |
| 38 if (cros_target_ar != "") { |
| 39 ar = "${cros_target_ar}" |
| 40 } |
| 29 ld = cxx | 41 ld = cxx |
| 30 | 42 |
| 31 toolchain_cpu = "${target_cpu}" | 43 toolchain_cpu = "x64" |
| 32 toolchain_os = "linux" | 44 toolchain_os = "linux" |
| 33 is_clang = is_clang | 45 is_clang = is_clang |
| 34 use_ccache = false | 46 use_ccache = false |
| 35 use_goma = false | |
| 36 } | 47 } |
| 48 |
| 49 clang_toolchain("clang_x86") { |
| 50 toolchain_cpu = "x86" |
| 51 toolchain_os = "linux" |
| 52 } |
| 53 |
| 54 gcc_toolchain("x86") { |
| 55 cc = "gcc" |
| 56 cxx = "g++" |
| 57 |
| 58 readelf = "readelf" |
| 59 nm = "nm" |
| 60 ar = "ar" |
| 61 ld = cxx |
| 62 |
| 63 # To build for a specific board, the cros_* args will need to be defined. |
| 64 if (cros_target_cc != "") { |
| 65 cc = "${cros_target_cc}" |
| 66 } |
| 67 if (cros_target_cxx != "") { |
| 68 cxx = "${cros_target_cxx}" |
| 69 } |
| 70 if (cros_target_ar != "") { |
| 71 ar = "${cros_target_ar}" |
| 72 } |
| 73 |
| 74 toolchain_cpu = "x86" |
| 75 toolchain_os = "linux" |
| 76 is_clang = false |
| 77 } |
| OLD | NEW |