OLD | NEW |
1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2013 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 # TODO(brettw) Use "gcc_toolchain.gni" like the Linux toolchains. This requires | 5 # TODO(brettw) Use "gcc_toolchain.gni" like the Linux toolchains. This requires |
6 # some enhancements since the commands on Mac are slightly different than on | 6 # some enhancements since the commands on Mac are slightly different than on |
7 # Linux. | 7 # Linux. |
8 | 8 |
9 import("../goma.gni") | 9 import("../goma.gni") |
10 import("//build/config/clang/clang.gni") | 10 import("//build/config/clang/clang.gni") |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 lib_dir_switch = "-L" | 107 lib_dir_switch = "-L" |
108 | 108 |
109 # Object files go in this directory. Use label_name instead of | 109 # Object files go in this directory. Use label_name instead of |
110 # target_output_name since labels will generally have no spaces and will be | 110 # target_output_name since labels will generally have no spaces and will be |
111 # unique in the directory. | 111 # unique in the directory. |
112 object_subdir = "{{target_out_dir}}/{{label_name}}" | 112 object_subdir = "{{target_out_dir}}/{{label_name}}" |
113 | 113 |
114 # If dSYMs are enabled, this flag will be added to the link tools. | 114 # If dSYMs are enabled, this flag will be added to the link tools. |
115 if (_enable_dsyms) { | 115 if (_enable_dsyms) { |
116 dsym_switch = " -Wcrl,dsym,{{root_out_dir}} " | 116 dsym_switch = " -Wcrl,dsym,{{root_out_dir}} " |
117 _dsym_output = | 117 dsym_output_dir = |
118 "{{root_out_dir}}/{{target_output_name}}{{output_extension}}.dSYM/" | 118 "{{root_out_dir}}/{{target_output_name}}{{output_extension}}.dSYM" |
| 119 dsym_output = [ |
| 120 "$dsym_output_dir/", |
| 121 "$dsym_output_dir/Contents/Info.plist", |
| 122 "$dsym_output_dir/Contents/Resources/DWARF/" + |
| 123 "{{target_output_name}}{{output_extension}}", |
| 124 ] |
119 } else { | 125 } else { |
120 dsym_switch = "" | 126 dsym_switch = "" |
121 } | 127 } |
122 | 128 |
123 if (_save_unstripped_output) { | 129 if (_save_unstripped_output) { |
124 _unstripped_output = "{{root_out_dir}}/{{target_output_name}}{{output_exte
nsion}}.unstripped" | 130 _unstripped_output = "{{root_out_dir}}/{{target_output_name}}{{output_exte
nsion}}.unstripped" |
125 } | 131 } |
126 | 132 |
127 tool("cc") { | 133 tool("cc") { |
128 depfile = "{{output}}.d" | 134 depfile = "{{output}}.d" |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 # Tell GN about the output files. It will link to the dylib but use the | 248 # Tell GN about the output files. It will link to the dylib but use the |
243 # tocname for dependency management. | 249 # tocname for dependency management. |
244 outputs = [ | 250 outputs = [ |
245 dylib, | 251 dylib, |
246 tocname, | 252 tocname, |
247 ] | 253 ] |
248 link_output = dylib | 254 link_output = dylib |
249 depend_output = tocname | 255 depend_output = tocname |
250 | 256 |
251 if (_enable_dsyms) { | 257 if (_enable_dsyms) { |
252 outputs += [ _dsym_output ] | 258 outputs += dsym_output |
253 } | 259 } |
254 if (_save_unstripped_output) { | 260 if (_save_unstripped_output) { |
255 outputs += [ _unstripped_output ] | 261 outputs += [ _unstripped_output ] |
256 } | 262 } |
257 } | 263 } |
258 | 264 |
259 tool("solink_module") { | 265 tool("solink_module") { |
260 sofile = "{{output_dir}}/{{target_output_name}}{{output_extension}}" # eg
"./libfoo.so" | 266 sofile = "{{output_dir}}/{{target_output_name}}{{output_extension}}" # eg
"./libfoo.so" |
261 rspfile = sofile + ".rsp" | 267 rspfile = sofile + ".rsp" |
262 pool = "//build/toolchain:link_pool($default_toolchain)" | 268 pool = "//build/toolchain:link_pool($default_toolchain)" |
(...skipping 14 matching lines...) Expand all Loading... |
277 # overrides it (in which case {{output_extension}} will be what the target | 283 # overrides it (in which case {{output_extension}} will be what the target |
278 # specifies). | 284 # specifies). |
279 default_output_dir = "{{root_out_dir}}" | 285 default_output_dir = "{{root_out_dir}}" |
280 default_output_extension = ".so" | 286 default_output_extension = ".so" |
281 | 287 |
282 outputs = [ | 288 outputs = [ |
283 sofile, | 289 sofile, |
284 ] | 290 ] |
285 | 291 |
286 if (_enable_dsyms) { | 292 if (_enable_dsyms) { |
287 outputs += [ _dsym_output ] | 293 outputs += dsym_output |
288 } | 294 } |
289 if (_save_unstripped_output) { | 295 if (_save_unstripped_output) { |
290 outputs += [ _unstripped_output ] | 296 outputs += [ _unstripped_output ] |
291 } | 297 } |
292 } | 298 } |
293 | 299 |
294 tool("link") { | 300 tool("link") { |
295 outfile = "{{output_dir}}/{{target_output_name}}{{output_extension}}" | 301 outfile = "{{output_dir}}/{{target_output_name}}{{output_extension}}" |
296 rspfile = "$outfile.rsp" | 302 rspfile = "$outfile.rsp" |
297 pool = "//build/toolchain:link_pool($default_toolchain)" | 303 pool = "//build/toolchain:link_pool($default_toolchain)" |
298 | 304 |
299 # Note about --filelist: Apple's linker reads the file list file and | 305 # Note about --filelist: Apple's linker reads the file list file and |
300 # interprets each newline-separated chunk of text as a file name. It | 306 # interprets each newline-separated chunk of text as a file name. It |
301 # doesn't do the things one would expect from the shell like unescaping | 307 # doesn't do the things one would expect from the shell like unescaping |
302 # or handling quotes. In contrast, when Ninja finds a file name with | 308 # or handling quotes. In contrast, when Ninja finds a file name with |
303 # spaces, it single-quotes them in $inputs_newline as it would normally | 309 # spaces, it single-quotes them in $inputs_newline as it would normally |
304 # do for command-line arguments. Thus any source names with spaces, or | 310 # do for command-line arguments. Thus any source names with spaces, or |
305 # label names with spaces (which GN bases the output paths on) will be | 311 # label names with spaces (which GN bases the output paths on) will be |
306 # corrupted by this process. Don't use spaces for source files or labels. | 312 # corrupted by this process. Don't use spaces for source files or labels. |
307 command = "$linker_driver $ld $dsym_switch {{ldflags}} -o \"$outfile\" -Wl
,-filelist,\"$rspfile\" {{solibs}} {{libs}}" | 313 command = "$linker_driver $ld $dsym_switch {{ldflags}} -o \"$outfile\" -Wl
,-filelist,\"$rspfile\" {{solibs}} {{libs}}" |
308 description = "LINK $outfile" | 314 description = "LINK $outfile" |
309 rspfile_content = "{{inputs_newline}}" | 315 rspfile_content = "{{inputs_newline}}" |
310 outputs = [ | 316 outputs = [ |
311 outfile, | 317 outfile, |
312 ] | 318 ] |
313 | 319 |
314 if (_enable_dsyms) { | 320 if (_enable_dsyms) { |
315 outputs += [ _dsym_output ] | 321 outputs += dsym_output |
316 } | 322 } |
317 if (_save_unstripped_output) { | 323 if (_save_unstripped_output) { |
318 outputs += [ _unstripped_output ] | 324 outputs += [ _unstripped_output ] |
319 } | 325 } |
320 | 326 |
321 default_output_dir = "{{root_out_dir}}" | 327 default_output_dir = "{{root_out_dir}}" |
322 } | 328 } |
323 | 329 |
324 # These two are really entirely generic, but have to be repeated in | 330 # These two are really entirely generic, but have to be repeated in |
325 # each toolchain because GN doesn't allow a template to be used here. | 331 # each toolchain because GN doesn't allow a template to be used here. |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
416 mac_toolchain("ios_clang_x86") { | 422 mac_toolchain("ios_clang_x86") { |
417 toolchain_cpu = "x86" | 423 toolchain_cpu = "x86" |
418 toolchain_os = "ios" | 424 toolchain_os = "ios" |
419 } | 425 } |
420 | 426 |
421 mac_toolchain("ios_clang_x64") { | 427 mac_toolchain("ios_clang_x64") { |
422 toolchain_cpu = "x64" | 428 toolchain_cpu = "x64" |
423 toolchain_os = "ios" | 429 toolchain_os = "ios" |
424 } | 430 } |
425 } | 431 } |
OLD | NEW |