| 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 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 626 # The invoker can override the type of the target in the non-component-build | 626 # The invoker can override the type of the target in the non-component-build |
| 627 # case by setting static_component_type to either "source_set" or | 627 # case by setting static_component_type to either "source_set" or |
| 628 # "static_library". If unset, the default will be used. | 628 # "static_library". If unset, the default will be used. |
| 629 template("component") { | 629 template("component") { |
| 630 if (is_component_build) { | 630 if (is_component_build) { |
| 631 _component_mode = "shared_library" | 631 _component_mode = "shared_library" |
| 632 } else if (defined(invoker.static_component_type)) { | 632 } else if (defined(invoker.static_component_type)) { |
| 633 assert(invoker.static_component_type == "static_library" || | 633 assert(invoker.static_component_type == "static_library" || |
| 634 invoker.static_component_type == "source_set") | 634 invoker.static_component_type == "source_set") |
| 635 _component_mode = invoker.static_component_type | 635 _component_mode = invoker.static_component_type |
| 636 } else if (!defined(invoker.sources) || is_mac || | 636 } else if (!defined(invoker.sources) || is_mac) { |
| 637 (is_win && is_official_build)) { | |
| 638 # When there are no sources defined, use a source set to avoid creating | 637 # When there are no sources defined, use a source set to avoid creating |
| 639 # an empty static library (which generally don't work). | 638 # an empty static library (which generally don't work). |
| 640 # | 639 # |
| 641 # On Windows official builds, the link time code generation bloats static | |
| 642 # libraries to the point where some of them become >32 bits large which | |
| 643 # causes lib.exe to fail. Always use source sets for that configuration. | |
| 644 # | |
| 645 # TODO(brettw) bug 618797: Remove the mac condition. On Mac making these as | 640 # TODO(brettw) bug 618797: Remove the mac condition. On Mac making these as |
| 646 # static_library causes crashes. Remove the mac condition above when this | 641 # static_library causes crashes. Remove the mac condition above when this |
| 647 # is fixed. | 642 # is fixed. |
| 648 _component_mode = "source_set" | 643 _component_mode = "source_set" |
| 649 } else { | 644 } else { |
| 650 _component_mode = "static_library" | 645 _component_mode = "static_library" |
| 651 } | 646 } |
| 652 target(_component_mode, target_name) { | 647 target(_component_mode, target_name) { |
| 653 # Explicitly forward visibility, implicitly forward everything else. | 648 # Explicitly forward visibility, implicitly forward everything else. |
| 654 # Forwarding "*" doesn't recurse into nested scopes (to avoid copying all | 649 # Forwarding "*" doesn't recurse into nested scopes (to avoid copying all |
| 655 # globals into each template invocation), so won't pick up file-scoped | 650 # globals into each template invocation), so won't pick up file-scoped |
| 656 # variables. Normally this isn't too bad, but visibility is commonly | 651 # variables. Normally this isn't too bad, but visibility is commonly |
| 657 # defined at the file scope. Explicitly forwarding visibility and then | 652 # defined at the file scope. Explicitly forwarding visibility and then |
| 658 # excluding it from the "*" set works around this problem. | 653 # excluding it from the "*" set works around this problem. |
| 659 # See http://crbug.com/594610 | 654 # See http://crbug.com/594610 |
| 660 forward_variables_from(invoker, [ "visibility" ]) | 655 forward_variables_from(invoker, [ "visibility" ]) |
| 661 forward_variables_from(invoker, "*", [ "visibility" ]) | 656 forward_variables_from(invoker, "*", [ "visibility" ]) |
| 662 | 657 |
| 663 # All shared libraries must have the sanitizer deps to properly link in | 658 # All shared libraries must have the sanitizer deps to properly link in |
| 664 # asan mode (this target will be empty in other cases). | 659 # asan mode (this target will be empty in other cases). |
| 665 if (!defined(deps)) { | 660 if (!defined(deps)) { |
| 666 deps = [] | 661 deps = [] |
| 667 } | 662 } |
| 668 deps += [ "//build/config/sanitizers:deps" ] | 663 deps += [ "//build/config/sanitizers:deps" ] |
| 669 } | 664 } |
| 670 } | 665 } |
| OLD | NEW |