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 if (use_allocator == "tcmalloc") { | 12 if (use_allocator == "tcmalloc") { |
13 deps = [ ":tcmalloc" ] | 13 deps = [ ":tcmalloc" ] |
14 } | 14 } |
15 } | 15 } |
16 | 16 |
| 17 # This config and libc modification are only used on Windows. |
| 18 if (is_win) { |
| 19 import("//build/config/win/visual_studio_version.gni") |
| 20 |
| 21 config("nocmt") { |
| 22 ldflags = [ |
| 23 "/NODEFAULTLIB:libcmt", |
| 24 "/NODEFAULTLIB:libcmtd", |
| 25 ] |
| 26 libs = [ rebase_path("$target_gen_dir/allocator/libcmt.lib") ] |
| 27 } |
| 28 |
| 29 action("prep_libc") { |
| 30 script = "prep_libc.py" |
| 31 outputs = [ "$target_gen_dir/allocator/libcmt.lib" ] |
| 32 args = [ |
| 33 visual_studio_path + "/vc/lib", |
| 34 rebase_path("$target_gen_dir/allocator"), |
| 35 cpu_arch, |
| 36 ] |
| 37 } |
| 38 } |
| 39 |
17 if (!is_android) { | 40 if (!is_android) { |
18 # tcmalloc currently won't compile on Android. | 41 # tcmalloc currently won't compile on Android. |
19 source_set("tcmalloc") { | 42 source_set("tcmalloc") { |
20 tcmalloc_dir = "//third_party/tcmalloc/chromium" | 43 tcmalloc_dir = "//third_party/tcmalloc/chromium" |
21 | 44 |
22 sources = [ | 45 sources = [ |
23 # Generated for our configuration from tcmalloc"s build | 46 # Generated for our configuration from tcmalloc"s build |
24 # and checked in. | 47 # and checked in. |
25 "$tcmalloc_dir/src/config.h", | 48 "$tcmalloc_dir/src/config.h", |
26 "$tcmalloc_dir/src/config_android.h", | 49 "$tcmalloc_dir/src/config_android.h", |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 | 141 |
119 include_dirs = [ | 142 include_dirs = [ |
120 ".", | 143 ".", |
121 "$tcmalloc_dir/src/base", | 144 "$tcmalloc_dir/src/base", |
122 "$tcmalloc_dir/src", | 145 "$tcmalloc_dir/src", |
123 ] | 146 ] |
124 | 147 |
125 configs -= [ "//build/config/compiler:chromium_code" ] | 148 configs -= [ "//build/config/compiler:chromium_code" ] |
126 configs += [ "//build/config/compiler:no_chromium_code" ] | 149 configs += [ "//build/config/compiler:no_chromium_code" ] |
127 | 150 |
| 151 deps = [] |
| 152 |
128 if (is_win) { | 153 if (is_win) { |
129 sources -= [ | 154 sources -= [ |
130 "$tcmalloc_dir/src/base/elf_mem_image.cc", | 155 "$tcmalloc_dir/src/base/elf_mem_image.cc", |
131 "$tcmalloc_dir/src/base/elf_mem_image.h", | 156 "$tcmalloc_dir/src/base/elf_mem_image.h", |
132 "$tcmalloc_dir/src/base/linuxthreads.cc", | 157 "$tcmalloc_dir/src/base/linuxthreads.cc", |
133 "$tcmalloc_dir/src/base/linuxthreads.h", | 158 "$tcmalloc_dir/src/base/linuxthreads.h", |
134 "$tcmalloc_dir/src/base/vdso_support.cc", | 159 "$tcmalloc_dir/src/base/vdso_support.cc", |
135 "$tcmalloc_dir/src/base/vdso_support.h", | 160 "$tcmalloc_dir/src/base/vdso_support.h", |
136 "$tcmalloc_dir/src/maybe_threads.cc", | 161 "$tcmalloc_dir/src/maybe_threads.cc", |
137 "$tcmalloc_dir/src/maybe_threads.h", | 162 "$tcmalloc_dir/src/maybe_threads.h", |
138 "$tcmalloc_dir/src/symbolize.h", | 163 "$tcmalloc_dir/src/symbolize.h", |
139 "$tcmalloc_dir/src/system-alloc.cc", | 164 "$tcmalloc_dir/src/system-alloc.cc", |
140 "$tcmalloc_dir/src/system-alloc.h", | 165 "$tcmalloc_dir/src/system-alloc.h", |
141 | 166 |
142 # included by allocator_shim.cc | 167 # included by allocator_shim.cc |
143 "debugallocation_shim.cc", | 168 "debugallocation_shim.cc", |
144 | 169 |
145 # cpuprofiler | 170 # cpuprofiler |
146 "$tcmalloc_dir/src/base/thread_lister.c", | 171 "$tcmalloc_dir/src/base/thread_lister.c", |
147 "$tcmalloc_dir/src/base/thread_lister.h", | 172 "$tcmalloc_dir/src/base/thread_lister.h", |
148 "$tcmalloc_dir/src/profiledata.cc", | 173 "$tcmalloc_dir/src/profiledata.cc", |
149 "$tcmalloc_dir/src/profiledata.h", | 174 "$tcmalloc_dir/src/profiledata.h", |
150 "$tcmalloc_dir/src/profile-handler.cc", | 175 "$tcmalloc_dir/src/profile-handler.cc", |
151 "$tcmalloc_dir/src/profile-handler.h", | 176 "$tcmalloc_dir/src/profile-handler.h", |
152 "$tcmalloc_dir/src/profiler.cc", | 177 "$tcmalloc_dir/src/profiler.cc", |
153 ] | 178 ] |
154 defines += [ "PERFTOOLS_DLL_DECL=" ] | 179 defines += [ "PERFTOOLS_DLL_DECL=" ] |
| 180 |
| 181 direct_dependent_configs = [ ":nocmt" ] |
| 182 |
| 183 deps += [ |
| 184 ":prep_libc", |
| 185 ] |
155 } | 186 } |
| 187 |
156 if (is_linux || is_android) { | 188 if (is_linux || is_android) { |
157 sources -= [ | 189 sources -= [ |
158 "$tcmalloc_dir/src/system-alloc.h", | 190 "$tcmalloc_dir/src/system-alloc.h", |
159 "$tcmalloc_dir/src/windows/port.cc", | 191 "$tcmalloc_dir/src/windows/port.cc", |
160 "$tcmalloc_dir/src/windows/port.h", | 192 "$tcmalloc_dir/src/windows/port.h", |
161 | 193 |
162 # TODO(willchan): Support allocator shim later on. | 194 # TODO(willchan): Support allocator shim later on. |
163 "allocator_shim.cc", | 195 "allocator_shim.cc", |
164 ] | 196 ] |
165 | 197 |
(...skipping 18 matching lines...) Expand all Loading... |
184 ] | 216 ] |
185 } | 217 } |
186 | 218 |
187 # Make sure the allocation library is optimized as much as possible when | 219 # Make sure the allocation library is optimized as much as possible when |
188 # we"re in release mode. | 220 # we"re in release mode. |
189 if (!is_debug) { | 221 if (!is_debug) { |
190 configs -= [ "//build/config/compiler:optimize" ] | 222 configs -= [ "//build/config/compiler:optimize" ] |
191 configs += [ "//build/config/compiler:optimize_max" ] | 223 configs += [ "//build/config/compiler:optimize_max" ] |
192 } | 224 } |
193 | 225 |
194 deps = [ | 226 deps += [ |
195 "//base/third_party/dynamic_annotations", | 227 "//base/third_party/dynamic_annotations", |
196 ] | 228 ] |
197 | 229 |
198 if (is_win) { | 230 if (is_win) { |
199 ldflags = [ "/ignore:4006:4221" ] | 231 ldflags = [ "/ignore:4006:4221" ] |
200 } | 232 } |
201 } | 233 } |
202 } # !is_android | 234 } # !is_android |
203 | 235 |
204 source_set("allocator_extension_thunks") { | 236 source_set("allocator_extension_thunks") { |
205 visibility = "//base/*" | 237 visibility = "//base/*" |
206 sources = [ | 238 sources = [ |
207 "allocator_extension_thunks.cc", | 239 "allocator_extension_thunks.cc", |
208 "allocator_extension_thunks.h", | 240 "allocator_extension_thunks.h", |
209 ] | 241 ] |
210 } | 242 } |
OLD | NEW |