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/win/visual_studio_version.gni")
7 # Compiler setup for the Windows SDK. Applied to all targets.
9 # The include path is the stuff returned by the script.
10 #include_dirs = msvc_config[0] TODO(brettw) make this work.
15 "CERT_CHAIN_PARA_HAS_EXTRA_FIELDS",
16 "NTDDI_VERSION=0x06030000",
21 # This is required for ATL to use XP-safe versions of its functions.
26 # Sets the default Windows build version. This is separated because some
27 # targets need to manually override it for their compiles.
30 "_WIN32_WINNT=0x0603",
35 # Linker flags for Windows SDK setup, this is applied only to EXEs and DLLs.
37 if (current_cpu == "x64") {
38 ldflags = [ "/MACHINE:X64" ]
40 "$windows_sdk_path\Lib\winv6.3\um\x64",
41 "$visual_studio_path\VC\lib\amd64",
42 "$visual_studio_path\VC\atlmfc\lib\amd64",
47 "/SAFESEH", # Not compatible with x64 so use only for x86.
50 "$windows_sdk_path\Lib\winv6.3\um\x86",
51 "$visual_studio_path\VC\lib",
52 "$visual_studio_path\VC\atlmfc\lib",
55 ldflags += [ "/largeaddressaware" ]
60 # This default linker setup is provided separately from the SDK setup so
61 # targets who want different library configurations can remove this and specify
63 config("common_linker_setup") {
70 # Suggested by Microsoft Devrel to avoid
71 # LINK : fatal error LNK1248: image size (80000000)
72 # exceeds maximum allowable size (80000000)
73 # which started happening more regularly after VS2013 Update 4.
74 "/maxilksize:2147483647",
77 # ASLR makes debugging with windbg difficult because Chrome.exe and
78 # Chrome.dll share the same base name. As result, windbg will name the
79 # Chrome.dll module like chrome_<base address>, where <base address>
80 # typically changes with each launch. This in turn means that breakpoints in
81 # Chrome.dll don't stick from one launch to the next. For this reason, we
82 # turn ASLR off in debug builds.
84 ldflags += [ "/DYNAMICBASE:NO" ]
86 ldflags += [ "/DYNAMICBASE" ]
91 "/DELAYLOAD:dbghelp.dll",
92 "/DELAYLOAD:dwmapi.dll",
93 "/DELAYLOAD:shell32.dll",
94 "/DELAYLOAD:uxtheme.dll",
98 # Subsystem --------------------------------------------------------------------
100 # This is appended to the subsystem to specify a minimum version.
101 if (current_cpu == "x64") {
102 # The number after the comma is the minimum required OS version.
103 # 5.02 = Windows Server 2003.
104 subsystem_version_suffix = ",5.02"
106 # Don't specify a min version on x86.
107 subsystem_version_suffix = ""
111 ldflags = [ "/SUBSYSTEM:CONSOLE$subsystem_version_suffix" ]
114 ldflags = [ "/SUBSYSTEM:WINDOWS$subsystem_version_suffix" ]
117 # Incremental linking ----------------------------------------------------------
119 incremental_linking_on_switch = [ "/INCREMENTAL" ]
120 incremental_linking_off_switch = [ "/INCREMENTAL:NO" ]
122 default_incremental_linking_switch = incremental_linking_on_switch
124 default_incremental_linking_switch = incremental_linking_off_switch
127 # Applies incremental linking or not depending on the current configuration.
128 config("default_incremental_linking") {
129 ldflags = default_incremental_linking_switch
132 # Explicitly on or off incremental linking
133 config("incremental_linking") {
134 ldflags = incremental_linking_on_switch
136 config("no_incremental_linking") {
137 ldflags = incremental_linking_off_switch
140 # Some large modules can't handle incremental linking in some situations. This
141 # config should be applied to large modules to turn off incremental linking
142 # when it won't work.
143 config("default_large_module_incremental_linking") {
144 if (symbol_level > 0 && (current_cpu == "x86" || !is_component_build)) {
145 # When symbols are on, things get so large that the tools fail due to the
146 # size of the .ilk files.
147 ldflags = incremental_linking_off_switch
149 # Otherwise just do the default incremental linking for this build type.
150 ldflags = default_incremental_linking_switch
154 # Character set ----------------------------------------------------------------
156 # Not including this config means "ansi" (8-bit system codepage).
164 # Lean and mean ----------------------------------------------------------------
166 # Some third party code might not compile with WIN32_LEAN_AND_MEAN so we have
167 # to have a separate config for it. Remove this config from your target to
168 # get the "bloaty and accomodating" version of windows.h.
169 config("lean_and_mean") {
170 defines = [ "WIN32_LEAN_AND_MEAN" ]
173 # Nominmax --------------------------------------------------------------------
175 # Some third party code defines NOMINMAX before including windows.h, which
176 # then causes warnings when it's been previously defined on the command line.
177 # For such targets, this config can be removed.
180 defines = [ "NOMINMAX" ]