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 (!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 # |
| 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. |
645 _component_mode = "source_set" | 650 _component_mode = "source_set" |
646 } else { | 651 } else { |
647 _component_mode = "static_library" | 652 _component_mode = "static_library" |
648 } | 653 } |
649 target(_component_mode, target_name) { | 654 target(_component_mode, target_name) { |
650 # Explicitly forward visibility, implicitly forward everything else. | 655 # Explicitly forward visibility, implicitly forward everything else. |
651 # Forwarding "*" doesn't recurse into nested scopes (to avoid copying all | 656 # Forwarding "*" doesn't recurse into nested scopes (to avoid copying all |
652 # globals into each template invocation), so won't pick up file-scoped | 657 # globals into each template invocation), so won't pick up file-scoped |
653 # variables. Normally this isn't too bad, but visibility is commonly | 658 # variables. Normally this isn't too bad, but visibility is commonly |
654 # defined at the file scope. Explicitly forwarding visibility and then | 659 # defined at the file scope. Explicitly forwarding visibility and then |
655 # excluding it from the "*" set works around this problem. | 660 # excluding it from the "*" set works around this problem. |
656 # See http://crbug.com/594610 | 661 # See http://crbug.com/594610 |
657 forward_variables_from(invoker, [ "visibility" ]) | 662 forward_variables_from(invoker, [ "visibility" ]) |
658 forward_variables_from(invoker, "*", [ "visibility" ]) | 663 forward_variables_from(invoker, "*", [ "visibility" ]) |
659 | 664 |
660 # All shared libraries must have the sanitizer deps to properly link in | 665 # All shared libraries must have the sanitizer deps to properly link in |
661 # asan mode (this target will be empty in other cases). | 666 # asan mode (this target will be empty in other cases). |
662 if (!defined(deps)) { | 667 if (!defined(deps)) { |
663 deps = [] | 668 deps = [] |
664 } | 669 } |
665 deps += [ "//build/config/sanitizers:deps" ] | 670 deps += [ "//build/config/sanitizers:deps" ] |
666 } | 671 } |
667 } | 672 } |
OLD | NEW |