| # Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| import("//build/config/win/visual_studio_version.gni") |
| |
| # Compiler setup for the Windows SDK. Applied to all targets. |
| config("sdk") { |
| # The include path is the stuff returned by the script. |
| #include_dirs = msvc_config[0] TODO(brettw) make this work. |
| |
| defines = [ |
| "_ATL_NO_OPENGL", |
| "_WINDOWS", |
| "CERT_CHAIN_PARA_HAS_EXTRA_FIELDS", |
| "NTDDI_VERSION=0x06030000", |
| "PSAPI_VERSION=1", |
| "WIN32", |
| "_SECURE_ATL", |
| ] |
| } |
| |
| # Sets the default Windows build version. This is separated because some |
| # targets need to manually override it for their compiles. |
| config("winver") { |
| defines = [ |
| "_WIN32_WINNT=0x0603", |
| "WINVER=0x0603", |
| ] |
| } |
| |
| # Linker flags for Windows SDK setup, this is applied only to EXEs and DLLs. |
| config("sdk_link") { |
| if (current_cpu == "x64") { |
| ldflags = [ "/MACHINE:X64" ] |
| lib_dirs = [ |
| "$windows_sdk_path\Lib\winv6.3\um\x64", |
| "$visual_studio_path\VC\lib\amd64", |
| "$visual_studio_path\VC\atlmfc\lib\amd64", |
| ] |
| } else { |
| ldflags = [ |
| "/MACHINE:X86", |
| "/SAFESEH", # Not compatible with x64 so use only for x86. |
| ] |
| lib_dirs = [ |
| "$windows_sdk_path\Lib\winv6.3\um\x86", |
| "$visual_studio_path\VC\lib", |
| "$visual_studio_path\VC\atlmfc\lib", |
| ] |
| if (!is_asan) { |
| ldflags += [ "/largeaddressaware" ] |
| } |
| } |
| } |
| |
| # This default linker setup is provided separately from the SDK setup so |
| # targets who want different library configurations can remove this and specify |
| # their own. |
| config("common_linker_setup") { |
| ldflags = [ |
| "/FIXED:NO", |
| "/ignore:4199", |
| "/ignore:4221", |
| "/NXCOMPAT", |
| |
| # Suggested by Microsoft Devrel to avoid |
| # LINK : fatal error LNK1248: image size (80000000) |
| # exceeds maximum allowable size (80000000) |
| # which started happening more regularly after VS2013 Update 4. |
| "/maxilksize:2147483647", |
| ] |
| |
| # ASLR makes debugging with windbg difficult because Chrome.exe and |
| # Chrome.dll share the same base name. As result, windbg will name the |
| # Chrome.dll module like chrome_<base address>, where <base address> |
| # typically changes with each launch. This in turn means that breakpoints in |
| # Chrome.dll don't stick from one launch to the next. For this reason, we |
| # turn ASLR off in debug builds. |
| if (is_debug) { |
| ldflags += [ "/DYNAMICBASE:NO" ] |
| } else { |
| ldflags += [ "/DYNAMICBASE" ] |
| } |
| |
| # Delay loaded DLLs. |
| ldflags += [ |
| "/DELAYLOAD:dbghelp.dll", |
| "/DELAYLOAD:dwmapi.dll", |
| "/DELAYLOAD:shell32.dll", |
| "/DELAYLOAD:uxtheme.dll", |
| ] |
| } |
| |
| # Subsystem -------------------------------------------------------------------- |
| |
| config("console") { |
| ldflags = [ "/SUBSYSTEM:CONSOLE" ] |
| } |
| config("windowed") { |
| ldflags = [ "/SUBSYSTEM:WINDOWS" ] |
| } |
| |
| # Incremental linking ---------------------------------------------------------- |
| |
| config("incremental_linking") { |
| ldflags = [ "/INCREMENTAL" ] |
| } |
| config("no_incremental_linking") { |
| ldflags = [ "/INCREMENTAL:NO" ] |
| } |
| |
| # Character set ---------------------------------------------------------------- |
| |
| # Not including this config means "ansi" (8-bit system codepage). |
| config("unicode") { |
| defines = [ |
| "_UNICODE", |
| "UNICODE", |
| ] |
| } |
| |
| # Lean and mean ---------------------------------------------------------------- |
| |
| # Some third party code might not compile with WIN32_LEAN_AND_MEAN so we have |
| # to have a separate config for it. Remove this config from your target to |
| # get the "bloaty and accomodating" version of windows.h. |
| config("lean_and_mean") { |
| defines = [ "WIN32_LEAN_AND_MEAN" ] |
| } |
| |
| # Nominmax -------------------------------------------------------------------- |
| |
| # Some third party code defines NOMINMAX before including windows.h, which |
| # then causes warnings when it's been previously defined on the command line. |
| # For such targets, this config can be removed. |
| |
| config("nominmax") { |
| defines = [ "NOMINMAX" ] |
| } |