OLD | NEW |
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/config/allocator.gni") | 5 import("//build/config/allocator.gni") |
6 | 6 |
7 # Only executables and not libraries should depend on the allocator target; | 7 # Only executables and not libraries should depend on the allocator target; |
8 # only the application (the final executable) knows what allocator makes sense. | 8 # only the application (the final executable) knows what allocator makes sense. |
9 # This "allocator" meta-target will forward to the default allocator according | 9 # This "allocator" meta-target will forward to the default allocator according |
10 # to the build settings. | 10 # to the build settings. |
11 group("allocator") { | 11 group("allocator") { |
| 12 public_deps = [] |
12 if (use_allocator == "tcmalloc") { | 13 if (use_allocator == "tcmalloc") { |
13 deps = [ | 14 public_deps += [ ":tcmalloc" ] |
14 ":tcmalloc", | 15 } |
15 ] | 16 |
| 17 # This condition expresses the win_use_allocator_shim in the GYP build. |
| 18 if (is_win && !is_component_build) { |
| 19 public_deps += [ ":allocator_shim" ] |
16 } | 20 } |
17 } | 21 } |
18 | 22 |
| 23 # This config defines ALLOCATOR_SHIM in the same conditions that the allocator |
| 24 # shim will be used by the allocator target. |
| 25 # |
| 26 # TODO(brettw) this is only used in one place and is kind of mess, because it |
| 27 # assumes that the library using it will eventually be linked with |
| 28 # //base/allocator in the default way. Clean this up and delete this. |
| 29 config("allocator_shim_define") { |
| 30 if (is_win && !is_component_build) { |
| 31 defines = [ "ALLOCATOR_SHIM" ] |
| 32 } |
| 33 } |
| 34 |
19 # This config and libc modification are only used on Windows. | 35 # This config and libc modification are only used on Windows. |
20 if (is_win) { | 36 if (is_win) { |
21 import("//build/config/win/visual_studio_version.gni") | 37 import("//build/config/win/visual_studio_version.gni") |
22 | 38 |
23 config("nocmt") { | 39 config("nocmt") { |
24 ldflags = [ | 40 ldflags = [ |
25 "/NODEFAULTLIB:libcmt", | 41 "/NODEFAULTLIB:libcmt", |
26 "/NODEFAULTLIB:libcmtd", | 42 "/NODEFAULTLIB:libcmtd", |
27 ] | 43 ] |
28 libs = [ rebase_path("$target_gen_dir/allocator/libcmt.lib") ] | 44 libs = [ rebase_path("$target_gen_dir/allocator/libcmt.lib") ] |
29 } | 45 } |
30 | 46 |
31 action("prep_libc") { | 47 action("prep_libc") { |
32 script = "prep_libc.py" | 48 script = "prep_libc.py" |
33 outputs = [ | 49 outputs = [ |
34 "$target_gen_dir/allocator/libcmt.lib", | 50 "$target_gen_dir/allocator/libcmt.lib", |
35 ] | 51 ] |
36 args = [ | 52 args = [ |
37 visual_studio_path + "/vc/lib", | 53 visual_studio_path + "/vc/lib", |
38 rebase_path("$target_gen_dir/allocator"), | 54 rebase_path("$target_gen_dir/allocator"), |
39 current_cpu, | 55 current_cpu, |
40 ] | 56 ] |
41 } | 57 } |
| 58 |
| 59 source_set("allocator_shim") { |
| 60 sources = [ |
| 61 "allocator_shim_win.cc", |
| 62 ] |
| 63 configs -= [ "//build/config/compiler:chromium_code" ] |
| 64 configs += [ "//build/config/compiler:no_chromium_code" ] |
| 65 |
| 66 public_configs = [ ":nocmt" ] |
| 67 deps = [ |
| 68 ":prep_libc", |
| 69 ] |
| 70 } |
42 } | 71 } |
43 | 72 |
44 if (use_allocator == "tcmalloc") { | 73 if (use_allocator == "tcmalloc") { |
45 # tcmalloc currently won't compile on Android. | 74 # tcmalloc currently won't compile on Android. |
46 source_set("tcmalloc") { | 75 source_set("tcmalloc") { |
47 tcmalloc_dir = "//third_party/tcmalloc/chromium" | 76 tcmalloc_dir = "//third_party/tcmalloc/chromium" |
48 | 77 |
49 # Don't check tcmalloc's includes. These files include various files like | 78 # Don't check tcmalloc's includes. These files include various files like |
50 # base/foo.h and they actually refer to tcmalloc's forked copy of base | 79 # base/foo.h and they actually refer to tcmalloc's forked copy of base |
51 # rather than the regular one, which confuses the header checker. | 80 # rather than the regular one, which confuses the header checker. |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 "$tcmalloc_dir/src/symbolize.h", | 171 "$tcmalloc_dir/src/symbolize.h", |
143 "$tcmalloc_dir/src/system-alloc.cc", | 172 "$tcmalloc_dir/src/system-alloc.cc", |
144 "$tcmalloc_dir/src/system-alloc.h", | 173 "$tcmalloc_dir/src/system-alloc.h", |
145 | 174 |
146 # #included by debugallocation_shim.cc | 175 # #included by debugallocation_shim.cc |
147 #"$tcmalloc_dir/src/tcmalloc.cc", | 176 #"$tcmalloc_dir/src/tcmalloc.cc", |
148 "$tcmalloc_dir/src/thread_cache.cc", | 177 "$tcmalloc_dir/src/thread_cache.cc", |
149 "$tcmalloc_dir/src/thread_cache.h", | 178 "$tcmalloc_dir/src/thread_cache.h", |
150 "$tcmalloc_dir/src/windows/port.cc", | 179 "$tcmalloc_dir/src/windows/port.cc", |
151 "$tcmalloc_dir/src/windows/port.h", | 180 "$tcmalloc_dir/src/windows/port.h", |
152 "allocator_shim.cc", | |
153 "debugallocation_shim.cc", | 181 "debugallocation_shim.cc", |
154 | 182 |
155 # These are both #included by allocator_shim for maximal linking. | 183 # These are both #included by allocator_shim for maximal linking. |
156 #"generic_allocators.cc", | 184 #"generic_allocators.cc", |
157 #"win_allocator.cc", | 185 #"win_allocator.cc", |
158 ] | 186 ] |
159 | 187 |
160 # Disable the heap checker in tcmalloc. | 188 # Disable the heap checker in tcmalloc. |
161 defines = [ "NO_HEAP_CHECK" ] | 189 defines = [ "NO_HEAP_CHECK" ] |
162 | 190 |
(...skipping 15 matching lines...) Expand all Loading... |
178 "$tcmalloc_dir/src/base/linuxthreads.cc", | 206 "$tcmalloc_dir/src/base/linuxthreads.cc", |
179 "$tcmalloc_dir/src/base/linuxthreads.h", | 207 "$tcmalloc_dir/src/base/linuxthreads.h", |
180 "$tcmalloc_dir/src/base/vdso_support.cc", | 208 "$tcmalloc_dir/src/base/vdso_support.cc", |
181 "$tcmalloc_dir/src/base/vdso_support.h", | 209 "$tcmalloc_dir/src/base/vdso_support.h", |
182 "$tcmalloc_dir/src/maybe_threads.cc", | 210 "$tcmalloc_dir/src/maybe_threads.cc", |
183 "$tcmalloc_dir/src/maybe_threads.h", | 211 "$tcmalloc_dir/src/maybe_threads.h", |
184 "$tcmalloc_dir/src/symbolize.h", | 212 "$tcmalloc_dir/src/symbolize.h", |
185 "$tcmalloc_dir/src/system-alloc.cc", | 213 "$tcmalloc_dir/src/system-alloc.cc", |
186 "$tcmalloc_dir/src/system-alloc.h", | 214 "$tcmalloc_dir/src/system-alloc.h", |
187 | 215 |
188 # included by allocator_shim.cc | |
189 "debugallocation_shim.cc", | |
190 | |
191 # cpuprofiler | 216 # cpuprofiler |
192 "$tcmalloc_dir/src/base/thread_lister.c", | 217 "$tcmalloc_dir/src/base/thread_lister.c", |
193 "$tcmalloc_dir/src/base/thread_lister.h", | 218 "$tcmalloc_dir/src/base/thread_lister.h", |
194 "$tcmalloc_dir/src/profile-handler.cc", | 219 "$tcmalloc_dir/src/profile-handler.cc", |
195 "$tcmalloc_dir/src/profile-handler.h", | 220 "$tcmalloc_dir/src/profile-handler.h", |
196 "$tcmalloc_dir/src/profiledata.cc", | 221 "$tcmalloc_dir/src/profiledata.cc", |
197 "$tcmalloc_dir/src/profiledata.h", | 222 "$tcmalloc_dir/src/profiledata.h", |
198 "$tcmalloc_dir/src/profiler.cc", | 223 "$tcmalloc_dir/src/profiler.cc", |
199 ] | 224 ] |
200 defines += [ "PERFTOOLS_DLL_DECL=" ] | 225 defines += [ "PERFTOOLS_DLL_DECL=" ] |
201 | 226 |
202 configs -= [ | 227 configs -= [ |
203 # Tcmalloc defines this itself, and we don't want duplicate definition | 228 # Tcmalloc defines this itself, and we don't want duplicate definition |
204 # warnings. | 229 # warnings. |
205 "//build/config/win:nominmax", | 230 "//build/config/win:nominmax", |
206 ] | 231 ] |
207 | 232 |
208 public_configs = [ ":nocmt" ] | 233 public_configs = [ ":nocmt" ] |
209 | 234 |
210 deps += [ ":prep_libc" ] | 235 deps += [ ":prep_libc" ] |
211 } | 236 } |
212 | 237 |
213 if (is_linux || is_android) { | 238 if (is_linux || is_android) { |
214 sources -= [ | 239 sources -= [ |
215 "$tcmalloc_dir/src/system-alloc.h", | 240 "$tcmalloc_dir/src/system-alloc.h", |
216 "$tcmalloc_dir/src/windows/port.cc", | 241 "$tcmalloc_dir/src/windows/port.cc", |
217 "$tcmalloc_dir/src/windows/port.h", | 242 "$tcmalloc_dir/src/windows/port.h", |
218 | |
219 # TODO(willchan): Support allocator shim later on. | |
220 "allocator_shim.cc", | |
221 ] | 243 ] |
222 | 244 |
223 # We enable all warnings by default, but upstream disables a few. | 245 # We enable all warnings by default, but upstream disables a few. |
224 # Keep "-Wno-*" flags in sync with upstream by comparing against: | 246 # Keep "-Wno-*" flags in sync with upstream by comparing against: |
225 # http://code.google.com/p/google-perftools/source/browse/trunk/Makefile.a
m | 247 # http://code.google.com/p/google-perftools/source/browse/trunk/Makefile.a
m |
226 cflags = [ | 248 cflags = [ |
227 "-Wno-sign-compare", | 249 "-Wno-sign-compare", |
228 "-Wno-unused-result", | 250 "-Wno-unused-result", |
229 ] | 251 ] |
230 | 252 |
(...skipping 30 matching lines...) Expand all Loading... |
261 visibility = [ "//base/*" ] | 283 visibility = [ "//base/*" ] |
262 sources = [ | 284 sources = [ |
263 "allocator_extension_thunks.cc", | 285 "allocator_extension_thunks.cc", |
264 "allocator_extension_thunks.h", | 286 "allocator_extension_thunks.h", |
265 ] | 287 ] |
266 if (is_android && !is_debug) { | 288 if (is_android && !is_debug) { |
267 configs -= [ "//build/config/compiler:optimize" ] | 289 configs -= [ "//build/config/compiler:optimize" ] |
268 configs += [ "//build/config/compiler:optimize_max" ] | 290 configs += [ "//build/config/compiler:optimize_max" ] |
269 } | 291 } |
270 } | 292 } |
OLD | NEW |