Commit 8ce24e55 authored by Tom Anderson's avatar Tom Anderson Committed by Commit Bot

Add thin_archive config to global build config

To enable thin archives on posix, the current plan is to:
1. Land this CL.
2. Remove thin_archive from third_party build files as appropriate.
3. Uncomment the arflags = [ "-T" ] that this CL adds.

If you want a standalone static library, you now need to both set
complete_static_lib=true and remove the thin_archive config. See the comment in
build/config/compiler/BUILD.gn for details.

BUG=801925
R=thakis,dpranke
TBR=sky

Cq-Include-Trybots: master.tryserver.chromium.android:android_cronet_tester;master.tryserver.chromium.mac:ios-simulator-cronet
Change-Id: Icd1d3389da13106f46de3468475f0102a88c6211
Reviewed-on: https://chromium-review.googlesource.com/954344Reviewed-by: default avatarThomas Anderson <thomasanderson@chromium.org>
Reviewed-by: default avatarDirk Pranke <dpranke@chromium.org>
Reviewed-by: default avatarBrett Wilson <brettw@chromium.org>
Reviewed-by: default avatarNico Weber <thakis@chromium.org>
Commit-Queue: Thomas Anderson <thomasanderson@chromium.org>
Cr-Commit-Position: refs/heads/master@{#544221}
parent 529aed1e
......@@ -532,6 +532,7 @@ default_compiler_configs = [
"//build/config/compiler:no_exceptions",
"//build/config/compiler:no_rtti",
"//build/config/compiler:runtime_library",
"//build/config/compiler:thin_archive",
"//build/config/coverage:default_coverage",
"//build/config/sanitizers:default_sanitizer_flags",
]
......
......@@ -1503,6 +1503,31 @@ config("no_rtti") {
}
}
# thin_archive -----------------------------------------------------------------
#
# Enables thin archives on posix. Regular archives directly include the object
# fiels used to generate it. Thin archives merely reference the object files.
# This makes building them faster since it requires less disk IO, but is in
# appropriate if you wish to redistribute your static library.
# This config is added to the global config, so thin archives should already be
# enabled. If you want to make a distributable static library, you need to do 2
# things:
# 1. Set complete_static_lib so that all dependencies of the library make it
# into the library. See `gn help complete_static_lib` for details.
# 2. Remove the thin_archive config, so that the .a file actually contains all
# .o files, instead of just references to .o files in the build directoy
config("thin_archive") {
if (is_posix && !is_nacl) {
# TODO(thomasanderson): Remove !is_clang conditional once llvm-ar supports
# multiple dashed flags.
if (!is_clang) {
# TODO(thomasanderson): Introduce -T once :thin_archive is removed from
# all third_party repos where appropriate.
# arflags = [ "-T" ]
}
}
}
# exceptions -------------------------------------------------------------------
#
# Allows turning Exceptions on or off.
......
......@@ -21,6 +21,7 @@ config("gcapi_config") {
static_library("gcapi_lib") {
complete_static_lib = true
configs -= [ "//build/config/compiler:thin_archive" ]
sources = [
"gcapi.h",
"gcapi.mm",
......
......@@ -174,6 +174,7 @@ static_library("cronet_static") {
static_library("cronet_deps_complete") {
visibility = [ ":*" ]
complete_static_lib = true
configs -= [ "//build/config/compiler:thin_archive" ]
deps = [
":cronet_static",
]
......
......@@ -546,6 +546,7 @@ if (is_linux && !is_chromeos) {
static_library("cast_sender") {
complete_static_lib = true
configs -= [ "//build/config/compiler:thin_archive" ]
deps = [
":sender",
]
......@@ -553,6 +554,7 @@ static_library("cast_sender") {
static_library("cast_receiver") {
complete_static_lib = true
configs -= [ "//build/config/compiler:thin_archive" ]
deps = [
":receiver",
]
......
......@@ -42,6 +42,7 @@ target(cpp_target_type, "cpp") {
# This library is distributed as a part of the SDK and as such has to
# be a static library rather than a source set.
complete_static_lib = true
configs -= [ "//build/config/compiler:thin_archive" ]
}
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment