| 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 # ============================================================================= | 5 # ============================================================================= |
| 6 # PLATFORM SELECTION | 6 # PLATFORM SELECTION |
| 7 # ============================================================================= | 7 # ============================================================================= |
| 8 # | 8 # |
| 9 # There are two main things to set: "os" and "cpu". The "toolchain" is the name | 9 # There are two main things to set: "os" and "cpu". The "toolchain" is the name |
| 10 # of the GN thing that encodes combinations of these things. | 10 # of the GN thing that encodes combinations of these things. |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 is_clang = current_os == "mac" || current_os == "ios" || | 125 is_clang = current_os == "mac" || current_os == "ios" || |
| 126 current_os == "linux" || current_os == "chromeos" | 126 current_os == "linux" || current_os == "chromeos" |
| 127 | 127 |
| 128 if (current_os == "chromeos") { | 128 if (current_os == "chromeos") { |
| 129 # Allows the target toolchain to be injected as arguments. This is needed | 129 # Allows the target toolchain to be injected as arguments. This is needed |
| 130 # to support the CrOS build system which supports per-build-configuration | 130 # to support the CrOS build system which supports per-build-configuration |
| 131 # toolchains. | 131 # toolchains. |
| 132 cros_use_custom_toolchain = false | 132 cros_use_custom_toolchain = false |
| 133 } | 133 } |
| 134 | 134 |
| 135 # Allows the path to a custom target toolchain to be injected as a single |
| 136 # argument, and set as the default toolchain. |
| 137 # Note: On ChromeOS, do not set this argument. Instead, set |
| 138 # cros_use_custom_toolchain, and set each of the args required by |
| 139 # //build/toolchain/cros:target. |
| 140 custom_toolchain = "" |
| 141 |
| 135 # DON'T ADD MORE FLAGS HERE. Read the comment above. | 142 # DON'T ADD MORE FLAGS HERE. Read the comment above. |
| 136 } | 143 } |
| 137 | 144 |
| 145 if (current_os == "chromeos") { |
| 146 assert( |
| 147 custom_toolchain == "", |
| 148 "|custom_toolchain| should not be set in args on ChromeOS. Set cros_use_cu
stom_toolchain instead.") |
| 149 |
| 150 if (cros_use_custom_toolchain) { |
| 151 custom_toolchain = "//build/toolchain/cros:target" |
| 152 } |
| 153 } |
| 154 |
| 138 # ============================================================================= | 155 # ============================================================================= |
| 139 # OS DEFINITIONS | 156 # OS DEFINITIONS |
| 140 # ============================================================================= | 157 # ============================================================================= |
| 141 # | 158 # |
| 142 # We set these various is_FOO booleans for convenience in writing OS-based | 159 # We set these various is_FOO booleans for convenience in writing OS-based |
| 143 # conditions. | 160 # conditions. |
| 144 # | 161 # |
| 145 # - is_android, is_chromeos, is_ios, and is_win should be obvious. | 162 # - is_android, is_chromeos, is_ios, and is_win should be obvious. |
| 146 # - is_mac is set only for desktop Mac. It is not set on iOS. | 163 # - is_mac is set only for desktop Mac. It is not set on iOS. |
| 147 # - is_posix is true for mac and any Unix-like system (basically everything | 164 # - is_posix is true for mac and any Unix-like system (basically everything |
| (...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 523 set_default_toolchain("//build/toolchain/android:$current_cpu") | 540 set_default_toolchain("//build/toolchain/android:$current_cpu") |
| 524 } | 541 } |
| 525 } else if (is_linux) { | 542 } else if (is_linux) { |
| 526 if (is_clang) { | 543 if (is_clang) { |
| 527 host_toolchain = "//build/toolchain/linux:clang_$host_cpu" | 544 host_toolchain = "//build/toolchain/linux:clang_$host_cpu" |
| 528 set_default_toolchain("//build/toolchain/linux:clang_$current_cpu") | 545 set_default_toolchain("//build/toolchain/linux:clang_$current_cpu") |
| 529 } else { | 546 } else { |
| 530 host_toolchain = "//build/toolchain/linux:$host_cpu" | 547 host_toolchain = "//build/toolchain/linux:$host_cpu" |
| 531 set_default_toolchain("//build/toolchain/linux:$current_cpu") | 548 set_default_toolchain("//build/toolchain/linux:$current_cpu") |
| 532 } | 549 } |
| 533 if (is_chromeos && cros_use_custom_toolchain) { | |
| 534 set_default_toolchain("//build/toolchain/cros:target") | |
| 535 } | |
| 536 } else if (is_mac) { | 550 } else if (is_mac) { |
| 537 host_toolchain = "//build/toolchain/mac:clang_x64" | 551 host_toolchain = "//build/toolchain/mac:clang_x64" |
| 538 set_default_toolchain(host_toolchain) | 552 set_default_toolchain(host_toolchain) |
| 539 } else if (is_ios) { | 553 } else if (is_ios) { |
| 540 host_toolchain = "//build/toolchain/mac:clang_x64" | 554 host_toolchain = "//build/toolchain/mac:clang_x64" |
| 541 set_default_toolchain("//build/toolchain/mac:ios_clang_arm") | 555 set_default_toolchain("//build/toolchain/mac:ios_clang_arm") |
| 542 } else if (is_nacl) { | 556 } else if (is_nacl) { |
| 543 # TODO(GYP): This will need to change when we get NaCl working | 557 # TODO(GYP): This will need to change when we get NaCl working |
| 544 # on multiple platforms, but this whole block of code (how we define | 558 # on multiple platforms, but this whole block of code (how we define |
| 545 # host_toolchain) needs to be reworked regardless to key off of host_os | 559 # host_toolchain) needs to be reworked regardless to key off of host_os |
| 546 # and host_cpu rather than the is_* variables. | 560 # and host_cpu rather than the is_* variables. |
| 547 host_toolchain = "//build/toolchain/linux:clang_x64" | 561 host_toolchain = "//build/toolchain/linux:clang_x64" |
| 548 } | 562 } |
| 549 | 563 |
| 564 # Set the custom default toolchain. |
| 565 if (custom_toolchain != "") { |
| 566 set_default_toolchain(custom_toolchain) |
| 567 } |
| 568 |
| 550 # ============================================================================== | 569 # ============================================================================== |
| 551 # COMPONENT SETUP | 570 # COMPONENT SETUP |
| 552 # ============================================================================== | 571 # ============================================================================== |
| 553 | 572 |
| 554 if (is_component_build) { | 573 if (is_component_build) { |
| 555 _component_mode = "shared_library" | 574 _component_mode = "shared_library" |
| 556 } else { | 575 } else { |
| 557 _component_mode = "source_set" | 576 _component_mode = "source_set" |
| 558 } | 577 } |
| 559 template("component") { | 578 template("component") { |
| 560 target(_component_mode, target_name) { | 579 target(_component_mode, target_name) { |
| 561 forward_variables_from(invoker, "*") | 580 forward_variables_from(invoker, "*") |
| 562 | 581 |
| 563 # All shared libraries must have the sanitizer deps to properly link in | 582 # All shared libraries must have the sanitizer deps to properly link in |
| 564 # asan mode (this target will be empty in other cases). | 583 # asan mode (this target will be empty in other cases). |
| 565 if (!defined(deps)) { | 584 if (!defined(deps)) { |
| 566 deps = [] | 585 deps = [] |
| 567 } | 586 } |
| 568 deps += [ "//build/config/sanitizers:deps" ] | 587 deps += [ "//build/config/sanitizers:deps" ] |
| 569 } | 588 } |
| 570 } | 589 } |
| OLD | NEW |