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 625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
636 if (is_component_build) { | 636 if (is_component_build) { |
637 _component_mode = "shared_library" | 637 _component_mode = "shared_library" |
638 } else if (defined(invoker.static_component_type)) { | 638 } else if (defined(invoker.static_component_type)) { |
639 assert(invoker.static_component_type == "static_library" || | 639 assert(invoker.static_component_type == "static_library" || |
640 invoker.static_component_type == "source_set") | 640 invoker.static_component_type == "source_set") |
641 _component_mode = invoker.static_component_type | 641 _component_mode = invoker.static_component_type |
642 } else if (is_android || !defined(invoker.sources)) { | 642 } else if (is_android || !defined(invoker.sources)) { |
643 # When there are no sources defined, use a source set to avoid creating | 643 # When there are no sources defined, use a source set to avoid creating |
644 # an empty static library (which generally don't work). | 644 # an empty static library (which generally don't work). |
645 # | 645 # |
646 # TODO(brettw) remove the Android condition or comment why it needs to be | 646 # When we changed components to default from source sets to static |
647 # kept after some analysis. Source sets vs. static libraries seem to be | 647 # libraries, an Android benchmark regressed slightly |
648 # causing some performance differences. As part of the analysis for | 648 # (https://crbug.com/619593). We don't have a good theory on why this might |
649 # http://crbug.com/619593 we're testing source sets for components again. | 649 # be since theoretically it should be the same. It could be something as |
| 650 # silly as random code locality luck. |
| 651 # |
| 652 # There seems to be no build-time performance hit to using source sets on |
| 653 # Android (the normal reason for defaulting to static libraries), so we |
| 654 # make the default on Android to be source set. |
| 655 # |
| 656 # If it's been a long time since this was added and you're skeptical, |
| 657 # please feel free to remove the Android exception and see if any |
| 658 # benchmarks obviously regress. If not, it would be great to standardize |
| 659 # with the rest of the platforms. |
650 _component_mode = "source_set" | 660 _component_mode = "source_set" |
651 } else { | 661 } else { |
652 _component_mode = "static_library" | 662 _component_mode = "static_library" |
653 } | 663 } |
654 target(_component_mode, target_name) { | 664 target(_component_mode, target_name) { |
655 # Explicitly forward visibility, implicitly forward everything else. | 665 # Explicitly forward visibility, implicitly forward everything else. |
656 # Forwarding "*" doesn't recurse into nested scopes (to avoid copying all | 666 # Forwarding "*" doesn't recurse into nested scopes (to avoid copying all |
657 # globals into each template invocation), so won't pick up file-scoped | 667 # globals into each template invocation), so won't pick up file-scoped |
658 # variables. Normally this isn't too bad, but visibility is commonly | 668 # variables. Normally this isn't too bad, but visibility is commonly |
659 # defined at the file scope. Explicitly forwarding visibility and then | 669 # defined at the file scope. Explicitly forwarding visibility and then |
660 # excluding it from the "*" set works around this problem. | 670 # excluding it from the "*" set works around this problem. |
661 # See http://crbug.com/594610 | 671 # See http://crbug.com/594610 |
662 forward_variables_from(invoker, [ "visibility" ]) | 672 forward_variables_from(invoker, [ "visibility" ]) |
663 forward_variables_from(invoker, "*", [ "visibility" ]) | 673 forward_variables_from(invoker, "*", [ "visibility" ]) |
664 | 674 |
665 # All shared libraries must have the sanitizer deps to properly link in | 675 # All shared libraries must have the sanitizer deps to properly link in |
666 # asan mode (this target will be empty in other cases). | 676 # asan mode (this target will be empty in other cases). |
667 if (!defined(deps)) { | 677 if (!defined(deps)) { |
668 deps = [] | 678 deps = [] |
669 } | 679 } |
670 deps += [ "//build/config/sanitizers:deps" ] | 680 deps += [ "//build/config/sanitizers:deps" ] |
671 } | 681 } |
672 } | 682 } |
OLD | NEW |