| Index: base/allocator/BUILD.gn
|
| diff --git a/base/allocator/BUILD.gn b/base/allocator/BUILD.gn
|
| index c1599bb6855669c1a2d39fe2b038f0918e5c42f5..9fdb9566e3498f79aef3c2c6e6377dc356899c7d 100644
|
| --- a/base/allocator/BUILD.gn
|
| +++ b/base/allocator/BUILD.gn
|
| @@ -5,6 +5,10 @@
|
| import("//build/buildflag_header.gni")
|
| import("//build/config/allocator.gni")
|
| import("//build/config/compiler/compiler.gni")
|
| +
|
| +if (is_win) {
|
| + import("//build/config/win/visual_studio_version.gni")
|
| +}
|
|
|
| declare_args() {
|
| # Provide a way to force disable debugallocation in Debug builds,
|
| @@ -13,21 +17,19 @@
|
| enable_debugallocation = is_debug
|
| }
|
|
|
| -# Allocator shim is only enabled for Release static builds.
|
| -win_use_allocator_shim = is_win && !is_component_build && !is_debug
|
| -
|
| # This "allocator" meta-target will forward to the default allocator according
|
| # to the build settings.
|
| group("allocator") {
|
| - public_deps = []
|
| deps = []
|
|
|
| if (use_allocator == "tcmalloc") {
|
| deps += [ ":tcmalloc" ]
|
| }
|
|
|
| - if (win_use_allocator_shim) {
|
| - public_deps += [ ":allocator_shim" ]
|
| + # This condition expresses the win_use_allocator_shim in the GYP build.
|
| + if (is_win && !is_component_build && visual_studio_version != "2015") {
|
| + deps += [ ":allocator_shim" ]
|
| + all_dependent_configs = [ ":nocmt" ]
|
| }
|
| }
|
|
|
| @@ -38,7 +40,7 @@
|
| # assumes that the library using it will eventually be linked with
|
| # //base/allocator in the default way. Clean this up and delete this.
|
| config("allocator_shim_define") {
|
| - if (win_use_allocator_shim) {
|
| + if (is_win && !is_component_build && visual_studio_version != "2015") {
|
| defines = [ "ALLOCATOR_SHIM" ]
|
| }
|
| }
|
| @@ -74,15 +76,46 @@
|
| }
|
| }
|
|
|
| -# This config is only used on Windows static release builds for the
|
| -# allocator shim.
|
| -if (win_use_allocator_shim) {
|
| - source_set("allocator_shim") {
|
| - sources = [
|
| - "allocator_shim_win.cc",
|
| - "allocator_shim_win.h",
|
| - ]
|
| - configs += [ ":allocator_shim_define" ]
|
| +# This config and libc modification are only used on Windows.
|
| +if (is_win) {
|
| + config("nocmt") {
|
| + ldflags = [
|
| + "/NODEFAULTLIB:libcmt",
|
| + "/NODEFAULTLIB:libcmtd",
|
| + ]
|
| + libs = [ rebase_path("$target_gen_dir/allocator/libcmt.lib") ]
|
| + }
|
| +
|
| + if (!is_component_build && visual_studio_version != "2015") {
|
| + action("prep_libc") {
|
| + script = "prep_libc.py"
|
| + outputs = [
|
| + "$target_gen_dir/allocator/libcmt.lib",
|
| + ]
|
| + args = [
|
| + visual_studio_path + "/vc/lib",
|
| + rebase_path("$target_gen_dir/allocator"),
|
| + current_cpu,
|
| +
|
| + # The environment file in the build directory. This is required because
|
| + # the Windows toolchain setup saves the VC paths and such so that
|
| + # running "mc.exe" will work with the configured toolchain. This file
|
| + # is in the root build dir.
|
| + "environment.$current_cpu",
|
| + ]
|
| + }
|
| +
|
| + source_set("allocator_shim") {
|
| + sources = [
|
| + "allocator_shim_win.cc",
|
| + ]
|
| + configs -= [ "//build/config/compiler:chromium_code" ]
|
| + configs += [ "//build/config/compiler:no_chromium_code" ]
|
| +
|
| + deps = [
|
| + ":prep_libc",
|
| + ]
|
| + }
|
| }
|
| }
|
|
|
|
|