Chromium Code Reviews| 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 = |
|
Robert Sesek
2016/08/08 19:13:04
Why not just make this a list too?
sdefresne
2016/08/08 21:32:33
I didn't think of turning this into a list. Done.
| |
| 118 "{{root_out_dir}}/{{target_output_name}}{{output_extension}}.dSYM/" | 118 "{{root_out_dir}}/{{target_output_name}}{{output_extension}}.dSYM" |
| 119 } else { | 119 } else { |
| 120 dsym_switch = "" | 120 dsym_switch = "" |
| 121 } | 121 } |
| 122 | 122 |
| 123 if (_save_unstripped_output) { | 123 if (_save_unstripped_output) { |
| 124 _unstripped_output = "{{root_out_dir}}/{{target_output_name}}{{output_exte nsion}}.unstripped" | 124 _unstripped_output = "{{root_out_dir}}/{{target_output_name}}{{output_exte nsion}}.unstripped" |
| 125 } | 125 } |
| 126 | 126 |
| 127 tool("cc") { | 127 tool("cc") { |
| 128 depfile = "{{output}}.d" | 128 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 | 242 # Tell GN about the output files. It will link to the dylib but use the |
| 243 # tocname for dependency management. | 243 # tocname for dependency management. |
| 244 outputs = [ | 244 outputs = [ |
| 245 dylib, | 245 dylib, |
| 246 tocname, | 246 tocname, |
| 247 ] | 247 ] |
| 248 link_output = dylib | 248 link_output = dylib |
| 249 depend_output = tocname | 249 depend_output = tocname |
| 250 | 250 |
| 251 if (_enable_dsyms) { | 251 if (_enable_dsyms) { |
| 252 outputs += [ _dsym_output ] | 252 outputs += [ |
| 253 "$_dsym_output/", | |
| 254 "$_dsym_output/Contents/Info.plist", | |
| 255 "$_dsym_output/Contents/Resources/DWARF/{{target_output_name}}", | |
| 256 ] | |
| 253 } | 257 } |
| 254 if (_save_unstripped_output) { | 258 if (_save_unstripped_output) { |
| 255 outputs += [ _unstripped_output ] | 259 outputs += [ _unstripped_output ] |
| 256 } | 260 } |
| 257 } | 261 } |
| 258 | 262 |
| 259 tool("solink_module") { | 263 tool("solink_module") { |
| 260 sofile = "{{output_dir}}/{{target_output_name}}{{output_extension}}" # eg "./libfoo.so" | 264 sofile = "{{output_dir}}/{{target_output_name}}{{output_extension}}" # eg "./libfoo.so" |
| 261 rspfile = sofile + ".rsp" | 265 rspfile = sofile + ".rsp" |
| 262 pool = "//build/toolchain:link_pool($default_toolchain)" | 266 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 | 281 # overrides it (in which case {{output_extension}} will be what the target |
| 278 # specifies). | 282 # specifies). |
| 279 default_output_dir = "{{root_out_dir}}" | 283 default_output_dir = "{{root_out_dir}}" |
| 280 default_output_extension = ".so" | 284 default_output_extension = ".so" |
| 281 | 285 |
| 282 outputs = [ | 286 outputs = [ |
| 283 sofile, | 287 sofile, |
| 284 ] | 288 ] |
| 285 | 289 |
| 286 if (_enable_dsyms) { | 290 if (_enable_dsyms) { |
| 287 outputs += [ _dsym_output ] | 291 outputs += [ |
| 292 "$_dsym_output/", | |
| 293 "$_dsym_output/Contents/Info.plist", | |
| 294 "$_dsym_output/Contents/Resources/DWARF/{{target_output_name}}", | |
| 295 ] | |
| 288 } | 296 } |
| 289 if (_save_unstripped_output) { | 297 if (_save_unstripped_output) { |
| 290 outputs += [ _unstripped_output ] | 298 outputs += [ _unstripped_output ] |
| 291 } | 299 } |
| 292 } | 300 } |
| 293 | 301 |
| 294 tool("link") { | 302 tool("link") { |
| 295 outfile = "{{output_dir}}/{{target_output_name}}{{output_extension}}" | 303 outfile = "{{output_dir}}/{{target_output_name}}{{output_extension}}" |
| 296 rspfile = "$outfile.rsp" | 304 rspfile = "$outfile.rsp" |
| 297 pool = "//build/toolchain:link_pool($default_toolchain)" | 305 pool = "//build/toolchain:link_pool($default_toolchain)" |
| 298 | 306 |
| 299 # Note about --filelist: Apple's linker reads the file list file and | 307 # 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 | 308 # 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 | 309 # 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 | 310 # 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 | 311 # 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 | 312 # 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 | 313 # 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. | 314 # 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}}" | 315 command = "$linker_driver $ld $dsym_switch {{ldflags}} -o \"$outfile\" -Wl ,-filelist,\"$rspfile\" {{solibs}} {{libs}}" |
| 308 description = "LINK $outfile" | 316 description = "LINK $outfile" |
| 309 rspfile_content = "{{inputs_newline}}" | 317 rspfile_content = "{{inputs_newline}}" |
| 310 outputs = [ | 318 outputs = [ |
| 311 outfile, | 319 outfile, |
| 312 ] | 320 ] |
| 313 | 321 |
| 314 if (_enable_dsyms) { | 322 if (_enable_dsyms) { |
| 315 outputs += [ _dsym_output ] | 323 outputs += [ |
| 324 "$_dsym_output/", | |
| 325 "$_dsym_output/Contents/Info.plist", | |
| 326 "$_dsym_output/Contents/Resources/DWARF/{{target_output_name}}", | |
| 327 ] | |
| 316 } | 328 } |
| 317 if (_save_unstripped_output) { | 329 if (_save_unstripped_output) { |
| 318 outputs += [ _unstripped_output ] | 330 outputs += [ _unstripped_output ] |
| 319 } | 331 } |
| 320 | 332 |
| 321 default_output_dir = "{{root_out_dir}}" | 333 default_output_dir = "{{root_out_dir}}" |
| 322 } | 334 } |
| 323 | 335 |
| 324 # These two are really entirely generic, but have to be repeated in | 336 # 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. | 337 # 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") { | 428 mac_toolchain("ios_clang_x86") { |
| 417 toolchain_cpu = "x86" | 429 toolchain_cpu = "x86" |
| 418 toolchain_os = "ios" | 430 toolchain_os = "ios" |
| 419 } | 431 } |
| 420 | 432 |
| 421 mac_toolchain("ios_clang_x64") { | 433 mac_toolchain("ios_clang_x64") { |
| 422 toolchain_cpu = "x64" | 434 toolchain_cpu = "x64" |
| 423 toolchain_os = "ios" | 435 toolchain_os = "ios" |
| 424 } | 436 } |
| 425 } | 437 } |
| OLD | NEW |