Index: build/toolchain/cros/BUILD.gn |
diff --git a/build/toolchain/cros/BUILD.gn b/build/toolchain/cros/BUILD.gn |
index f313b4249f00522413f0ce51f43febd652cbd99a..0e32bb0f588be0bf5d63c8d5c9cea7599417d73f 100644 |
--- a/build/toolchain/cros/BUILD.gn |
+++ b/build/toolchain/cros/BUILD.gn |
@@ -36,36 +36,117 @@ import("//build/toolchain/gcc_toolchain.gni") |
declare_args() { |
# These must be specified for a board-specific build. |
- cros_target_cc = "" |
- cros_target_cxx = "" |
- cros_target_ar = "" |
+ cros_target_ar = "ar" |
+ cros_target_cc = "gcc" |
+ cros_target_cxx = "g++" |
+ cros_target_ld = "" |
+ |
+ # These can be optionally set. |
+ cros_target_extra_cflags = "" |
+ cros_target_extra_cppflags = "" |
+ cros_target_extra_cxxflags = "" |
+ cros_target_extra_ldflags = "" |
+ |
+ # is_clang is used instead of cros_target_is_clang |
+ |
+ cros_host_ar = "ar" |
+ cros_host_cc = "gcc" |
+ cros_host_cxx = "g++" |
+ cros_host_ld = "" |
+ cros_host_extra_cflags = "" |
+ cros_host_extra_cppflags = "" |
+ cros_host_extra_cxxflags = "" |
+ cros_host_extra_ldflags = "" |
+ cros_host_is_clang = false |
+ |
+ cros_v8_snapshot_ar = "ar" |
+ cros_v8_snapshot_cc = "gcc" |
+ cros_v8_snapshot_cxx = "g++" |
+ cros_v8_snapshot_ld = "" |
+ cros_v8_snapshot_extra_cflags = "" |
+ cros_v8_snapshot_extra_cppflags = "" |
+ cros_v8_snapshot_extra_cxxflags = "" |
+ cros_v8_snapshot_extra_ldflags = "" |
+ cros_v8_snapshot_is_clang = false |
} |
+# TODO(dpranke): Delete this after we get rid of the reference to |
+# build/toolchain/cros:clang_target in BUILDCONFIG.gn |
clang_toolchain("clang_target") { |
toolchain_cpu = target_cpu |
toolchain_os = "linux" |
} |
gcc_toolchain("target") { |
- # These defaults permit building on a Linux host as described above. |
- cc = "gcc" |
- cxx = "g++" |
- ar = "ar" |
+ # TODO(dpranke): change the cros_target_{cc,cxx,ar} vars to default |
+ # to empty strings, and then assert that they are non-empty (i.e., |
+ # set in args.gn) once we get rid of the reference to |
+ # build/toolchain/cros:target in BUILDCONFIG.gn |
hashimoto
2016/05/17 06:26:31
How are we going to use this toolchain after remov
hashimoto
2016/05/18 03:24:01
ping?
Dirk Pranke
2016/05/18 04:12:12
That's weird, I thought I wrote an answer for this
|
- # But to build for a specific board, the cros_* args will need to be defined. |
- if (cros_target_cc != "") { |
- cc = "${cros_target_cc}" |
- } |
- if (cros_target_cxx != "") { |
- cxx = "${cros_target_cxx}" |
- } |
- if (cros_target_ar != "") { |
- ar = "${cros_target_ar}" |
- } |
+ # These are args for the template. |
+ cc = cros_target_cc |
+ cxx = cros_target_cxx |
+ ar = cros_target_ar |
ld = cxx |
+ if (cros_target_ld != "") { |
+ ld = cros_target_ld |
+ } |
+ extra_cflags = cros_target_extra_cflags |
+ extra_cppflags = cros_target_extra_cppflags |
+ extra_cxxflags = cros_target_extra_cxxflags |
+ extra_ldflags = cros_target_extra_ldflags |
+ # These are passed through as toolchain_args. |
+ cc_wrapper = "" |
+ is_clang = is_clang |
toolchain_cpu = target_cpu |
toolchain_os = "linux" |
- is_clang = is_clang |
+} |
+ |
+gcc_toolchain("host") { |
+ # These are args for the template. |
+ ar = cros_host_ar |
hashimoto
2016/05/17 06:26:31
nit: Please make the order consistent ("cc cxx ar
Dirk Pranke
2016/05/17 21:37:45
Yup, that's unintentionally different. Will fix.
|
+ cc = cros_host_cc |
+ cxx = cros_host_cxx |
+ ld = cxx |
+ if (cros_host_ld != "") { |
+ ld = cros_host_ld |
+ } |
+ extra_cflags = cros_host_extra_cflags |
+ extra_cppflags = cros_host_extra_cppflags |
+ extra_cxxflags = cros_host_extra_cxxflags |
+ extra_ldflags = cros_host_extra_ldflags |
+ |
+ # These are passed through as toolchain_args. |
+ cc_wrapper = "" |
+ is_clang = cros_host_is_clang |
+ toolchain_cpu = host_cpu |
+ toolchain_os = "linux" |
+ use_sysroot = false |
+} |
+ |
+gcc_toolchain("v8_snapshot") { |
+ # These are args for the template. |
+ ar = cros_v8_snapshot_ar |
+ cc = cros_v8_snapshot_cc |
+ cxx = cros_v8_snapshot_cxx |
+ ld = cxx |
+ if (cros_v8_snapshot_ld != "") { |
+ ld = cros_v8_snapshot_ld |
+ } |
+ extra_cflags = cros_v8_snapshot_extra_cflags |
+ extra_cppflags = cros_v8_snapshot_extra_cppflags |
+ extra_cxxflags = cros_v8_snapshot_extra_cxxflags |
+ extra_ldflags = cros_v8_snapshot_extra_ldflags |
+ |
+ # These are passed through as toolchain_args. |
cc_wrapper = "" |
+ is_clang = cros_v8_snapshot_is_clang |
+ if (target_cpu == "x86" || target_cpu == "arm" || target_cpu == "mipsel") { |
+ toolchain_cpu = "x86" |
+ } else { |
+ toolchain_cpu = "x64" |
+ } |
+ toolchain_os = "linux" |
+ use_sysroot = false |
} |