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

Side by Side Diff: base/BUILD.gn

Issue 2651043008: Fold most logic from //base/allocator into //base. (Closed)
Patch Set: update all dep configs. Created 3 years, 10 months 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/allocator/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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 visibility = [ ":base" ] 115 visibility = [ ":base" ]
116 } 116 }
117 } 117 }
118 118
119 if (is_android) { 119 if (is_android) {
120 config("android_system_libs") { 120 config("android_system_libs") {
121 libs = [ "log" ] # Used by logging.cc. 121 libs = [ "log" ] # Used by logging.cc.
122 } 122 }
123 } 123 }
124 124
125 # The Windows-only allocator shim is only enabled for Release static builds, and
Primiano Tucci (use gerrit) 2017/01/26 02:03:44 Hmm wouldn't it make sense that this allocator-rel
erikchen 2017/01/26 02:09:12 win_use_allocator_shim is used by both this logic
Primiano Tucci (use gerrit) 2017/01/26 18:47:09 What I am saying is that all the windows logic (an
erikchen 2017/01/26 20:51:52 Done. [This was the first thing I tried, but for
126 # is mutually exclusive with the generalized shim.
127 win_use_allocator_shim = is_win && !is_component_build && !is_debug &&
128 !use_experimental_allocator_shim && !is_asan
129
130 # This "base_allocator" meta-target will forward to the default allocator
131 # according to the build settings.
132 group("base_allocator") {
133 public_deps = []
134 deps = []
135 if (use_allocator == "tcmalloc") {
136 deps += [ "//base/allocator:tcmalloc" ]
137 }
138
139 if (win_use_allocator_shim) {
140 public_deps += [ ":base_allocator_shim" ]
141 }
142 }
143
144 # This config defines ALLOCATOR_SHIM in the same conditions that the allocator
145 # shim will be used by the allocator target.
146 #
147 # TODO(brettw) this is only used in one place and is kind of mess, because it
148 # assumes that the library using it will eventually be linked with
149 # //base/allocator in the default way. Clean this up and delete this.
150 config("base_allocator_shim_define") {
151 if (win_use_allocator_shim) {
152 defines += [ "ALLOCATOR_SHIM" ]
153 }
154 }
155
156 # This config is only used on Windows static release builds for the
157 # allocator shim.
158 if (win_use_allocator_shim) {
159 source_set("base_allocator_shim") {
160 sources = [
161 "allocator/allocator_shim_win.cc",
162 "allocator/allocator_shim_win.h",
163 "allocator/winheap_stubs_win.cc",
164 "allocator/winheap_stubs_win.h",
165 ]
166 configs += [ ":base_allocator_shim_define" ]
167 }
168 }
169
170 buildflag_header("base_allocator_features") {
171 header = "allocator/features.h"
172 flags = [
173 "USE_EXPERIMENTAL_ALLOCATOR_SHIM=$use_experimental_allocator_shim",
174 "ENABLE_WIN_ALLOCATOR_SHIM_TESTS=($use_experimental_allocator_shim || $win_u se_allocator_shim)",
175 ]
176 }
177
178 # Used to shim malloc symbols on Android. see //base/allocator/README.md.
179 config("base_allocator_wrap_malloc_symbols") {
180 ldflags = [
181 "-Wl,-wrap,calloc",
182 "-Wl,-wrap,free",
183 "-Wl,-wrap,malloc",
184 "-Wl,-wrap,memalign",
185 "-Wl,-wrap,posix_memalign",
186 "-Wl,-wrap,pvalloc",
187 "-Wl,-wrap,realloc",
188 "-Wl,-wrap,valloc",
189 ]
190 }
191
125 # Base and everything it depends on should be a static library rather than 192 # Base and everything it depends on should be a static library rather than
126 # a source set. Base is more of a "library" in the classic sense in that many 193 # a source set. Base is more of a "library" in the classic sense in that many
127 # small parts of it are used in many different contexts. This combined with a 194 # small parts of it are used in many different contexts. This combined with a
128 # few static initializers floating around means that dead code stripping 195 # few static initializers floating around means that dead code stripping
129 # still leaves a lot of code behind that isn't always used. For example, this 196 # still leaves a lot of code behind that isn't always used. For example, this
130 # saves more than 40K for a smaller target like chrome_elf. 197 # saves more than 40K for a smaller target like chrome_elf.
131 # 198 #
132 # Use static libraries for the helper stuff as well like //base/debug since 199 # Use static libraries for the helper stuff as well like //base/debug since
133 # those things refer back to base code, which will force base compilation units 200 # those things refer back to base code, which will force base compilation units
134 # to be linked in where they wouldn't have otherwise. This does not include 201 # to be linked in where they wouldn't have otherwise. This does not include
(...skipping 941 matching lines...) Expand 10 before | Expand all | Expand 10 after
1076 "win/wait_chain.cc", 1143 "win/wait_chain.cc",
1077 "win/wait_chain.h", 1144 "win/wait_chain.h",
1078 "win/win_util.cc", 1145 "win/win_util.cc",
1079 "win/win_util.h", 1146 "win/win_util.h",
1080 "win/windows_version.cc", 1147 "win/windows_version.cc",
1081 "win/windows_version.h", 1148 "win/windows_version.h",
1082 "win/wrapped_window_proc.cc", 1149 "win/wrapped_window_proc.cc",
1083 "win/wrapped_window_proc.h", 1150 "win/wrapped_window_proc.h",
1084 ] 1151 ]
1085 1152
1153 all_dependent_configs = []
1086 defines = [] 1154 defines = []
1087 data = [] 1155 data = []
1088 1156
1089 configs += [ 1157 configs += [
1090 ":base_flags", 1158 ":base_flags",
1091 ":base_implementation", 1159 ":base_implementation",
1092 "//base/allocator:allocator_shim_define", # for allocator_check.cc. 1160 ":base_allocator_shim_define", # for allocator_check.cc.
1093 "//build/config:precompiled_headers", 1161 "//build/config:precompiled_headers",
1094 ] 1162 ]
1095 1163
1096 deps = [ 1164 deps = [
1097 "//base/allocator", 1165 ":base_allocator",
1098 "//base/allocator:features", 1166 ":base_allocator_features",
1099 "//base/third_party/dynamic_annotations", 1167 "//base/third_party/dynamic_annotations",
1100 "//third_party/modp_b64", 1168 "//third_party/modp_b64",
1101 ] 1169 ]
1102 1170
1103 public_deps = [ 1171 public_deps = [
1104 ":base_paths", 1172 ":base_paths",
1105 ":base_static", 1173 ":base_static",
1106 ":build_date", 1174 ":build_date",
1107 ":debugging_flags", 1175 ":debugging_flags",
1108 ] 1176 ]
1109 1177
1110 # Needed for <atomic> if using newer C++ library than sysroot 1178 # Needed for <atomic> if using newer C++ library than sysroot
1111 if (!use_sysroot && (is_android || (is_linux && !is_chromecast))) { 1179 if (!use_sysroot && (is_android || (is_linux && !is_chromecast))) {
1112 libs = [ "atomic" ] 1180 libs = [ "atomic" ]
1113 } 1181 }
1114 1182
1115 if (use_experimental_allocator_shim) { 1183 if (use_experimental_allocator_shim) {
1116 # The allocator shim is part of the base API. This is to allow clients of 1184 # TODO(primiano): support other platforms, currently this works only on
1117 # base should to install hooks into the allocator path. 1185 # Linux/CrOS/Android. http://crbug.com/550886 .
1118 public_deps += [ "//base/allocator:unified_allocator_shim" ] 1186 sources += [
1187 "allocator/allocator_shim.cc",
1188 "allocator/allocator_shim.h",
1189 "allocator/allocator_shim_internals.h",
1190 "allocator/allocator_shim_override_cpp_symbols.h",
1191 "allocator/allocator_shim_override_libc_symbols.h",
1192 ]
1193 if (is_win) {
1194 sources += [
1195 "allocator/allocator_shim_default_dispatch_to_winheap.cc",
1196 "allocator/allocator_shim_override_ucrt_symbols_win.h",
1197 "allocator/winheap_stubs_win.cc",
1198 "allocator/winheap_stubs_win.h",
1199 ]
1200 } else if (is_linux && use_allocator == "tcmalloc") {
1201 sources += [
1202 "allocator/allocator_shim_default_dispatch_to_tcmalloc.cc",
1203 "allocator/allocator_shim_override_glibc_weak_symbols.h",
1204 ]
1205 deps += [ "//base/allocator:tcmalloc" ]
1206 } else if (is_linux && use_allocator == "none") {
1207 sources += [ "allocator/allocator_shim_default_dispatch_to_glibc.cc" ]
1208 } else if (is_android && use_allocator == "none") {
1209 sources += [
1210 "allocator/allocator_shim_default_dispatch_to_linker_wrapped_symbols.cc" ,
1211 "allocator/allocator_shim_override_linker_wrapped_symbols.h",
1212 ]
1213 all_dependent_configs += [ ":base_allocator_wrap_malloc_symbols" ]
1214 }
1119 } 1215 }
1120 1216
1121 # Allow more direct string conversions on platforms with native utf8 1217 # Allow more direct string conversions on platforms with native utf8
1122 # strings 1218 # strings
1123 if (is_mac || is_ios || is_chromeos || is_chromecast) { 1219 if (is_mac || is_ios || is_chromeos || is_chromecast) {
1124 defines += [ "SYSTEM_NATIVE_UTF8" ] 1220 defines += [ "SYSTEM_NATIVE_UTF8" ]
1125 } 1221 }
1126 1222
1127 # Android. 1223 # Android.
1128 if (is_android) { 1224 if (is_android) {
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
1369 # TODO(jschuh): crbug.com/167187 fix size_t to int truncations. 1465 # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
1370 configs += [ "//build/config/compiler:no_size_t_to_int_warning" ] 1466 configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
1371 1467
1372 libs = [ 1468 libs = [
1373 "cfgmgr32.lib", 1469 "cfgmgr32.lib",
1374 "powrprof.lib", 1470 "powrprof.lib",
1375 "setupapi.lib", 1471 "setupapi.lib",
1376 "userenv.lib", 1472 "userenv.lib",
1377 "winmm.lib", 1473 "winmm.lib",
1378 ] 1474 ]
1379 all_dependent_configs = [ ":base_win_linker_flags" ] 1475 all_dependent_configs += [ ":base_win_linker_flags" ]
1380 } else if (!is_nacl || is_nacl_nonsfi) { 1476 } else if (!is_nacl || is_nacl_nonsfi) {
1381 # Non-Windows. 1477 # Non-Windows.
1382 deps += [ "//base/third_party/libevent" ] 1478 deps += [ "//base/third_party/libevent" ]
1383 } 1479 }
1384 1480
1385 # Desktop Mac. 1481 # Desktop Mac.
1386 if (is_mac) { 1482 if (is_mac) {
1387 sources += [ 1483 sources += [
1388 "mac/scoped_typeref.h", 1484 "mac/scoped_typeref.h",
1389 "power_monitor/power_monitor_device_source_mac.mm", 1485 "power_monitor/power_monitor_device_source_mac.mm",
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
1426 1522
1427 # TODO(brettw) this will need to be parameterized at some point. 1523 # TODO(brettw) this will need to be parameterized at some point.
1428 linux_configs = [] 1524 linux_configs = []
1429 if (use_glib) { 1525 if (use_glib) {
1430 linux_configs += [ "//build/config/linux:glib" ] 1526 linux_configs += [ "//build/config/linux:glib" ]
1431 } 1527 }
1432 1528
1433 defines += [ "USE_SYMBOLIZE" ] 1529 defines += [ "USE_SYMBOLIZE" ]
1434 1530
1435 configs += linux_configs 1531 configs += linux_configs
1436 all_dependent_configs = linux_configs 1532 all_dependent_configs += linux_configs
1437 1533
1438 # These dependencies are not required on Android, and in the case 1534 # These dependencies are not required on Android, and in the case
1439 # of xdg_mime must be excluded due to licensing restrictions. 1535 # of xdg_mime must be excluded due to licensing restrictions.
1440 deps += [ 1536 deps += [
1441 "//base/third_party/symbolize", 1537 "//base/third_party/symbolize",
1442 "//base/third_party/xdg_mime", 1538 "//base/third_party/xdg_mime",
1443 "//base/third_party/xdg_user_dirs", 1539 "//base/third_party/xdg_user_dirs",
1444 ] 1540 ]
1445 } else { 1541 } else {
1446 # Non-Linux. 1542 # Non-Linux.
(...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after
2120 "win/wait_chain_unittest.cc", 2216 "win/wait_chain_unittest.cc",
2121 "win/win_util_unittest.cc", 2217 "win/win_util_unittest.cc",
2122 "win/windows_version_unittest.cc", 2218 "win/windows_version_unittest.cc",
2123 "win/wrapped_window_proc_unittest.cc", 2219 "win/wrapped_window_proc_unittest.cc",
2124 ] 2220 ]
2125 2221
2126 defines = [] 2222 defines = []
2127 2223
2128 deps = [ 2224 deps = [
2129 ":base", 2225 ":base",
2226 ":base_allocator_features",
2130 ":i18n", 2227 ":i18n",
2131 ":message_loop_tests", 2228 ":message_loop_tests",
2132 "//base/allocator:features",
2133 "//base/test:native_library_test_utils", 2229 "//base/test:native_library_test_utils",
2134 "//base/test:run_all_base_unittests", 2230 "//base/test:run_all_base_unittests",
2135 "//base/test:test_support", 2231 "//base/test:test_support",
2136 "//base/third_party/dynamic_annotations", 2232 "//base/third_party/dynamic_annotations",
2137 "//testing/gmock", 2233 "//testing/gmock",
2138 "//testing/gtest", 2234 "//testing/gtest",
2139 "//third_party/icu", 2235 "//third_party/icu",
2140 ] 2236 ]
2141 2237
2142 data_deps = [ 2238 data_deps = [
2143 "//base/test:test_shared_library", 2239 "//base/test:test_shared_library",
2144 ] 2240 ]
2145 2241
2146 if (is_ios || is_mac) { 2242 if (is_ios || is_mac) {
2147 deps += [ ":base_unittests_arc" ] 2243 deps += [ ":base_unittests_arc" ]
2148 } 2244 }
2149 2245
2150 public_deps = [ 2246 public_deps = [
2151 ":base_unittests_bundle_data", 2247 ":base_unittests_bundle_data",
2152 ] 2248 ]
2153 2249
2154 # Some unittests depend on the ALLOCATOR_SHIM macro. 2250 # Some unittests depend on the ALLOCATOR_SHIM macro.
2155 configs += [ "//base/allocator:allocator_shim_define" ] 2251 configs += [ ":base_allocator_shim_define" ]
2156 2252
2157 data = [ 2253 data = [
2158 "test/data/", 2254 "test/data/",
2159 ] 2255 ]
2160 2256
2161 # Allow more direct string conversions on platforms with native utf8 2257 # Allow more direct string conversions on platforms with native utf8
2162 # strings 2258 # strings
2163 if (is_mac || is_ios || is_chromeos || is_chromecast) { 2259 if (is_mac || is_ios || is_chromeos || is_chromecast) {
2164 defines += [ "SYSTEM_NATIVE_UTF8" ] 2260 defines += [ "SYSTEM_NATIVE_UTF8" ]
2165 } 2261 }
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
2590 } 2686 }
2591 2687
2592 fuzzer_test("base_json_correctness_fuzzer") { 2688 fuzzer_test("base_json_correctness_fuzzer") {
2593 sources = [ 2689 sources = [
2594 "json/correctness_fuzzer.cc", 2690 "json/correctness_fuzzer.cc",
2595 ] 2691 ]
2596 deps = [ 2692 deps = [
2597 ":base", 2693 ":base",
2598 ] 2694 ]
2599 } 2695 }
OLDNEW
« no previous file with comments | « no previous file | base/allocator/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698