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 import("//build/config/win/visual_studio_version.gni") | |
6 | 7 |
7 # Only executables and not libraries should depend on the allocator target; | 8 # Only executables and not libraries should depend on the allocator target; |
8 # only the application (the final executable) knows what allocator makes sense. | 9 # only the application (the final executable) knows what allocator makes sense. |
9 # This "allocator" meta-target will forward to the default allocator according | 10 # This "allocator" meta-target will forward to the default allocator according |
10 # to the build settings. | 11 # to the build settings. |
11 group("allocator") { | 12 group("allocator") { |
12 if (use_allocator == "tcmalloc") { | 13 if (use_allocator == "tcmalloc") { |
13 deps = [ ":tcmalloc" ] | 14 deps = [ ":tcmalloc" ] |
14 } | 15 } |
15 } | 16 } |
16 | 17 |
18 config("nocmt") { | |
19 ldflags = [ | |
20 "/NODEFAULTLIB:libcmt", | |
21 "/NODEFAULTLIB:libcmtd", | |
22 ] | |
23 libs = [ rebase_path("$target_gen_dir/allocator/libcmt.lib") ] | |
24 } | |
25 | |
17 if (!is_android) { | 26 if (!is_android) { |
18 # tcmalloc currently won't compile on Android. | 27 # tcmalloc currently won't compile on Android. |
19 source_set("tcmalloc") { | 28 source_set("tcmalloc") { |
20 tcmalloc_dir = "//third_party/tcmalloc/chromium" | 29 tcmalloc_dir = "//third_party/tcmalloc/chromium" |
21 | 30 |
22 sources = [ | 31 sources = [ |
23 # Generated for our configuration from tcmalloc"s build | 32 # Generated for our configuration from tcmalloc"s build |
24 # and checked in. | 33 # and checked in. |
25 "$tcmalloc_dir/src/config.h", | 34 "$tcmalloc_dir/src/config.h", |
26 "$tcmalloc_dir/src/config_android.h", | 35 "$tcmalloc_dir/src/config_android.h", |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
145 # cpuprofiler | 154 # cpuprofiler |
146 "$tcmalloc_dir/src/base/thread_lister.c", | 155 "$tcmalloc_dir/src/base/thread_lister.c", |
147 "$tcmalloc_dir/src/base/thread_lister.h", | 156 "$tcmalloc_dir/src/base/thread_lister.h", |
148 "$tcmalloc_dir/src/profiledata.cc", | 157 "$tcmalloc_dir/src/profiledata.cc", |
149 "$tcmalloc_dir/src/profiledata.h", | 158 "$tcmalloc_dir/src/profiledata.h", |
150 "$tcmalloc_dir/src/profile-handler.cc", | 159 "$tcmalloc_dir/src/profile-handler.cc", |
151 "$tcmalloc_dir/src/profile-handler.h", | 160 "$tcmalloc_dir/src/profile-handler.h", |
152 "$tcmalloc_dir/src/profiler.cc", | 161 "$tcmalloc_dir/src/profiler.cc", |
153 ] | 162 ] |
154 defines += [ "PERFTOOLS_DLL_DECL=" ] | 163 defines += [ "PERFTOOLS_DLL_DECL=" ] |
164 | |
165 direct_dependent_configs = [ ":nocmt" ] | |
166 | |
167 action("prep_libc") { | |
brettw
2014/05/17 02:38:37
Can you avoid nesting targets? I've been wanting t
scottmg
2014/05/17 16:29:16
OK, I'll do that.
It seems unfortunate to move th
| |
168 script = "prep_libc.py" | |
169 outputs = [ "$target_gen_dir/allocator/libcmt.lib" ] | |
170 args = [ | |
171 visual_studio_path + "/vc/lib", | |
172 rebase_path("$target_gen_dir/allocator"), | |
173 cpu_arch, | |
174 ] | |
175 } | |
176 deps = [ | |
177 ":prep_libc", | |
178 ] | |
155 } | 179 } |
156 if (is_linux || is_android) { | 180 if (is_linux || is_android) { |
157 sources -= [ | 181 sources -= [ |
158 "$tcmalloc_dir/src/system-alloc.h", | 182 "$tcmalloc_dir/src/system-alloc.h", |
159 "$tcmalloc_dir/src/windows/port.cc", | 183 "$tcmalloc_dir/src/windows/port.cc", |
160 "$tcmalloc_dir/src/windows/port.h", | 184 "$tcmalloc_dir/src/windows/port.h", |
161 | 185 |
162 # TODO(willchan): Support allocator shim later on. | 186 # TODO(willchan): Support allocator shim later on. |
163 "allocator_shim.cc", | 187 "allocator_shim.cc", |
164 ] | 188 ] |
(...skipping 19 matching lines...) Expand all Loading... | |
184 ] | 208 ] |
185 } | 209 } |
186 | 210 |
187 # Make sure the allocation library is optimized as much as possible when | 211 # Make sure the allocation library is optimized as much as possible when |
188 # we"re in release mode. | 212 # we"re in release mode. |
189 if (!is_debug) { | 213 if (!is_debug) { |
190 configs -= [ "//build/config/compiler:optimize" ] | 214 configs -= [ "//build/config/compiler:optimize" ] |
191 configs += [ "//build/config/compiler:optimize_max" ] | 215 configs += [ "//build/config/compiler:optimize_max" ] |
192 } | 216 } |
193 | 217 |
194 deps = [ | 218 deps += [ |
195 "//base/third_party/dynamic_annotations", | 219 "//base/third_party/dynamic_annotations", |
196 ] | 220 ] |
197 | 221 |
198 if (is_win) { | 222 if (is_win) { |
199 ldflags = [ "/ignore:4006:4221" ] | 223 ldflags = [ "/ignore:4006:4221" ] |
200 } | 224 } |
201 } | 225 } |
202 } # !is_android | 226 } # !is_android |
203 | 227 |
204 source_set("allocator_extension_thunks") { | 228 source_set("allocator_extension_thunks") { |
205 visibility = "//base/*" | 229 visibility = "//base/*" |
206 sources = [ | 230 sources = [ |
207 "allocator_extension_thunks.cc", | 231 "allocator_extension_thunks.cc", |
208 "allocator_extension_thunks.h", | 232 "allocator_extension_thunks.h", |
209 ] | 233 ] |
210 } | 234 } |
OLD | NEW |