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 621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
632 # The invoker can override the type of the target in the non-component-build | 632 # The invoker can override the type of the target in the non-component-build |
633 # case by setting static_component_type to either "source_set" or | 633 # case by setting static_component_type to either "source_set" or |
634 # "static_library". If unset, the default will be used. | 634 # "static_library". If unset, the default will be used. |
635 template("component") { | 635 template("component") { |
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 (!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 # | |
646 # TODO(brettw) remove the Android condition or comment why it needs to be | |
647 # kept after some analysis. Source sets vs. static libraries seem to be | |
648 # causing some performance differences. As part of the analysis for | |
649 # http://crbug.com/619593 we're testing source sets for components again. | |
650 _component_mode = "source_set" | 645 _component_mode = "source_set" |
651 } else { | 646 } else { |
652 _component_mode = "static_library" | 647 _component_mode = "static_library" |
653 } | 648 } |
654 target(_component_mode, target_name) { | 649 target(_component_mode, target_name) { |
655 # Explicitly forward visibility, implicitly forward everything else. | 650 # Explicitly forward visibility, implicitly forward everything else. |
656 # Forwarding "*" doesn't recurse into nested scopes (to avoid copying all | 651 # Forwarding "*" doesn't recurse into nested scopes (to avoid copying all |
657 # globals into each template invocation), so won't pick up file-scoped | 652 # globals into each template invocation), so won't pick up file-scoped |
658 # variables. Normally this isn't too bad, but visibility is commonly | 653 # variables. Normally this isn't too bad, but visibility is commonly |
659 # defined at the file scope. Explicitly forwarding visibility and then | 654 # defined at the file scope. Explicitly forwarding visibility and then |
660 # excluding it from the "*" set works around this problem. | 655 # excluding it from the "*" set works around this problem. |
661 # See http://crbug.com/594610 | 656 # See http://crbug.com/594610 |
662 forward_variables_from(invoker, [ "visibility" ]) | 657 forward_variables_from(invoker, [ "visibility" ]) |
663 forward_variables_from(invoker, "*", [ "visibility" ]) | 658 forward_variables_from(invoker, "*", [ "visibility" ]) |
664 | 659 |
665 # All shared libraries must have the sanitizer deps to properly link in | 660 # All shared libraries must have the sanitizer deps to properly link in |
666 # asan mode (this target will be empty in other cases). | 661 # asan mode (this target will be empty in other cases). |
667 if (!defined(deps)) { | 662 if (!defined(deps)) { |
668 deps = [] | 663 deps = [] |
669 } | 664 } |
670 deps += [ "//build/config/sanitizers:deps" ] | 665 deps += [ "//build/config/sanitizers:deps" ] |
671 } | 666 } |
672 } | 667 } |
OLD | NEW |