Add support for VS express to the GN build.

BUG=
R=scottmg@chromium.org

Review URL: https://codereview.chromium.org/306613002

git-svn-id: http://src.chromium.org/svn/trunk/src/build@273345 4ff67af0-8c30-449e-8e8b-ad334ec8d88c
This commit is contained in:
brettw@chromium.org 2014-05-28 20:32:01 +00:00
Родитель 58b666c705
Коммит da6b387202
3 изменённых файлов: 67 добавлений и 8 удалений

Просмотреть файл

@ -11,7 +11,6 @@ config("sdk") {
defines = [
"_ATL_NO_OPENGL",
"_SECURE_ATL",
"_WIN32_WINNT=0x0602",
"_WINDOWS",
"CERT_CHAIN_PARA_HAS_EXTRA_FIELDS",
@ -31,6 +30,21 @@ config("sdk") {
"$visual_studio_path\VC\include",
"$visual_studio_path\VC\atlmfc\include",
]
if (is_visual_studio_express) {
include_dirs += [
"$wdk_path/inc/atl71",
"$wdk_path/inc/mfc42",
]
# https://code.google.com/p/chromium/issues/detail?id=372451#c20
# Warning 4702 ("Unreachable code") should be re-enabled once Express users
# are updated to VS2013 Update 2.
cflags = [ "/wd4702" ]
} else {
# Only supported on non-Express versions.
defines += [ "_SECURE_ATL" ]
}
}
# Linker flags for Windows SDK setup, this is applied only to EXEs and DLLs.
@ -42,6 +56,9 @@ config("sdk_link") {
"$visual_studio_path\VC\lib\amd64",
"$visual_studio_path\VC\atlmfc\lib\amd64",
]
if (is_visual_studio_express) {
lib_dirs += [ "$wdk_path/lib/ATL/amd64" ]
}
} else {
ldflags = [
"/MACHINE:X86",
@ -52,10 +69,26 @@ config("sdk_link") {
"$visual_studio_path\VC\lib",
"$visual_studio_path\VC\atlmfc\lib",
]
if (is_visual_studio_express) {
lib_dirs += [ "$wdk_path/lib/ATL/i386" ]
}
if (!is_asan) {
ldflags += [ "/largeaddressaware" ]
}
}
if (is_visual_studio_express) {
# Explicitly required when using the ATL with express.
libs = [ "atlthunk.lib" ]
# ATL 8.0 included in WDK 7.1 makes the linker to generate almost eight
# hundred LNK4254 and LNK4078 warnings:
# - warning LNK4254: section 'ATL' (50000040) merged into '.rdata'
# (40000040) with different attributes
# - warning LNK4078: multiple 'ATL' sections found with different
# attributes
ldflags += [ "/ignore:4254", "/ignore:4078" ]
}
}
# This default linker setup is provided separately from the SDK setup so

Просмотреть файл

@ -4,9 +4,18 @@
declare_args() {
# Path to Visual Studio. If empty, the default is used which is to use the
# automatic toolchain in depot_tools.
# automatic toolchain in depot_tools. If set, you must also set the
# visual_studio_version and wdk_path.
visual_studio_path = ""
# Version of Visual Studio pointed to by the visual_studio_path.
# Use "2013" for Visual Studio 2013, or "2013e" for the Express version.
visual_studio_version = ""
# Directory of the Windows driver kit. If visual_studio_path is empty, this
# will be auto-filled.
wdk_path = ""
# Full path to the Windows SDK, not including a backslash at the end.
# This value is the default location, override if you have a different
# installation location.
@ -15,7 +24,17 @@ declare_args() {
if (visual_studio_path == "") {
toolchain_data =
exec_script("../../vs_toolchain.py", [ "get_toolchain_dir" ], "value")
visual_studio_path = toolchain_data[0]
windows_sdk_path = toolchain_data[1]
exec_script("../../vs_toolchain.py", [ "get_toolchain_dir" ], "scope")
visual_studio_path = toolchain_data.vs_path
windows_sdk_path = toolchain_data.sdk_path
visual_studio_version = toolchain_data.vs_version
wdk_path = toolchain_data.wdk_dir
} else {
assert(visual_studio_version != "",
"You must set the visual_studio_version if you set the path")
assert(wdk_path != "",
"You must set the wdk_path if you set the visual studio path")
}
# Set when using the "Express" version of a Visual Studio version we support.
is_visual_studio_express = (visual_studio_version == "2013e")

Просмотреть файл

@ -141,10 +141,17 @@ def Update():
def GetToolchainDir():
"""Gets location information about the current toolchain (must have been
previously updated by 'update')."""
previously updated by 'update'). This is used for the GN build."""
SetEnvironmentAndGetRuntimeDllDirs()
print '["%s", "%s"]' % (
os.environ['GYP_MSVS_OVERRIDE_PATH'], os.environ['WINDOWSSDKDIR'])
print '''vs_path = "%s"
sdk_path = "%s"
vs_version = "%s"
wdk_dir = "%s"
''' % (
os.environ['GYP_MSVS_OVERRIDE_PATH'],
os.environ['WINDOWSSDKDIR'],
os.environ['GYP_MSVS_VERSION'],
os.environ['WDK_DIR'])
def main():