win: Add windows_sdk_version GN arg (see https://crbug.com/1420723)

This commit is contained in:
Marshall Greenblatt 2023-03-02 12:12:02 -05:00
parent 584b19967a
commit ae9ede9aa6
4 changed files with 32 additions and 3 deletions

View File

@ -31,6 +31,9 @@ patches = [
#
# Windows: Add cc_wrapper support for sccache builds.
# https://bitbucket.org/chromiumembedded/cef/issues/2432
#
# Windows: Add GN arg windows_sdk_version.
# https://bugs.chromium.org/p/chromium/issues/detail?id=1420723
'name': 'gn_config',
},
{

View File

@ -35,10 +35,18 @@ index 057b4081c95e5..9817b4c62a89e 100644
deps += [ "//printing:printing_unittests" ]
}
diff --git build/config/win/visual_studio_version.gni build/config/win/visual_studio_version.gni
index 2314ab505bfa2..9b79bce8fff54 100644
index 2314ab505bfa2..f10698a79102e 100644
--- build/config/win/visual_studio_version.gni
+++ build/config/win/visual_studio_version.gni
@@ -12,9 +12,8 @@ declare_args() {
@@ -5,21 +5,23 @@
declare_args() {
# Path to Visual Studio. If empty, the default is used which is to use the
# automatic toolchain in depot_tools. If set, you must also set the
- # visual_studio_version and wdk_path.
+ # visual_studio_version, wdk_path and windows_sdk_version.
visual_studio_path = ""
# Version of Visual Studio pointed to by the visual_studio_path.
# Currently always "2015".
visual_studio_version = ""
@ -50,7 +58,15 @@ index 2314ab505bfa2..9b79bce8fff54 100644
# 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
@@ -29,12 +28,11 @@ if (visual_studio_path == "") {
# installation location.
windows_sdk_path = "C:\Program Files (x86)\Windows Kits\10"
+
+ # Version of the Windows SDK pointed to by the windows_sdk_path.
+ windows_sdk_version = ""
}
if (visual_studio_path == "") {
@@ -29,12 +31,13 @@ if (visual_studio_path == "") {
windows_sdk_version = toolchain_data.sdk_version
windows_sdk_path = toolchain_data.sdk_path
visual_studio_version = toolchain_data.vs_version
@ -62,6 +78,8 @@ index 2314ab505bfa2..9b79bce8fff54 100644
- assert(wdk_path != "",
- "You must set the wdk_path if you set the visual studio path")
- visual_studio_runtime_dirs = []
+ assert(windows_sdk_version != "",
+ "You must set the windows_sdk_version if you set the path")
+ assert(visual_studio_runtime_dirs != "",
+ "You must set the visual_studio_runtime_dirs if you set the visual " +
+ "studio path")

View File

@ -93,6 +93,7 @@ if platform == 'windows':
#
# set VS_CRT_ROOT=<VS CRT root directory>
# set SDK_ROOT=<Platform SDK root directory>
# set SDK_VERSION=<Platform SDK version>
#
# o Used by various scripts as described above. These values are optional when
# vcvarsall.bat [1] exists.
@ -119,6 +120,7 @@ if platform == 'windows':
'GYP_MSVS_VERSION',
'VS_CRT_ROOT',
'SDK_ROOT',
'SDK_VERSION',
]
for var in required_vars:
if not var in os.environ.keys():
@ -129,6 +131,7 @@ if platform == 'windows':
gn_args['visual_studio_version'] = os.environ['GYP_MSVS_VERSION']
gn_args['visual_studio_runtime_dirs'] = os.environ['VS_CRT_ROOT']
gn_args['windows_sdk_path'] = os.environ['SDK_ROOT']
gn_args['windows_sdk_version'] = os.environ['SDK_VERSION']
configs = GetAllPlatformConfigs(gn_args)
for dir, config in configs.items():

View File

@ -183,6 +183,7 @@ def GetChromiumDefaultArgs():
defaults['visual_studio_version'] = ''
defaults['visual_studio_runtime_dirs'] = ''
defaults['windows_sdk_path'] = ''
defaults['windows_sdk_version'] = ''
return defaults
@ -347,6 +348,7 @@ def ValidateArgs(args):
visual_studio_version = GetArgValue(args, 'visual_studio_version')
visual_studio_runtime_dirs = GetArgValue(args, 'visual_studio_runtime_dirs')
windows_sdk_path = GetArgValue(args, 'windows_sdk_path')
windows_sdk_version = GetArgValue(args, 'windows_sdk_version')
# Target CPU architecture.
# - Windows supports "x86", "x64" and "arm64".
@ -400,6 +402,8 @@ def ValidateArgs(args):
# windows_sdk_path="<path to WinSDK>"
# The directory that contains the Win SDK. For example, a subset of
# "C:\Program Files (x86)\Windows Kits\10".
# windows_sdk_version="<WinSDK version>"
# The WinSDK version. For example, "10.0.22621.0".
#
# Required environment variables:
# DEPOT_TOOLS_WIN_TOOLCHAIN=0
@ -418,6 +422,7 @@ def ValidateArgs(args):
assert visual_studio_version != '', 'visual_studio_path requires visual_studio_version'
assert visual_studio_runtime_dirs != '', 'visual_studio_path requires visual_studio_runtime_dirs'
assert windows_sdk_path != '', 'visual_studio_path requires windows_sdk_path'
assert windows_sdk_version != '', 'visual_studio_path requires windows_sdk_version'
assert os.environ.get('DEPOT_TOOLS_WIN_TOOLCHAIN', '') == '0', \
"visual_studio_path requires DEPOT_TOOLS_WIN_TOOLCHAIN=0 env variable"