Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Side by Side Diff: gn/BUILD.gn

Issue 2281163002: GN: support compiler_prefix, use it for ccache on bots. (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | infra/bots/recipe_modules/flavor/gn_flavor.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2016 Google Inc. 1 # Copyright 2016 Google Inc.
2 # 2 #
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 declare_args() { 6 declare_args() {
7 ar = "ar" 7 ar = "ar"
8 cc = "cc" 8 cc = "cc"
9 cxx = "c++" 9 cxx = "c++"
10 10
11 if (is_android) { 11 if (is_android) {
12 ar = "$ndk/toolchains/$ndk_gccdir-4.9/prebuilt/$ndk_host/$ndk_target/bin/ar" 12 ar = "$ndk/toolchains/$ndk_gccdir-4.9/prebuilt/$ndk_host/$ndk_target/bin/ar"
13 cc = "$ndk/toolchains/llvm/prebuilt/$ndk_host/bin/clang" 13 cc = "$ndk/toolchains/llvm/prebuilt/$ndk_host/bin/clang"
14 cxx = "$ndk/toolchains/llvm/prebuilt/$ndk_host/bin/clang++" 14 cxx = "$ndk/toolchains/llvm/prebuilt/$ndk_host/bin/clang++"
15 } 15 }
16 16
17 extra_cflags = "" 17 extra_cflags = ""
18 extra_cflags_c = "" 18 extra_cflags_c = ""
19 extra_cflags_cc = "" 19 extra_cflags_cc = ""
20
21 compiler_prefix = ""
20 } 22 }
21 23
22 config("no_rtti") { 24 config("no_rtti") {
23 cflags_cc = [ "-fno-rtti" ] 25 cflags_cc = [ "-fno-rtti" ]
24 } 26 }
25 27
26 config("default") { 28 config("default") {
27 cflags = [ 29 cflags = [
28 "-g", 30 "-g",
29 "-fstrict-aliasing", 31 "-fstrict-aliasing",
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 pool("link_pool") { 120 pool("link_pool") {
119 depth = 0 #unlimited 121 depth = 0 #unlimited
120 } 122 }
121 123
122 toolchain("gcc_like") { 124 toolchain("gcc_like") {
123 lib_switch = "-l" 125 lib_switch = "-l"
124 lib_dir_switch = "-L" 126 lib_dir_switch = "-L"
125 127
126 tool("cc") { 128 tool("cc") {
127 depfile = "{{output}}.d" 129 depfile = "{{output}}.d"
128 command = "$cc -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{c flags_c}} $extra_cflags $extra_cflags_c -c {{source}} -o {{output}}" 130 command = "$compiler_prefix $cc -MMD -MF $depfile {{defines}} {{include_dirs }} {{cflags}} {{cflags_c}} $extra_cflags $extra_cflags_c -c {{source}} -o {{outp ut}}"
129 depsformat = "gcc" 131 depsformat = "gcc"
130 outputs = [ 132 outputs = [
131 "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o", 133 "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o",
132 ] 134 ]
133 description = "$cc ... $extra_cflags $extra_cflags_c -o {{output}}" 135 description =
136 "$compiler_prefix $cc ... $extra_cflags $extra_cflags_c -o {{output}}"
134 } 137 }
135 138
136 tool("cxx") { 139 tool("cxx") {
137 depfile = "{{output}}.d" 140 depfile = "{{output}}.d"
138 command = "$cxx -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{ cflags_cc}} $extra_cflags $extra_cflags_cc -c {{source}} -o {{output}}" 141 command = "$compiler_prefix $cxx -MMD -MF $depfile {{defines}} {{include_dir s}} {{cflags}} {{cflags_cc}} $extra_cflags $extra_cflags_cc -c {{source}} -o {{o utput}}"
139 depsformat = "gcc" 142 depsformat = "gcc"
140 outputs = [ 143 outputs = [
141 "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o", 144 "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o",
142 ] 145 ]
143 description = "$cxx ... $extra_cflags $extra_cflags_cc -o {{output}}" 146 description =
147 "$compiler_prefix $cxx ... $extra_cflags $extra_cflags_cc -o {{output}}"
144 } 148 }
145 149
146 tool("asm") { 150 tool("asm") {
147 depfile = "{{output}}.d" 151 depfile = "{{output}}.d"
148 command = "$cc -MMD -MF $depfile {{defines}} {{include_dirs}} {{asmflags}} - c {{source}} -o {{output}}" 152 command = "$compiler_prefix $cc -MMD -MF $depfile {{defines}} {{include_dirs }} {{asmflags}} -c {{source}} -o {{output}}"
149 depsformat = "gcc" 153 depsformat = "gcc"
150 outputs = [ 154 outputs = [
151 "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o", 155 "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o",
152 ] 156 ]
153 description = "$cc ... -o {{output}}" 157 description = "$compiler_prefix $cc ... -o {{output}}"
154 } 158 }
155 159
156 tool("alink") { 160 tool("alink") {
157 command = "rm -f {{output}} && $ar rcs {{output}} {{inputs}}" 161 command = "rm -f {{output}} && $ar rcs {{output}} {{inputs}}"
158 outputs = [ 162 outputs = [
159 "{{root_out_dir}}/{{target_output_name}}{{output_extension}}", 163 "{{root_out_dir}}/{{target_output_name}}{{output_extension}}",
160 ] 164 ]
161 default_output_extension = ".a" 165 default_output_extension = ".a"
162 output_prefix = "lib" 166 output_prefix = "lib"
163 description = "$ar {{output}} ..." 167 description = "$ar {{output}} ..."
164 } 168 }
165 169
166 tool("solink") { 170 tool("solink") {
167 soname = "{{target_output_name}}{{output_extension}}" 171 soname = "{{target_output_name}}{{output_extension}}"
168 172
169 rpath = "-Wl,-soname,$soname" 173 rpath = "-Wl,-soname,$soname"
170 if (is_mac) { 174 if (is_mac) {
171 rpath = "-Wl,-install_name,@rpath/$soname" 175 rpath = "-Wl,-install_name,@rpath/$soname"
172 } 176 }
173 177
174 command = "$cxx -shared {{ldflags}} {{inputs}} {{solibs}} {{libs}} $rpath -o {{output}}" 178 command = "$compiler_prefix $cxx -shared {{ldflags}} {{inputs}} {{solibs}} { {libs}} $rpath -o {{output}}"
175 outputs = [ 179 outputs = [
176 "{{root_out_dir}}/$soname", 180 "{{root_out_dir}}/$soname",
177 ] 181 ]
178 output_prefix = "lib" 182 output_prefix = "lib"
179 default_output_extension = ".so" 183 default_output_extension = ".so"
180 description = "$cxx -shared ... -o {{output}}" 184 description = "$compiler_prefix $cxx -shared ... -o {{output}}"
181 pool = ":link_pool" 185 pool = ":link_pool"
182 } 186 }
183 187
184 tool("link") { 188 tool("link") {
185 command = "$cxx {{ldflags}} {{inputs}} {{solibs}} {{libs}} -o {{output}}" 189 command = "$compiler_prefix $cxx {{ldflags}} {{inputs}} {{solibs}} {{libs}} -o {{output}}"
186 outputs = [ 190 outputs = [
187 "{{root_out_dir}}/{{target_output_name}}{{output_extension}}", 191 "{{root_out_dir}}/{{target_output_name}}{{output_extension}}",
188 ] 192 ]
189 description = "$cxx ... -o {{output}}" 193 description = "$compiler_prefix $cxx ... -o {{output}}"
190 pool = ":link_pool" 194 pool = ":link_pool"
191 } 195 }
192 196
193 tool("stamp") { 197 tool("stamp") {
194 command = "touch {{output}}" 198 command = "touch {{output}}"
195 } 199 }
196 200
197 tool("copy") { 201 tool("copy") {
198 command = "ln -f {{source}} {{output}} 2>/dev/null || (rm -rf {{output}} && cp -af {{source}} {{output}})" 202 command = "ln -f {{source}} {{output}} 2>/dev/null || (rm -rf {{output}} && cp -af {{source}} {{output}})"
199 } 203 }
200 } 204 }
OLDNEW
« no previous file with comments | « no previous file | infra/bots/recipe_modules/flavor/gn_flavor.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698