diff options
-rw-r--r-- | build/config/win/BUILD.gn | 35 | ||||
-rw-r--r-- | build/config/win/visual_studio_version.gni | 27 | ||||
-rw-r--r-- | build/vs_toolchain.py | 13 |
3 files changed, 67 insertions, 8 deletions
diff --git a/build/config/win/BUILD.gn b/build/config/win/BUILD.gn index 8f08e4f..3fed26a 100644 --- a/build/config/win/BUILD.gn +++ b/build/config/win/BUILD.gn @@ -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 diff --git a/build/config/win/visual_studio_version.gni b/build/config/win/visual_studio_version.gni index 3f156f3..c73f98a 100644 --- a/build/config/win/visual_studio_version.gni +++ b/build/config/win/visual_studio_version.gni @@ -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") diff --git a/build/vs_toolchain.py b/build/vs_toolchain.py index 4b925f0..558ad3a 100644 --- a/build/vs_toolchain.py +++ b/build/vs_toolchain.py @@ -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(): |