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

Side by Side Diff: base/allocator/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
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 import("//build/buildflag_header.gni") 5 import("//build/buildflag_header.gni")
6 import("//build/config/allocator.gni") 6 import("//build/config/allocator.gni")
7 import("//build/config/compiler/compiler.gni") 7 import("//build/config/compiler/compiler.gni")
8 8
9 declare_args() { 9 declare_args() {
10 # Provide a way to force disable debugallocation in Debug builds, 10 # Provide a way to force disable debugallocation in Debug builds,
11 # e.g. for profiling (it's more rare to profile Debug builds, 11 # e.g. for profiling (it's more rare to profile Debug builds,
12 # but people sometimes need to do that). 12 # but people sometimes need to do that).
13 enable_debugallocation = is_debug 13 enable_debugallocation = is_debug
14 } 14 }
15 15
16 # The Windows-only allocator shim is only enabled for Release static builds, and
17 # is mutually exclusive with the generalized shim.
18 win_use_allocator_shim = is_win && !is_component_build && !is_debug &&
19 !use_experimental_allocator_shim && !is_asan
20
21 # This "allocator" meta-target will forward to the default allocator according
22 # to the build settings.
23 group("allocator") {
24 public_deps = []
25 deps = []
26
27 if (use_allocator == "tcmalloc") {
28 deps += [ ":tcmalloc" ]
29 }
30
31 if (win_use_allocator_shim) {
32 public_deps += [ ":allocator_shim" ]
33 }
34 }
35
36 # This config defines ALLOCATOR_SHIM in the same conditions that the allocator
37 # shim will be used by the allocator target.
38 #
39 # TODO(brettw) this is only used in one place and is kind of mess, because it
40 # assumes that the library using it will eventually be linked with
41 # //base/allocator in the default way. Clean this up and delete this.
42 config("allocator_shim_define") {
43 if (win_use_allocator_shim) {
44 defines = [ "ALLOCATOR_SHIM" ]
45 }
46 }
47
48 config("tcmalloc_flags") { 16 config("tcmalloc_flags") {
49 defines = [] 17 defines = []
50 if (enable_debugallocation) { 18 if (enable_debugallocation) {
51 defines += [ 19 defines += [
52 # Use debugallocation for Debug builds to catch problems early 20 # Use debugallocation for Debug builds to catch problems early
53 # and cleanly, http://crbug.com/30715 . 21 # and cleanly, http://crbug.com/30715 .
54 "TCMALLOC_FOR_DEBUGALLOCATION", 22 "TCMALLOC_FOR_DEBUGALLOCATION",
55 ] 23 ]
56 } 24 }
57 if (use_experimental_allocator_shim) { 25 if (use_experimental_allocator_shim) {
(...skipping 23 matching lines...) Expand all
81 # We enable all warnings by default, but upstream disables a few. 49 # We enable all warnings by default, but upstream disables a few.
82 # Keep "-Wno-*" flags in sync with upstream by comparing against: 50 # Keep "-Wno-*" flags in sync with upstream by comparing against:
83 # http://code.google.com/p/google-perftools/source/browse/trunk/Makefile.am 51 # http://code.google.com/p/google-perftools/source/browse/trunk/Makefile.am
84 cflags += [ 52 cflags += [
85 "-Wno-sign-compare", 53 "-Wno-sign-compare",
86 "-Wno-unused-result", 54 "-Wno-unused-result",
87 ] 55 ]
88 } 56 }
89 } 57 }
90 58
91 # This config is only used on Windows static release builds for the
92 # allocator shim.
93 if (win_use_allocator_shim) {
94 source_set("allocator_shim") {
95 sources = [
96 "allocator_shim_win.cc",
97 "allocator_shim_win.h",
98 "winheap_stubs_win.cc",
99 "winheap_stubs_win.h",
100 ]
101 configs += [ ":allocator_shim_define" ]
102 }
103 }
104
105 if (use_allocator == "tcmalloc") { 59 if (use_allocator == "tcmalloc") {
106 # tcmalloc currently won't compile on Android. 60 # tcmalloc currently won't compile on Android.
107 source_set("tcmalloc") { 61 source_set("tcmalloc") {
108 tcmalloc_dir = "//third_party/tcmalloc/chromium" 62 tcmalloc_dir = "//third_party/tcmalloc/chromium"
109 63
110 # Don't check tcmalloc's includes. These files include various files like 64 # Don't check tcmalloc's includes. These files include various files like
111 # base/foo.h and they actually refer to tcmalloc's forked copy of base 65 # base/foo.h and they actually refer to tcmalloc's forked copy of base
112 # rather than the regular one, which confuses the header checker. 66 # rather than the regular one, which confuses the header checker.
113 check_includes = false 67 check_includes = false
114 68
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 # Make sure the allocation library is optimized as much as possible when 232 # Make sure the allocation library is optimized as much as possible when
279 # we"re in release mode. 233 # we"re in release mode.
280 if (!is_debug) { 234 if (!is_debug) {
281 configs -= [ "//build/config/compiler:default_optimization" ] 235 configs -= [ "//build/config/compiler:default_optimization" ]
282 configs += [ "//build/config/compiler:optimize_max" ] 236 configs += [ "//build/config/compiler:optimize_max" ]
283 } 237 }
284 238
285 deps += [ "//base/third_party/dynamic_annotations" ] 239 deps += [ "//base/third_party/dynamic_annotations" ]
286 } 240 }
287 } # use_allocator == "tcmalloc" 241 } # use_allocator == "tcmalloc"
288
289 buildflag_header("features") {
290 header = "features.h"
291 flags = [
292 "USE_EXPERIMENTAL_ALLOCATOR_SHIM=$use_experimental_allocator_shim",
293 "ENABLE_WIN_ALLOCATOR_SHIM_TESTS=($use_experimental_allocator_shim || $win_u se_allocator_shim)",
294 ]
295 }
296
297 if (use_experimental_allocator_shim) {
298 # Used to shim malloc symbols on Android. see //base/allocator/README.md.
299 config("wrap_malloc_symbols") {
300 ldflags = [
301 "-Wl,-wrap,calloc",
302 "-Wl,-wrap,free",
303 "-Wl,-wrap,malloc",
304 "-Wl,-wrap,memalign",
305 "-Wl,-wrap,posix_memalign",
306 "-Wl,-wrap,pvalloc",
307 "-Wl,-wrap,realloc",
308 "-Wl,-wrap,valloc",
309 ]
310 }
311
312 source_set("unified_allocator_shim") {
313 # TODO(primiano): support other platforms, currently this works only on
314 # Linux/CrOS/Android. http://crbug.com/550886 .
315 configs += [ "//base:base_implementation" ] # for BASE_EXPORT
316 visibility = [ "//base:base" ]
317 sources = [
318 "allocator_shim.cc",
319 "allocator_shim.h",
320 "allocator_shim_internals.h",
321 "allocator_shim_override_cpp_symbols.h",
322 "allocator_shim_override_libc_symbols.h",
323 ]
324 if (is_win) {
325 sources += [
326 "allocator_shim_default_dispatch_to_winheap.cc",
327 "allocator_shim_override_ucrt_symbols_win.h",
328 "winheap_stubs_win.cc",
329 "winheap_stubs_win.h",
330 ]
331 } else if (is_linux && use_allocator == "tcmalloc") {
332 sources += [
333 "allocator_shim_default_dispatch_to_tcmalloc.cc",
334 "allocator_shim_override_glibc_weak_symbols.h",
335 ]
336 deps = [
337 ":tcmalloc",
338 ]
339 } else if (is_linux && use_allocator == "none") {
340 sources += [ "allocator_shim_default_dispatch_to_glibc.cc" ]
341 } else if (is_android && use_allocator == "none") {
342 sources += [
343 "allocator_shim_default_dispatch_to_linker_wrapped_symbols.cc",
344 "allocator_shim_override_linker_wrapped_symbols.h",
345 ]
346 all_dependent_configs = [ ":wrap_malloc_symbols" ]
347 }
348 }
349 }
OLDNEW
« base/BUILD.gn ('K') | « base/BUILD.gn ('k') | media/base/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698