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") |
| 11 if (is_ios) { | 11 if (is_ios) { |
| 12 import("//build/config/ios/ios_sdk.gni") | 12 import("//build/config/ios/ios_sdk.gni") |
| 13 } | 13 } |
| 14 import("//build/config/mac/mac_sdk.gni") | 14 import("//build/config/mac/mac_sdk.gni") |
| 15 import("//build/config/mac/symbols.gni") | 15 import("//build/config/mac/symbols.gni") |
| 16 | 16 |
| 17 assert(host_os == "mac") | 17 assert(host_os == "mac") |
| 18 | 18 |
| 19 import("//build/toolchain/cc_wrapper.gni") | 19 import("//build/toolchain/cc_wrapper.gni") |
| 20 import("//build/toolchain/goma.gni") | 20 import("//build/toolchain/goma.gni") |
| 21 import("//build/toolchain/toolchain.gni") | 21 import("//build/toolchain/toolchain.gni") |
| 22 import("//build/toolchain/concurrent_links.gni") | 22 import("//build/toolchain/concurrent_links.gni") |
| 23 | 23 |
|
sdefresne
2017/01/11 16:49:11
You need to add import of //build/toolchain/clang_
Kevin M
2017/01/11 18:27:46
Done.
| |
| 24 declare_args() { | 24 declare_args() { |
| 25 # Reduce the number of tasks using the copy_bundle_data and compile_xcassets | 25 # Reduce the number of tasks using the copy_bundle_data and compile_xcassets |
| 26 # tools as they can cause lots of I/O contention when invoking ninja with a | 26 # tools as they can cause lots of I/O contention when invoking ninja with a |
| 27 # large number of parallel jobs (e.g. when using distributed build like goma). | 27 # large number of parallel jobs (e.g. when using distributed build like goma). |
| 28 bundle_pool_depth = -1 | 28 bundle_pool_depth = -1 |
| 29 } | 29 } |
| 30 | 30 |
| 31 if (current_toolchain == default_toolchain) { | 31 if (current_toolchain == default_toolchain) { |
| 32 pool("bundle_pool") { | 32 pool("bundle_pool") { |
| 33 if (bundle_pool_depth == -1) { | 33 if (bundle_pool_depth == -1) { |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 115 "Goma and cc_wrapper can't be used together.") | 115 "Goma and cc_wrapper can't be used together.") |
| 116 compiler_prefix = "$goma_dir/gomacc " | 116 compiler_prefix = "$goma_dir/gomacc " |
| 117 } else if (toolchain_cc_wrapper != "") { | 117 } else if (toolchain_cc_wrapper != "") { |
| 118 compiler_prefix = toolchain_cc_wrapper + " " | 118 compiler_prefix = toolchain_cc_wrapper + " " |
| 119 } else { | 119 } else { |
| 120 compiler_prefix = "" | 120 compiler_prefix = "" |
| 121 } | 121 } |
| 122 | 122 |
| 123 cc = compiler_prefix + _cc | 123 cc = compiler_prefix + _cc |
| 124 cxx = compiler_prefix + _cxx | 124 cxx = compiler_prefix + _cxx |
| 125 ld = _cxx | 125 |
| 126 if (use_clang_static_analyzer) { | |
|
sdefresne
2017/01/11 16:49:11
I tried to run it with goma enabled and it got stu
Kevin M
2017/01/11 18:27:46
Done.
| |
| 127 # Call "ccc-analyzer" or "c++-analyzer" instead of directly calling Clang. | |
| 128 # |wrapper_tool| sets the environment variables which are read by the | |
| 129 # analyzer tools. | |
| 130 analyzer_wrapper = | |
| 131 rebase_path("//build/toolchain/clang_static_analyzer_wrapper.py", | |
| 132 root_build_dir) | |
| 133 cc = analyzer_wrapper + " --clang-cc-path=${cc} --analyzer=" + rebase_path ( | |
| 134 "//third_party/llvm/tools/clang/tools/scan-build/libexec/ccc-anal yzer", | |
| 135 root_build_dir) | |
| 136 cxx = analyzer_wrapper + " --clang-cxx-path=${cxx} --analyzer=" + rebase_p ath( | |
| 137 "//third_party/llvm/tools/clang/tools/scan-build/libexec/c++-ana lyzer", | |
| 138 root_build_dir) | |
| 139 } | |
| 140 | |
| 141 ld = cxx | |
| 126 | 142 |
| 127 linker_driver = | 143 linker_driver = |
| 128 "TOOL_VERSION=${tool_versions.linker_driver} " + | 144 "TOOL_VERSION=${tool_versions.linker_driver} " + |
| 129 rebase_path("//build/toolchain/mac/linker_driver.py", root_build_dir) | 145 rebase_path("//build/toolchain/mac/linker_driver.py", root_build_dir) |
| 130 | 146 |
| 131 # On iOS, the final applications are assembled using lipo (to support fat | 147 # On iOS, the final applications are assembled using lipo (to support fat |
| 132 # builds). The correct flags are passed to the linker_driver.py script | 148 # builds). The correct flags are passed to the linker_driver.py script |
| 133 # directly during the lipo call. | 149 # directly during the lipo call. |
| 134 if (toolchain_args.current_os != "ios") { | 150 if (toolchain_args.current_os != "ios") { |
| 135 _enable_dsyms = enable_dsyms | 151 _enable_dsyms = enable_dsyms |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 163 dsym_switch = "" | 179 dsym_switch = "" |
| 164 } | 180 } |
| 165 | 181 |
| 166 if (_save_unstripped_output) { | 182 if (_save_unstripped_output) { |
| 167 _unstripped_output = "{{root_out_dir}}/{{target_output_name}}{{output_exte nsion}}.unstripped" | 183 _unstripped_output = "{{root_out_dir}}/{{target_output_name}}{{output_exte nsion}}.unstripped" |
| 168 } | 184 } |
| 169 | 185 |
| 170 tool("cc") { | 186 tool("cc") { |
| 171 depfile = "{{output}}.d" | 187 depfile = "{{output}}.d" |
| 172 precompiled_header_type = "gcc" | 188 precompiled_header_type = "gcc" |
| 173 command = "$env_wrapper $cc -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{cflags_c}} -c {{source}} -o {{output}}" | 189 command = "$cc -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} { {cflags_c}} -c {{source}} -o {{output}}" |
|
sdefresne
2017/01/11 16:49:11
You need to restore "$env_wrapper" here otherwise
Kevin M
2017/01/11 18:27:46
Done.
| |
| 174 depsformat = "gcc" | 190 depsformat = "gcc" |
| 175 description = "CC {{output}}" | 191 description = "CC {{output}}" |
| 176 outputs = [ | 192 outputs = [ |
| 177 "$object_subdir/{{source_name_part}}.o", | 193 "$object_subdir/{{source_name_part}}.o", |
| 178 ] | 194 ] |
| 179 } | 195 } |
| 180 | 196 |
| 181 tool("cxx") { | 197 tool("cxx") { |
| 182 depfile = "{{output}}.d" | 198 depfile = "{{output}}.d" |
| 183 precompiled_header_type = "gcc" | 199 precompiled_header_type = "gcc" |
| 184 command = "$env_wrapper $cxx -MMD -MF $depfile {{defines}} {{include_dirs} } {{cflags}} {{cflags_cc}} -c {{source}} -o {{output}}" | 200 command = "$cxx -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{cflags_cc}} -c {{source}} -o {{output}}" |
| 185 depsformat = "gcc" | 201 depsformat = "gcc" |
| 186 description = "CXX {{output}}" | 202 description = "CXX {{output}}" |
| 187 outputs = [ | 203 outputs = [ |
| 188 "$object_subdir/{{source_name_part}}.o", | 204 "$object_subdir/{{source_name_part}}.o", |
| 189 ] | 205 ] |
| 190 } | 206 } |
| 191 | 207 |
| 192 tool("asm") { | 208 tool("asm") { |
| 193 # For GCC we can just use the C compiler to compile assembly. | 209 # For GCC we can just use the C compiler to compile assembly. |
| 194 depfile = "{{output}}.d" | 210 depfile = "{{output}}.d" |
| 195 command = "$env_wrapper $cc -MMD -MF $depfile {{defines}} {{include_dirs}} {{asmflags}} -c {{source}} -o {{output}}" | 211 command = "$cc -MMD -MF $depfile {{defines}} {{include_dirs}} {{asmflags}} -c {{source}} -o {{output}}" |
| 196 depsformat = "gcc" | 212 depsformat = "gcc" |
| 197 description = "ASM {{output}}" | 213 description = "ASM {{output}}" |
| 198 outputs = [ | 214 outputs = [ |
| 199 "$object_subdir/{{source_name_part}}.o", | 215 "$object_subdir/{{source_name_part}}.o", |
| 200 ] | 216 ] |
| 201 } | 217 } |
| 202 | 218 |
| 203 tool("objc") { | 219 tool("objc") { |
| 204 depfile = "{{output}}.d" | 220 depfile = "{{output}}.d" |
| 205 precompiled_header_type = "gcc" | 221 precompiled_header_type = "gcc" |
| 206 command = "$env_wrapper $cc -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{cflags_objc}} -c {{source}} -o {{output}}" | 222 command = "$cc -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} { {cflags_objc}} -c {{source}} -o {{output}}" |
| 207 depsformat = "gcc" | 223 depsformat = "gcc" |
| 208 description = "OBJC {{output}}" | 224 description = "OBJC {{output}}" |
| 209 outputs = [ | 225 outputs = [ |
| 210 "$object_subdir/{{source_name_part}}.o", | 226 "$object_subdir/{{source_name_part}}.o", |
| 211 ] | 227 ] |
| 212 } | 228 } |
| 213 | 229 |
| 214 tool("objcxx") { | 230 tool("objcxx") { |
| 215 depfile = "{{output}}.d" | 231 depfile = "{{output}}.d" |
| 216 precompiled_header_type = "gcc" | 232 precompiled_header_type = "gcc" |
| 217 command = "$env_wrapper $cxx -MMD -MF $depfile {{defines}} {{include_dirs} } {{cflags}} {{cflags_objcc}} -c {{source}} -o {{output}}" | 233 command = "$cxx -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{cflags_objcc}} -c {{source}} -o {{output}}" |
| 218 depsformat = "gcc" | 234 depsformat = "gcc" |
| 219 description = "OBJCXX {{output}}" | 235 description = "OBJCXX {{output}}" |
| 220 outputs = [ | 236 outputs = [ |
| 221 "$object_subdir/{{source_name_part}}.o", | 237 "$object_subdir/{{source_name_part}}.o", |
| 222 ] | 238 ] |
| 223 } | 239 } |
| 224 | 240 |
| 225 tool("alink") { | 241 tool("alink") { |
| 226 script = | 242 script = |
| 227 rebase_path("//build/toolchain/mac/filter_libtool.py", root_build_dir) | 243 rebase_path("//build/toolchain/mac/filter_libtool.py", root_build_dir) |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 431 } | 447 } |
| 432 } | 448 } |
| 433 | 449 |
| 434 mac_toolchain("clang_x64") { | 450 mac_toolchain("clang_x64") { |
| 435 toolchain_args = { | 451 toolchain_args = { |
| 436 current_cpu = "x64" | 452 current_cpu = "x64" |
| 437 current_os = "mac" | 453 current_os = "mac" |
| 438 } | 454 } |
| 439 } | 455 } |
| 440 | 456 |
| 441 mac_toolchain("clang_x86") { | |
| 442 toolchain_args = { | |
| 443 current_cpu = "x86" | |
| 444 current_os = "mac" | |
| 445 } | |
| 446 } | |
| 447 | |
| 448 mac_toolchain("clang_x86_v8_arm") { | |
| 449 toolchain_args = { | |
| 450 current_cpu = "x86" | |
| 451 v8_current_cpu = "arm" | |
| 452 current_os = "mac" | |
| 453 } | |
| 454 } | |
| 455 | |
| 456 mac_toolchain("clang_x86_v8_mipsel") { | |
| 457 toolchain_args = { | |
| 458 current_cpu = "x86" | |
| 459 v8_current_cpu = "mipsel" | |
| 460 current_os = "mac" | |
| 461 } | |
| 462 } | |
| 463 | |
| 464 mac_toolchain("clang_x64_v8_arm64") { | |
| 465 toolchain_args = { | |
| 466 current_cpu = "x64" | |
| 467 v8_current_cpu = "arm64" | |
| 468 current_os = "mac" | |
| 469 } | |
| 470 } | |
| 471 | |
| 472 mac_toolchain("clang_x64_v8_mips64el") { | |
| 473 toolchain_args = { | |
| 474 current_cpu = "x64" | |
| 475 v8_current_cpu = "mips64el" | |
| 476 current_os = "mac" | |
| 477 } | |
| 478 } | |
| 479 | |
| 480 if (is_ios) { | 457 if (is_ios) { |
| 481 mac_toolchain("ios_clang_arm") { | 458 mac_toolchain("ios_clang_arm") { |
| 482 toolchain_args = { | 459 toolchain_args = { |
| 483 current_cpu = "arm" | 460 current_cpu = "arm" |
| 484 current_os = "ios" | 461 current_os = "ios" |
| 485 } | 462 } |
| 486 } | 463 } |
| 487 | 464 |
| 488 mac_toolchain("ios_clang_arm64") { | 465 mac_toolchain("ios_clang_arm64") { |
| 489 toolchain_args = { | 466 toolchain_args = { |
| 490 current_cpu = "arm64" | 467 current_cpu = "arm64" |
| 491 current_os = "ios" | 468 current_os = "ios" |
| 492 } | 469 } |
| 493 } | 470 } |
| 494 | 471 |
| 495 mac_toolchain("ios_clang_x86") { | 472 mac_toolchain("ios_clang_x86") { |
| 496 toolchain_args = { | 473 toolchain_args = { |
| 497 current_cpu = "x86" | 474 current_cpu = "x86" |
| 498 current_os = "ios" | 475 current_os = "ios" |
| 499 } | 476 } |
| 500 } | 477 } |
| 501 | 478 |
| 502 mac_toolchain("ios_clang_x64") { | 479 mac_toolchain("ios_clang_x64") { |
| 503 toolchain_args = { | 480 toolchain_args = { |
| 504 current_cpu = "x64" | 481 current_cpu = "x64" |
| 505 current_os = "ios" | 482 current_os = "ios" |
| 506 } | 483 } |
| 507 } | 484 } |
| 508 } | 485 } |
| OLD | NEW |