Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(168)

Side by Side Diff: base/BUILD.gn

Issue 1545493002: Make base a static ibrary (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nonsfi Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | base/third_party/dynamic_annotations/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 # HOW TO WRITE CONDITIONALS IN THIS FILE 5 # HOW TO WRITE CONDITIONALS IN THIS FILE
6 # ====================================== 6 # ======================================
7 # 7 #
8 # In many other places, one would write a conditional that expresses all the 8 # In many other places, one would write a conditional that expresses all the
9 # cases when a source file is used or unused, and then either add or subtract 9 # cases when a source file is used or unused, and then either add or subtract
10 # it from the sources list in that case 10 # it from the sources list in that case
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 if (is_nacl_nonsfi) { 57 if (is_nacl_nonsfi) {
58 # Must be in a config because of how GN orders flags (otherwise -Wall will 58 # Must be in a config because of how GN orders flags (otherwise -Wall will
59 # appear after this, and turn it back on). 59 # appear after this, and turn it back on).
60 config("nacl_nonsfi_warnings") { 60 config("nacl_nonsfi_warnings") {
61 # file_util_posix.cc contains a function which is not 61 # file_util_posix.cc contains a function which is not
62 # being used by nacl_helper_nonsfi. 62 # being used by nacl_helper_nonsfi.
63 cflags = [ "-Wno-unused-function" ] 63 cflags = [ "-Wno-unused-function" ]
64 } 64 }
65 } 65 }
66 66
67 source_set("base_paths") { 67 if (is_nacl) {
68 sources = [ 68 # None of the files apply to nacl, and we can't make an empty static library.
69 "base_paths.cc", 69 group("base_paths") {
70 "base_paths.h", 70 }
71 "base_paths_android.cc", 71 } else {
72 "base_paths_android.h", 72 static_library("base_paths") {
73 "base_paths_mac.h", 73 sources = [
74 "base_paths_mac.mm", 74 "base_paths.cc",
75 "base_paths_posix.cc", 75 "base_paths.h",
76 "base_paths_posix.h", 76 "base_paths_android.cc",
77 "base_paths_win.cc", 77 "base_paths_android.h",
78 "base_paths_win.h", 78 "base_paths_mac.h",
79 ] 79 "base_paths_mac.mm",
80 "base_paths_posix.cc",
81 "base_paths_posix.h",
82 "base_paths_win.cc",
83 "base_paths_win.h",
84 ]
80 85
81 if (is_android || is_mac || is_ios) { 86 if (is_android || is_mac || is_ios) {
82 sources -= [ "base_paths_posix.cc" ] 87 sources -= [ "base_paths_posix.cc" ]
88 }
89
90 configs += [ ":base_implementation" ]
91
92 visibility = [ ":base" ]
83 } 93 }
84
85 if (is_nacl) {
86 sources -= [
87 "base_paths.cc",
88 "base_paths_posix.cc",
89 ]
90 }
91
92 configs += [ ":base_implementation" ]
93
94 visibility = [ ":base" ]
95 } 94 }
96 95
97 config("android_system_libs") { 96 config("android_system_libs") {
98 libs = [ "log" ] # Used by logging.cc. 97 libs = [ "log" ] # Used by logging.cc.
99 } 98 }
100 99
101 component("base") { 100 # Base and everything it depends on should be a static library rather than
101 # a source set. Base is more of a "library" in the classic sense in that many
102 # small parts of it are used in many different contexts. This combined with a
103 # few static initializers floating around means that dead code stripping
104 # still leaves a lot of code behind that isn't always used. For example, this
105 # saves more than 40K for a smaller target like chrome_elf.
106 #
107 # Use static libraries for the helper stuff as well like //base/debug since
108 # those things refer back to base code, which will force base compilation units
109 # to be linked in where they wouldn't have otherwise. This does not include
110 # test code (test support and anything in the test directory) which should use
111 # source_set as is recommended for GN targets).
112 if (is_component_build) {
113 base_target_type = "shared_library"
114 } else {
115 # TODO(phosek) bug 570839: If field_trial.cc is in a static library,
116 # hacl_helper_nonsfi doesn't link properly on Linux in debug builds. The
Dirk Pranke 2015/12/23 03:41:58 nit: s/hacl_helper_nonsfi/nacl_helper_nonsfi
117 # reasons for this seem to involve obscure toolchain bugs. This should be
118 # fixed and this target should always be a static_library in the
119 # non-component case.
120 if (is_nacl_nonsfi) {
121 base_target_type = "source_set"
122 } else {
123 base_target_type = "static_library"
124 }
125 }
126 target(base_target_type, "base") {
102 sources = [ 127 sources = [
103 "allocator/allocator_extension.cc", 128 "allocator/allocator_extension.cc",
104 "allocator/allocator_extension.h", 129 "allocator/allocator_extension.h",
105 "android/animation_frame_time_histogram.cc", 130 "android/animation_frame_time_histogram.cc",
106 "android/animation_frame_time_histogram.h", 131 "android/animation_frame_time_histogram.h",
107 "android/apk_assets.cc", 132 "android/apk_assets.cc",
108 "android/apk_assets.h", 133 "android/apk_assets.h",
109 "android/application_status_listener.cc", 134 "android/application_status_listener.cc",
110 "android/application_status_listener.h", 135 "android/application_status_listener.h",
111 "android/base_jni_onload.cc", 136 "android/base_jni_onload.cc",
(...skipping 1193 matching lines...) Expand 10 before | Expand all | Expand 10 after
1305 1330
1306 buildflag_header("debugging_flags") { 1331 buildflag_header("debugging_flags") {
1307 header = "debugging_flags.h" 1332 header = "debugging_flags.h"
1308 header_dir = "base/debug" 1333 header_dir = "base/debug"
1309 flags = [ "ENABLE_PROFILING=$enable_profiling" ] 1334 flags = [ "ENABLE_PROFILING=$enable_profiling" ]
1310 } 1335 }
1311 1336
1312 # This is the subset of files from base that should not be used with a dynamic 1337 # This is the subset of files from base that should not be used with a dynamic
1313 # library. Note that this library cannot depend on base because base depends on 1338 # library. Note that this library cannot depend on base because base depends on
1314 # base_static. 1339 # base_static.
1315 source_set("base_static") { 1340 static_library("base_static") {
1316 sources = [ 1341 sources = [
1317 "base_switches.cc", 1342 "base_switches.cc",
1318 "base_switches.h", 1343 "base_switches.h",
1319 "win/pe_image.cc", 1344 "win/pe_image.cc",
1320 "win/pe_image.h", 1345 "win/pe_image.h",
1321 ] 1346 ]
1322 1347
1323 if (!is_debug) { 1348 if (!is_debug) {
1324 configs -= [ "//build/config/compiler:default_optimization" ] 1349 configs -= [ "//build/config/compiler:default_optimization" ]
1325 configs += [ "//build/config/compiler:optimize_max" ] 1350 configs += [ "//build/config/compiler:optimize_max" ]
(...skipping 796 matching lines...) Expand 10 before | Expand all | Expand 10 after
2122 2147
2123 # GYP: //base.gyp:base_java_unittest_support 2148 # GYP: //base.gyp:base_java_unittest_support
2124 android_library("base_java_unittest_support") { 2149 android_library("base_java_unittest_support") {
2125 deps = [ 2150 deps = [
2126 ":base_java", 2151 ":base_java",
2127 ] 2152 ]
2128 java_files = 2153 java_files =
2129 [ "test/android/java/src/org/chromium/base/ContentUriTestUtils.java" ] 2154 [ "test/android/java/src/org/chromium/base/ContentUriTestUtils.java" ]
2130 } 2155 }
2131 } 2156 }
OLDNEW
« no previous file with comments | « no previous file | base/third_party/dynamic_annotations/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698