| OLD | NEW |
| (Empty) |
| 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. | |
| 4 | |
| 5 import("//build/config/win/visual_studio_version.gni") | |
| 6 | |
| 7 # Compiler setup for the Windows SDK. Applied to all targets. | |
| 8 config("sdk") { | |
| 9 # The include path is the stuff returned by the script. | |
| 10 #include_dirs = msvc_config[0] TODO(brettw) make this work. | |
| 11 | |
| 12 defines = [ | |
| 13 "_ATL_NO_OPENGL", | |
| 14 "_WINDOWS", | |
| 15 "CERT_CHAIN_PARA_HAS_EXTRA_FIELDS", | |
| 16 "NTDDI_VERSION=0x06030000", | |
| 17 "PSAPI_VERSION=1", | |
| 18 "WIN32", | |
| 19 "_SECURE_ATL", | |
| 20 | |
| 21 # This is required for ATL to use XP-safe versions of its functions. | |
| 22 "_USING_V110_SDK71_", | |
| 23 ] | |
| 24 } | |
| 25 | |
| 26 # Sets the default Windows build version. This is separated because some | |
| 27 # targets need to manually override it for their compiles. | |
| 28 config("winver") { | |
| 29 defines = [ | |
| 30 "_WIN32_WINNT=0x0603", | |
| 31 "WINVER=0x0603", | |
| 32 ] | |
| 33 } | |
| 34 | |
| 35 # Linker flags for Windows SDK setup, this is applied only to EXEs and DLLs. | |
| 36 config("sdk_link") { | |
| 37 if (current_cpu == "x64") { | |
| 38 ldflags = [ "/MACHINE:X64" ] | |
| 39 lib_dirs = [ | |
| 40 "$windows_sdk_path\Lib\winv6.3\um\x64", | |
| 41 "$visual_studio_path\VC\lib\amd64", | |
| 42 "$visual_studio_path\VC\atlmfc\lib\amd64", | |
| 43 ] | |
| 44 } else { | |
| 45 ldflags = [ | |
| 46 "/MACHINE:X86", | |
| 47 "/SAFESEH", # Not compatible with x64 so use only for x86. | |
| 48 ] | |
| 49 lib_dirs = [ | |
| 50 "$windows_sdk_path\Lib\winv6.3\um\x86", | |
| 51 "$visual_studio_path\VC\lib", | |
| 52 "$visual_studio_path\VC\atlmfc\lib", | |
| 53 ] | |
| 54 if (!is_asan) { | |
| 55 ldflags += [ "/largeaddressaware" ] | |
| 56 } | |
| 57 } | |
| 58 } | |
| 59 | |
| 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 | |
| 62 # their own. | |
| 63 config("common_linker_setup") { | |
| 64 ldflags = [ | |
| 65 "/FIXED:NO", | |
| 66 "/ignore:4199", | |
| 67 "/ignore:4221", | |
| 68 "/NXCOMPAT", | |
| 69 | |
| 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", | |
| 75 ] | |
| 76 | |
| 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. | |
| 83 if (is_debug) { | |
| 84 ldflags += [ "/DYNAMICBASE:NO" ] | |
| 85 } else { | |
| 86 ldflags += [ "/DYNAMICBASE" ] | |
| 87 } | |
| 88 | |
| 89 # Delay loaded DLLs. | |
| 90 ldflags += [ | |
| 91 "/DELAYLOAD:dbghelp.dll", | |
| 92 "/DELAYLOAD:dwmapi.dll", | |
| 93 "/DELAYLOAD:shell32.dll", | |
| 94 "/DELAYLOAD:uxtheme.dll", | |
| 95 ] | |
| 96 } | |
| 97 | |
| 98 # Subsystem -------------------------------------------------------------------- | |
| 99 | |
| 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" | |
| 105 } else { | |
| 106 # Don't specify a min version on x86. | |
| 107 subsystem_version_suffix = "" | |
| 108 } | |
| 109 | |
| 110 config("console") { | |
| 111 ldflags = [ "/SUBSYSTEM:CONSOLE$subsystem_version_suffix" ] | |
| 112 } | |
| 113 config("windowed") { | |
| 114 ldflags = [ "/SUBSYSTEM:WINDOWS$subsystem_version_suffix" ] | |
| 115 } | |
| 116 | |
| 117 # Incremental linking ---------------------------------------------------------- | |
| 118 | |
| 119 incremental_linking_on_switch = [ "/INCREMENTAL" ] | |
| 120 incremental_linking_off_switch = [ "/INCREMENTAL:NO" ] | |
| 121 if (is_debug) { | |
| 122 default_incremental_linking_switch = incremental_linking_on_switch | |
| 123 } else { | |
| 124 default_incremental_linking_switch = incremental_linking_off_switch | |
| 125 } | |
| 126 | |
| 127 # Applies incremental linking or not depending on the current configuration. | |
| 128 config("default_incremental_linking") { | |
| 129 ldflags = default_incremental_linking_switch | |
| 130 } | |
| 131 | |
| 132 # Explicitly on or off incremental linking | |
| 133 config("incremental_linking") { | |
| 134 ldflags = incremental_linking_on_switch | |
| 135 } | |
| 136 config("no_incremental_linking") { | |
| 137 ldflags = incremental_linking_off_switch | |
| 138 } | |
| 139 | |
| 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 | |
| 148 } else { | |
| 149 # Otherwise just do the default incremental linking for this build type. | |
| 150 ldflags = default_incremental_linking_switch | |
| 151 } | |
| 152 } | |
| 153 | |
| 154 # Character set ---------------------------------------------------------------- | |
| 155 | |
| 156 # Not including this config means "ansi" (8-bit system codepage). | |
| 157 config("unicode") { | |
| 158 defines = [ | |
| 159 "_UNICODE", | |
| 160 "UNICODE", | |
| 161 ] | |
| 162 } | |
| 163 | |
| 164 # Lean and mean ---------------------------------------------------------------- | |
| 165 | |
| 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" ] | |
| 171 } | |
| 172 | |
| 173 # Nominmax -------------------------------------------------------------------- | |
| 174 | |
| 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. | |
| 178 | |
| 179 config("nominmax") { | |
| 180 defines = [ "NOMINMAX" ] | |
| 181 } | |
| OLD | NEW |