Use split_static_library in GN build.
This is a new function of GN that allows us to automatically split large
static libraries on Windows where the size becomes too large.
BUG=
Review-Url: https://codereview.chromium.org/2105513002
Cr-Commit-Position: refs/heads/master@{#402883}
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn
index 988f833..22bfb6e 100644
--- a/chrome/browser/BUILD.gn
+++ b/chrome/browser/BUILD.gn
@@ -6,6 +6,7 @@
import("//build/config/crypto.gni")
import("//build/config/features.gni")
import("//build/config/ui.gni")
+import("//build/split_static_library.gni")
import("//chrome/common/features.gni")
import("//media/media_options.gni")
import("//third_party/protobuf/proto_library.gni")
@@ -78,15 +79,16 @@
}
# Use a static library here because many test binaries depend on this but don't
-# require many files from it. This makes linking more efficient. However, on
-# Windows official builds the static library will be too large (> 32-bits) so
-# use source sets in that case.
-if (is_win && is_official_build) {
- chrome_browser_target_type = "source_set"
-} else {
- chrome_browser_target_type = "static_library"
-}
-target(chrome_browser_target_type, "browser") {
+# require many files from it. This makes linking more efficient.
+split_static_library("browser") {
+ # Split into multiple static libraries on Windows official builds, where we
+ # run into a 2GB max size limit.
+ if (is_win && is_official_build) {
+ split_count = 5
+ } else {
+ split_count = 1
+ }
+
configs += [
"//build/config/compiler:wexit_time_destructors",
"//build/config:precompiled_headers",