diff options
Diffstat (limited to 'chromium/build/config/win/BUILD.gn')
-rw-r--r-- | chromium/build/config/win/BUILD.gn | 145 |
1 files changed, 145 insertions, 0 deletions
diff --git a/chromium/build/config/win/BUILD.gn b/chromium/build/config/win/BUILD.gn new file mode 100644 index 00000000000..8bedbf581cc --- /dev/null +++ b/chromium/build/config/win/BUILD.gn @@ -0,0 +1,145 @@ +# 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. + +declare_args() { + # Full path to the Windows SDK, not including a backslash at the end. + windows_sdk_path = "C:\Program Files (x86)\Windows Kits\8.0" + + # Full path to the Visual Studio installation, not including a backslash + # at the end. + visual_studio_path = "C:\Program Files (x86)\Microsoft Visual Studio 10.0" +} + +# 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", + "_SECURE_ATL", + "_WIN32_WINNT=0x0602", + "_WINDOWS", + "CERT_CHAIN_PARA_HAS_EXTRA_FIELDS", + "NOMINMAX", + "NTDDI_VERSION=0x06020000", + "PSAPI_VERSION=1", + "WIN32", + "WIN32_LEAN_AND_MEAN", + "WINVER=0x0602", + ] + + # The Windows SDK include directories must be first. They both have a sal.h, + # and the SDK one is newer and the SDK uses some newer features from it not + # present in the Visual Studio one. + include_dirs = [ + "$windows_sdk_path\Include\shared", + "$windows_sdk_path\Include\um", + "$windows_sdk_path\Include\winrt", + "$visual_studio_path\VC\include", + "$visual_studio_path\VC\atlmfc\include", + ] +} + +# Linker flags for Windows SDK setup, this is applied only to EXEs and DLLs. +config("sdk_link") { + if (cpu_arch == "x64") { + ldflags = [ "/MACHINE:X64" ] + lib_dirs = [ + "$windows_sdk_path\Lib\win8\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\win8\um\x86", + "$visual_studio_path\VC\lib", + "$visual_studio_path\VC\atlmfc\lib", + ] + #if (!is_asan) { TODO(brettw) Address Sanitizer + # ldflags += "/largeaddressaware" + #} + } +} + +# This default linker setup is provided separately from the SDK setup so +# targets who want different libraries linked can remove this and specify their +# own. +config("common_linker_setup") { + ldflags = [ + "/FIXED:NO", + "/ignore:4199", + "/ignore:4221", + "/NXCOMPAT", + ] + + # 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" + } + + # Common libraries. + libs = [ + "advapi32.lib", + "comdlg32.lib", + "dbghelp.lib", + "delayimp.lib", + "dnsapi.lib", + "gdi32.lib", + "kernel32.lib", + "msimg32.lib", + "odbc32.lib", + "odbccp32.lib", + "ole32.lib", + "oleaut32.lib", + "psapi.lib", + "shell32.lib", + "shlwapi.lib", + "user32.lib", + "usp10.lib", + "uuid.lib", + "version.lib", + "wininet.lib", + "winmm.lib", + "winspool.lib", + "ws2_32.lib", + ] + + # 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" ] +} |