aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Brian Osman <brianosman@google.com>2017-12-06 13:26:38 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-12-06 19:15:55 +0000
commitd34c4a37276c240733a6d17812653636dc3656b5 (patch)
tree84e84b67935ad7475fb015aa867a5adb70493847
parent1c80ea828373c3ae3f691c29933cede3c031f407 (diff)
Add win_toolchain_version to support MSVC 2017 Updates
To make this simpler in the future, add a python script that finds the most recent 2017 toolchain, and use that. If/when we update the bot toolchain, this will be even more helpful, because the Chromium toolchain isn't perfectly in sync with the general update channel, so people are likely to have a newer/older release locally. Note that explicitly setting win_toolchain_version in your GN args suppresses the python script, so you can choose to build with whatever version you need. Bug: skia: Change-Id: Iaf6d0dd9be2623472118c3ad27b20023a205d67c Reviewed-on: https://skia-review.googlesource.com/81162 Commit-Queue: Brian Osman <brianosman@google.com> Reviewed-by: Mike Klein <mtklein@chromium.org>
-rw-r--r--gn/BUILD.gn96
-rw-r--r--gn/BUILDCONFIG.gn7
-rw-r--r--gn/highest_version_dir.py13
-rw-r--r--gn/toolchain/BUILD.gn2
4 files changed, 71 insertions, 47 deletions
diff --git a/gn/BUILD.gn b/gn/BUILD.gn
index 363965fa98..fa2f91d4ab 100644
--- a/gn/BUILD.gn
+++ b/gn/BUILD.gn
@@ -54,32 +54,34 @@ config("default") {
"NOMINMAX",
]
- _include_dirs = [
- #2017
- "$windk/VC/Tools/MSVC/14.10.25017/include",
-
- #2015
- "$windk/VC/include",
-
- # For local builds.
+ if (msvc == 2015) {
+ _include_dirs = [
+ "$windk/VC/include",
+
+ # For local builds.
+ "$windk/../Windows Kits/8.1/Include/shared",
+ "$windk/../Windows Kits/10/Include/10.0.10150.0/ucrt",
+ "$windk/../Windows Kits/8.1/Include/um",
+ "$windk/../Windows Kits/8.1/Include/winrt",
+
+ # For builds using win_toolchain asset (currently 2015).
+ "$windk/win_sdk/Include/10.0.14393.0/shared",
+ "$windk/win_sdk/Include/10.0.14393.0/ucrt",
+ "$windk/win_sdk/Include/10.0.14393.0/um",
+ "$windk/win_sdk/Include/10.0.14393.0/winrt",
+ ]
+ } else {
# 2017
- "$windk/../../../Windows Kits/10/Include/10.0.14393.0/shared",
- "$windk/../../../Windows Kits/10/Include/10.0.14393.0/ucrt",
- "$windk/../../../Windows Kits/10/Include/10.0.14393.0/um",
- "$windk/../../../Windows Kits/10/Include/10.0.14393.0/winrt",
-
- # 2015
- "$windk/../Windows Kits/8.1/Include/shared",
- "$windk/../Windows Kits/10/Include/10.0.10150.0/ucrt",
- "$windk/../Windows Kits/8.1/Include/um",
- "$windk/../Windows Kits/8.1/Include/winrt",
-
- # For builds using win_toolchain asset.
- "$windk/win_sdk/Include/10.0.14393.0/shared",
- "$windk/win_sdk/Include/10.0.14393.0/ucrt",
- "$windk/win_sdk/Include/10.0.14393.0/um",
- "$windk/win_sdk/Include/10.0.14393.0/winrt",
- ]
+ _include_dirs = [
+ "$windk/VC/Tools/MSVC/$win_toolchain_version/include",
+
+ # For local builds.
+ "$windk/../../../Windows Kits/10/Include/10.0.14393.0/shared",
+ "$windk/../../../Windows Kits/10/Include/10.0.14393.0/ucrt",
+ "$windk/../../../Windows Kits/10/Include/10.0.14393.0/um",
+ "$windk/../../../Windows Kits/10/Include/10.0.14393.0/winrt",
+ ]
+ }
if (is_clang) {
foreach(dir, _include_dirs) {
cflags += [
@@ -91,29 +93,31 @@ config("default") {
include_dirs = _include_dirs
}
- lib_dirs = [
- # For local builds.
+ if (msvc == 2015) {
+ lib_dirs = [
+ # For local builds.
+ "$windk/../Windows Kits/10/Lib/10.0.10150.0/ucrt/$target_cpu",
+ "$windk/../Windows Kits/8.1/Lib/winv6.3/um/$target_cpu",
+
+ # For builds using win_toolchain asset (currently 2015).
+ "$windk/win_sdk/Lib/10.0.14393.0/ucrt/$target_cpu",
+ "$windk/win_sdk/Lib/10.0.14393.0/um/$target_cpu",
+ ]
+
+ if (target_cpu == "x86") {
+ lib_dirs += [ "$windk/VC/lib" ]
+ } else {
+ lib_dirs += [ "$windk/VC/lib/amd64" ]
+ }
+ } else {
# 2017
- "$windk/../../../Windows Kits/10/Lib/10.0.14393.0/ucrt/$target_cpu",
- "$windk/../../../Windows Kits/10/Lib/10.0.14393.0/um/$target_cpu",
-
- #2015
- "$windk/../Windows Kits/10/Lib/10.0.10150.0/ucrt/$target_cpu",
- "$windk/../Windows Kits/8.1/Lib/winv6.3/um/$target_cpu",
-
- # For builds using win_toolchain asset.
- "$windk/win_sdk/Lib/10.0.14393.0/ucrt/$target_cpu",
- "$windk/win_sdk/Lib/10.0.14393.0/um/$target_cpu",
- ]
-
- #2017
- lib_dirs += [ "$windk/VC/Tools/MSVC/14.10.25017/lib/$target_cpu" ]
+ lib_dirs = [
+ "$windk/VC/Tools/MSVC/$win_toolchain_version/lib/$target_cpu",
- #2015
- if (target_cpu == "x86") {
- lib_dirs += [ "$windk/VC/lib" ]
- } else {
- lib_dirs += [ "$windk/VC/lib/amd64" ]
+ # For local builds.
+ "$windk/../../../Windows Kits/10/Lib/10.0.14393.0/ucrt/$target_cpu",
+ "$windk/../../../Windows Kits/10/Lib/10.0.14393.0/um/$target_cpu",
+ ]
}
} else {
cflags += [
diff --git a/gn/BUILDCONFIG.gn b/gn/BUILDCONFIG.gn
index b81680aa88..413f660a79 100644
--- a/gn/BUILDCONFIG.gn
+++ b/gn/BUILDCONFIG.gn
@@ -35,6 +35,7 @@ declare_args() {
windk = "C:/Program Files (x86)/Microsoft Visual Studio 14.0"
} else {
windk = "C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional"
+ win_toolchain_version = ""
}
}
@@ -182,6 +183,12 @@ set_defaults("component") {
}
if (is_win) {
+ if (msvc == 2017 && win_toolchain_version == "") {
+ win_toolchain_version = exec_script("//gn/highest_version_dir.py",
+ [ "$windk/VC/Tools/MSVC" ],
+ "trim string")
+ }
+
# Windows tool chain
set_default_toolchain("//gn/toolchain:msvc")
default_toolchain_name = "msvc"
diff --git a/gn/highest_version_dir.py b/gn/highest_version_dir.py
new file mode 100644
index 0000000000..650154e4f3
--- /dev/null
+++ b/gn/highest_version_dir.py
@@ -0,0 +1,13 @@
+#!/usr/bin/env python
+#
+# Copyright 2017 Google Inc.
+#
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import os
+import sys
+
+dirpath, = sys.argv[1:]
+
+print sorted(os.listdir(dirpath))[-1]
diff --git a/gn/toolchain/BUILD.gn b/gn/toolchain/BUILD.gn
index 59d83e43d7..7497bcb690 100644
--- a/gn/toolchain/BUILD.gn
+++ b/gn/toolchain/BUILD.gn
@@ -41,7 +41,7 @@ toolchain("msvc") {
env_setup = "cmd /c $windk/win_sdk/bin/SetEnv.cmd /x86 && "
}
} else {
- bin = "$windk/VC/Tools/MSVC/14.10.25017/bin/HostX64/$target_cpu"
+ bin = "$windk/VC/Tools/MSVC/$win_toolchain_version/bin/HostX64/$target_cpu"
env_setup = ""
if (target_cpu == "x86") {
print("Be sure to run")