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 5declare_args() { 6 # Full path to the Windows SDK, not including a backslash at the end. 7 windows_sdk_path = "C:\Program Files (x86)\Windows Kits\8.0" 8 9 # Full path to the Visual Studio installation, not including a backslash 10 # at the end. 11 visual_studio_path = "C:\Program Files (x86)\Microsoft Visual Studio 10.0" 12} 13 14# Compiler setup for the Windows SDK. Applied to all targets. 15config("sdk") { 16 # The include path is the stuff returned by the script. 17 #include_dirs = msvc_config[0] TODO(brettw) make this work. 18 19 defines = [ 20 "_ATL_NO_OPENGL", 21 "_SECURE_ATL", 22 "_WIN32_WINNT=0x0602", 23 "_WINDOWS", 24 "CERT_CHAIN_PARA_HAS_EXTRA_FIELDS", 25 "NOMINMAX", 26 "NTDDI_VERSION=0x06020000", 27 "PSAPI_VERSION=1", 28 "WIN32", 29 "WIN32_LEAN_AND_MEAN", 30 "WINVER=0x0602", 31 ] 32 33 # The Windows SDK include directories must be first. They both have a sal.h, 34 # and the SDK one is newer and the SDK uses some newer features from it not 35 # present in the Visual Studio one. 36 include_dirs = [ 37 "$windows_sdk_path\Include\shared", 38 "$windows_sdk_path\Include\um", 39 "$windows_sdk_path\Include\winrt", 40 "$visual_studio_path\VC\include", 41 "$visual_studio_path\VC\atlmfc\include", 42 ] 43} 44 45# Linker flags for Windows SDK setup, this is applied only to EXEs and DLLs. 46config("sdk_link") { 47 if (cpu_arch == "x64") { 48 ldflags = [ "/MACHINE:X64" ] 49 lib_dirs = [ 50 "$windows_sdk_path\Lib\win8\um\x64", 51 "$visual_studio_path\VC\lib\amd64", 52 "$visual_studio_path\VC\atlmfc\lib\amd64", 53 ] 54 } else { 55 ldflags = [ 56 "/MACHINE:X86", 57 "/SAFESEH", # Not compatible with x64 so use only for x86. 58 ] 59 lib_dirs = [ 60 "$windows_sdk_path\Lib\win8\um\x86", 61 "$visual_studio_path\VC\lib", 62 "$visual_studio_path\VC\atlmfc\lib", 63 ] 64 #if (!is_asan) { TODO(brettw) Address Sanitizer 65 # ldflags += "/largeaddressaware" 66 #} 67 } 68} 69 70# This default linker setup is provided separately from the SDK setup so 71# targets who want different libraries linked can remove this and specify their 72# own. 73config("common_linker_setup") { 74 ldflags = [ 75 "/FIXED:NO", 76 "/ignore:4199", 77 "/ignore:4221", 78 "/NXCOMPAT", 79 ] 80 81 # ASLR makes debugging with windbg difficult because Chrome.exe and 82 # Chrome.dll share the same base name. As result, windbg will name the 83 # Chrome.dll module like chrome_<base address>, where <base address> 84 # typically changes with each launch. This in turn means that breakpoints in 85 # Chrome.dll don't stick from one launch to the next. For this reason, we 86 # turn ASLR off in debug builds. 87 if (is_debug) { 88 ldflags += "/DYNAMICBASE:NO" 89 } else { 90 ldflags += "/DYNAMICBASE" 91 } 92 93 # Common libraries. 94 libs = [ 95 "advapi32.lib", 96 "comdlg32.lib", 97 "dbghelp.lib", 98 "delayimp.lib", 99 "dnsapi.lib", 100 "gdi32.lib", 101 "kernel32.lib", 102 "msimg32.lib", 103 "odbc32.lib", 104 "odbccp32.lib", 105 "ole32.lib", 106 "oleaut32.lib", 107 "psapi.lib", 108 "shell32.lib", 109 "shlwapi.lib", 110 "user32.lib", 111 "usp10.lib", 112 "uuid.lib", 113 "version.lib", 114 "wininet.lib", 115 "winmm.lib", 116 "winspool.lib", 117 "ws2_32.lib", 118 ] 119 120 # Delay loaded DLLs. 121 ldflags += [ 122 "/DELAYLOAD:dbghelp.dll", 123 "/DELAYLOAD:dwmapi.dll", 124 "/DELAYLOAD:shell32.dll", 125 "/DELAYLOAD:uxtheme.dll", 126 ] 127} 128 129# Subsystem -------------------------------------------------------------------- 130 131config("console") { 132 ldflags = [ "/SUBSYSTEM:CONSOLE" ] 133} 134config("windowed") { 135 ldflags = [ "/SUBSYSTEM:WINDOWS" ] 136} 137 138# Incremental linking ---------------------------------------------------------- 139 140config("incremental_linking") { 141 ldflags = [ "/INCREMENTAL" ] 142} 143config("no_incremental_linking") { 144 ldflags = [ "/INCREMENTAL:NO" ] 145} 146