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
3 # found in the LICENSE file.
5 import("//build/config/sanitizers/sanitizers.gni")
6 import("//build/config/win/visual_studio_version.gni")
8 # Compiler setup for the Windows SDK. Applied to all targets.
10 # The include path is the stuff returned by the script.
11 #include_dirs = msvc_config[0] TODO(brettw) make this work.
16 "CERT_CHAIN_PARA_HAS_EXTRA_FIELDS",
17 "NTDDI_VERSION=0x06030000",
22 # This is required for ATL to use XP-safe versions of its functions.
27 # Sets the default Windows build version. This is separated because some
28 # targets need to manually override it for their compiles.
31 "_WIN32_WINNT=0x0603",
36 # Linker flags for Windows SDK setup, this is applied only to EXEs and DLLs.
38 if (current_cpu == "x64") {
39 ldflags = [ "/MACHINE:X64" ]
41 "$windows_sdk_path\Lib\winv6.3\um\x64",
42 "$visual_studio_path\VC\lib\amd64",
43 "$visual_studio_path\VC\atlmfc\lib\amd64",
48 "/SAFESEH", # Not compatible with x64 so use only for x86.
51 "$windows_sdk_path\Lib\winv6.3\um\x86",
52 "$visual_studio_path\VC\lib",
53 "$visual_studio_path\VC\atlmfc\lib",
56 ldflags += [ "/largeaddressaware" ]
61 # This default linker setup is provided separately from the SDK setup so
62 # targets who want different library configurations can remove this and specify
64 config("common_linker_setup") {
71 # Suggested by Microsoft Devrel to avoid
72 # LINK : fatal error LNK1248: image size (80000000)
73 # exceeds maximum allowable size (80000000)
74 # which started happening more regularly after VS2013 Update 4.
75 "/maxilksize:2147483647",
78 # ASLR makes debugging with windbg difficult because Chrome.exe and
79 # Chrome.dll share the same base name. As result, windbg will name the
80 # Chrome.dll module like chrome_<base address>, where <base address>
81 # typically changes with each launch. This in turn means that breakpoints in
82 # Chrome.dll don't stick from one launch to the next. For this reason, we
83 # turn ASLR off in debug builds.
85 ldflags += [ "/DYNAMICBASE:NO" ]
87 ldflags += [ "/DYNAMICBASE" ]
92 "/DELAYLOAD:dbghelp.dll",
93 "/DELAYLOAD:dwmapi.dll",
94 "/DELAYLOAD:shell32.dll",
95 "/DELAYLOAD:uxtheme.dll",
99 # Subsystem --------------------------------------------------------------------
101 # This is appended to the subsystem to specify a minimum version.
102 if (current_cpu == "x64") {
103 # The number after the comma is the minimum required OS version.
104 # 5.02 = Windows Server 2003.
105 subsystem_version_suffix = ",5.02"
108 subsystem_version_suffix = ",5.01"
112 ldflags = [ "/SUBSYSTEM:CONSOLE$subsystem_version_suffix" ]
115 ldflags = [ "/SUBSYSTEM:WINDOWS$subsystem_version_suffix" ]
118 # Incremental linking ----------------------------------------------------------
120 incremental_linking_on_switch = [ "/INCREMENTAL" ]
121 incremental_linking_off_switch = [ "/INCREMENTAL:NO" ]
123 default_incremental_linking_switch = incremental_linking_on_switch
125 default_incremental_linking_switch = incremental_linking_off_switch
128 # Applies incremental linking or not depending on the current configuration.
129 config("default_incremental_linking") {
130 ldflags = default_incremental_linking_switch
133 # Explicitly on or off incremental linking
134 config("incremental_linking") {
135 ldflags = incremental_linking_on_switch
137 config("no_incremental_linking") {
138 ldflags = incremental_linking_off_switch
141 # Some large modules can't handle incremental linking in some situations. This
142 # config should be applied to large modules to turn off incremental linking
143 # when it won't work.
144 config("default_large_module_incremental_linking") {
145 if (symbol_level > 0 && (current_cpu == "x86" || !is_component_build)) {
146 # When symbols are on, things get so large that the tools fail due to the
147 # size of the .ilk files.
148 ldflags = incremental_linking_off_switch
150 # Otherwise just do the default incremental linking for this build type.
151 ldflags = default_incremental_linking_switch
155 # Character set ----------------------------------------------------------------
157 # Not including this config means "ansi" (8-bit system codepage).
165 # Lean and mean ----------------------------------------------------------------
167 # Some third party code might not compile with WIN32_LEAN_AND_MEAN so we have
168 # to have a separate config for it. Remove this config from your target to
169 # get the "bloaty and accomodating" version of windows.h.
170 config("lean_and_mean") {
171 defines = [ "WIN32_LEAN_AND_MEAN" ]
174 # Nominmax --------------------------------------------------------------------
176 # Some third party code defines NOMINMAX before including windows.h, which
177 # then causes warnings when it's been previously defined on the command line.
178 # For such targets, this config can be removed.
181 defines = [ "NOMINMAX" ]