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 # CrOS builds must cross-compile on a Linux host for the actual CrOS | 7 # CrOS builds must cross-compile on a Linux host for the actual CrOS |
8 # device target. There are many different CrOS devices so the build | 8 # device target. There are many different CrOS devices so the build |
9 # system provides configuration variables that permit a CrOS build to | 9 # system provides configuration variables that permit a CrOS build to |
10 # control the cross-compilation tool chain. However, requiring such | 10 # control the cross-compilation tool chain. However, requiring such |
(...skipping 18 matching lines...) Expand all Loading... | |
29 # | 29 # |
30 # goma_dir = "/g/.cros_cache/common/goma+2" | 30 # goma_dir = "/g/.cros_cache/common/goma+2" |
31 # target_sysroot= /g/.cros_cache/chrome-sdk/tarballs/auron_paine+7644.0.0+sysroo t_chromeos-base_chromeos-chrome.tar.xz" | 31 # target_sysroot= /g/.cros_cache/chrome-sdk/tarballs/auron_paine+7644.0.0+sysroo t_chromeos-base_chromeos-chrome.tar.xz" |
32 # cros_target_cc = "x86_64-cros-linux-gnu-gcc -B/g/.cros_cache/chrome-sdk/tarbal ls/auron_paine+7657.0.0+target_toolchain/usr/x86_64-pc-linux-gnu/x86_64-cros-lin ux-gnu/binutils-bin/2.25.51-gold" | 32 # cros_target_cc = "x86_64-cros-linux-gnu-gcc -B/g/.cros_cache/chrome-sdk/tarbal ls/auron_paine+7657.0.0+target_toolchain/usr/x86_64-pc-linux-gnu/x86_64-cros-lin ux-gnu/binutils-bin/2.25.51-gold" |
33 # cros_target_cxx = "x86_64-cros-linux-gnu-g++ -B/g/.cros_cache/chrome-sdk/tarba lls/auron_paine+7657.0.0+target_toolchain/usr/x86_64-pc-linux-gnu/x86_64-cros-li nux-gnu/binutils-bin/2.25.51-gold" | 33 # cros_target_cxx = "x86_64-cros-linux-gnu-g++ -B/g/.cros_cache/chrome-sdk/tarba lls/auron_paine+7657.0.0+target_toolchain/usr/x86_64-pc-linux-gnu/x86_64-cros-li nux-gnu/binutils-bin/2.25.51-gold" |
34 # cros_target_ar = "x86_64-cros-linux-gnu-gcc-ar" | 34 # cros_target_ar = "x86_64-cros-linux-gnu-gcc-ar" |
35 # target_cpu = "x64" | 35 # target_cpu = "x64" |
36 | 36 |
37 declare_args() { | 37 declare_args() { |
38 # These must be specified for a board-specific build. | 38 # These must be specified for a board-specific build. |
39 cros_target_cc = "" | 39 cros_target_ar = "ar" |
40 cros_target_cxx = "" | 40 cros_target_cc = "gcc" |
41 cros_target_ar = "" | 41 cros_target_cxx = "g++" |
42 cros_target_ld = "" | |
43 | |
44 # These can be optionally set. | |
45 cros_target_extra_cflags = "" | |
46 cros_target_extra_cppflags = "" | |
47 cros_target_extra_cxxflags = "" | |
48 cros_target_extra_ldflags = "" | |
49 | |
50 # is_clang is used instead of cros_target_is_clang | |
51 | |
52 cros_host_ar = "ar" | |
53 cros_host_cc = "gcc" | |
54 cros_host_cxx = "g++" | |
55 cros_host_ld = "" | |
56 cros_host_extra_cflags = "" | |
57 cros_host_extra_cppflags = "" | |
brettw
2016/05/23 20:55:04
It would be nice if this had a similar comment as
Dirk Pranke
2016/05/23 20:59:15
yeah ... I waffled over how many comments I wanted
| |
58 cros_host_extra_cxxflags = "" | |
59 cros_host_extra_ldflags = "" | |
60 cros_host_is_clang = false | |
61 | |
62 cros_v8_snapshot_ar = "ar" | |
63 cros_v8_snapshot_cc = "gcc" | |
64 cros_v8_snapshot_cxx = "g++" | |
65 cros_v8_snapshot_ld = "" | |
66 cros_v8_snapshot_extra_cflags = "" | |
67 cros_v8_snapshot_extra_cppflags = "" | |
68 cros_v8_snapshot_extra_cxxflags = "" | |
69 cros_v8_snapshot_extra_ldflags = "" | |
70 cros_v8_snapshot_is_clang = false | |
42 } | 71 } |
43 | 72 |
73 # TODO(dpranke): Delete this after we get rid of the reference to | |
74 # build/toolchain/cros:clang_target in BUILDCONFIG.gn | |
44 clang_toolchain("clang_target") { | 75 clang_toolchain("clang_target") { |
45 toolchain_cpu = target_cpu | 76 toolchain_cpu = target_cpu |
46 toolchain_os = "linux" | 77 toolchain_os = "linux" |
47 } | 78 } |
48 | 79 |
49 gcc_toolchain("target") { | 80 gcc_toolchain("target") { |
50 # These defaults permit building on a Linux host as described above. | 81 # These are args for the template. |
51 cc = "gcc" | 82 ar = cros_target_ar |
52 cxx = "g++" | 83 cc = cros_target_cc |
53 ar = "ar" | 84 cxx = cros_target_cxx |
85 ld = cxx | |
86 if (cros_target_ld != "") { | |
87 ld = cros_target_ld | |
88 } | |
89 extra_cflags = cros_target_extra_cflags | |
90 extra_cppflags = cros_target_extra_cppflags | |
91 extra_cxxflags = cros_target_extra_cxxflags | |
92 extra_ldflags = cros_target_extra_ldflags | |
54 | 93 |
55 # But to build for a specific board, the cros_* args will need to be defined. | 94 # These are passed through as toolchain_args. |
56 if (cros_target_cc != "") { | 95 cc_wrapper = "" |
57 cc = "${cros_target_cc}" | 96 is_clang = is_clang |
58 } | |
59 if (cros_target_cxx != "") { | |
60 cxx = "${cros_target_cxx}" | |
61 } | |
62 if (cros_target_ar != "") { | |
63 ar = "${cros_target_ar}" | |
64 } | |
65 ld = cxx | |
66 | |
67 toolchain_cpu = target_cpu | 97 toolchain_cpu = target_cpu |
68 toolchain_os = "linux" | 98 toolchain_os = "linux" |
69 is_clang = is_clang | 99 } |
100 | |
101 gcc_toolchain("host") { | |
102 # These are args for the template. | |
103 ar = cros_host_ar | |
104 cc = cros_host_cc | |
105 cxx = cros_host_cxx | |
106 ld = cxx | |
107 if (cros_host_ld != "") { | |
108 ld = cros_host_ld | |
109 } | |
110 extra_cflags = cros_host_extra_cflags | |
111 extra_cppflags = cros_host_extra_cppflags | |
112 extra_cxxflags = cros_host_extra_cxxflags | |
113 extra_ldflags = cros_host_extra_ldflags | |
114 | |
115 # These are passed through as toolchain_args. | |
70 cc_wrapper = "" | 116 cc_wrapper = "" |
117 is_clang = cros_host_is_clang | |
118 toolchain_cpu = host_cpu | |
119 toolchain_os = "linux" | |
120 use_sysroot = false | |
71 } | 121 } |
122 | |
123 gcc_toolchain("v8_snapshot") { | |
124 # These are args for the template. | |
125 ar = cros_v8_snapshot_ar | |
126 cc = cros_v8_snapshot_cc | |
127 cxx = cros_v8_snapshot_cxx | |
128 ld = cxx | |
129 if (cros_v8_snapshot_ld != "") { | |
130 ld = cros_v8_snapshot_ld | |
131 } | |
132 extra_cflags = cros_v8_snapshot_extra_cflags | |
133 extra_cppflags = cros_v8_snapshot_extra_cppflags | |
134 extra_cxxflags = cros_v8_snapshot_extra_cxxflags | |
135 extra_ldflags = cros_v8_snapshot_extra_ldflags | |
136 | |
137 # These are passed through as toolchain_args. | |
138 cc_wrapper = "" | |
139 is_clang = cros_v8_snapshot_is_clang | |
140 if (target_cpu == "x86" || target_cpu == "arm" || target_cpu == "mipsel") { | |
141 toolchain_cpu = "x86" | |
142 } else { | |
143 toolchain_cpu = "x64" | |
144 } | |
145 toolchain_os = "linux" | |
146 use_sysroot = false | |
147 } | |
OLD | NEW |