OLD | NEW |
1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 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 template("split_static_library") { | 5 template("split_static_library") { |
6 assert(defined(invoker.split_count), | 6 assert(defined(invoker.split_count), |
7 "Must define split_count for split_static_library") | 7 "Must define split_count for split_static_library") |
8 | 8 |
9 # In many conditions the number of inputs will be 1 (because the count will | 9 # In many conditions the number of inputs will be 1 (because the count will |
10 # be conditional on platform or configuration) so optimize that. | 10 # be conditional on platform or configuration) so optimize that. |
(...skipping 13 matching lines...) Expand all Loading... |
24 "Your values for splitting a static library generate one that has no s
ources.") | 24 "Your values for splitting a static library generate one that has no s
ources.") |
25 generated_static_libraries += [ ":$current_name" ] | 25 generated_static_libraries += [ ":$current_name" ] |
26 | 26 |
27 static_library(current_name) { | 27 static_library(current_name) { |
28 # Generated static library shard gets everything but sources (which | 28 # Generated static library shard gets everything but sources (which |
29 # we're redefining) and visibility (which is set to be the group | 29 # we're redefining) and visibility (which is set to be the group |
30 # below). | 30 # below). |
31 forward_variables_from(invoker, | 31 forward_variables_from(invoker, |
32 "*", | 32 "*", |
33 [ | 33 [ |
| 34 "check_includes", |
34 "sources", | 35 "sources", |
35 "visibility", | 36 "visibility", |
36 ]) | 37 ]) |
37 sources = current_sources | 38 sources = current_sources |
38 visibility = [ ":$group_name" ] | 39 visibility = [ ":$group_name" ] |
39 | 40 |
| 41 # When splitting a target's sources up into a series of static |
| 42 # libraries, those targets will naturally include headers from each |
| 43 # other arbitrarily. We could theoretically generate a web of |
| 44 # dependencies and allow_circular_includes_from between all pairs of |
| 45 # targets, but that's very cumbersome. Typical usage in Chrome is that |
| 46 # only official Windows builds use split static libraries due to the |
| 47 # Visual Studio size limits, and this means we'll still get header |
| 48 # checking coverage for the other configurations. |
| 49 check_includes = false |
| 50 |
40 # Uniquify the output name if one is specified. | 51 # Uniquify the output name if one is specified. |
41 if (defined(invoker.output_name)) { | 52 if (defined(invoker.output_name)) { |
42 output_name = "${invoker.output_name}_$current_library_index" | 53 output_name = "${invoker.output_name}_$current_library_index" |
43 } | 54 } |
44 } | 55 } |
45 | 56 |
46 current_library_index = current_library_index + 1 | 57 current_library_index = current_library_index + 1 |
47 } | 58 } |
48 | 59 |
49 group(group_name) { | 60 group(group_name) { |
50 public_deps = generated_static_libraries | 61 public_deps = generated_static_libraries |
51 forward_variables_from(invoker, | 62 forward_variables_from(invoker, |
52 [ | 63 [ |
53 "testonly", | 64 "testonly", |
54 "visibility", | 65 "visibility", |
55 ]) | 66 ]) |
56 } | 67 } |
57 } | 68 } |
58 } | 69 } |
59 | 70 |
60 set_defaults("split_static_library") { | 71 set_defaults("split_static_library") { |
61 configs = default_compiler_configs | 72 configs = default_compiler_configs |
62 } | 73 } |
OLD | NEW |