aboutsummaryrefslogtreecommitdiffhomepage
path: root/gn/BUILDCONFIG.gn
diff options
context:
space:
mode:
authorGravatar Brian Osman <brianosman@google.com>2017-12-07 16:16:21 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-12-08 01:46:30 +0000
commit852ca318a16f9c455d2bed3efb2063dff0e4d068 (patch)
tree33a87ecf931b014864cb214ab88685683f033df7 /gn/BUILDCONFIG.gn
parent43646533fa6fb7cd6724cf00f6b8af15ac1649ea (diff)
Updated MSVC toolchain to 2017, and further refactored GN
'windk' is no longer a thing. There are two separate variables to point at your compiler (win_vc), and SDK (win_sdk). 'msvc' is no longer a thing, either. By default, we look for 2017 and then 2015 (in the default locations). If neither is located, use an assert to let users know they should set win_vc. Then, detect if win_vc points at a 2017 or 2015 installation, and configure it automatically. Because the toolchain is now 2017, update the GN files to handle building x86 in that configuration. In fact, we only support x86 builds (with 2017 or 2015) using the toolchain assets. Keep a 2015 toolchain around as a new asset, so we can add bot coverage. Docs-Preview: https://skia.org/?cl=81841 Bug: skia: Change-Id: I8c68a6f949e54c0e798a219450bbb9406f8dc6ac Reviewed-on: https://skia-review.googlesource.com/81841 Reviewed-by: Mike Klein <mtklein@chromium.org> Commit-Queue: Brian Osman <brianosman@google.com>
Diffstat (limited to 'gn/BUILDCONFIG.gn')
-rw-r--r--gn/BUILDCONFIG.gn50
1 files changed, 39 insertions, 11 deletions
diff --git a/gn/BUILDCONFIG.gn b/gn/BUILDCONFIG.gn
index e9912e2c26..80cc0986cc 100644
--- a/gn/BUILDCONFIG.gn
+++ b/gn/BUILDCONFIG.gn
@@ -25,20 +25,16 @@ declare_args() {
cc = "cc"
cxx = "c++"
- msvc = 2015
+ win_sdk = "C:/Program Files (x86)/Windows Kits/10"
+ win_sdk_version = ""
+
+ win_vc = ""
+ win_toolchain_version = ""
+
clang_win = ""
}
declare_args() {
is_debug = !is_official_build
-
- if (msvc == 2015) {
- windk = "C:/Program Files (x86)/Microsoft Visual Studio 14.0"
- } else {
- windk = "C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional"
- win_toolchain_version = ""
- }
- win_sdk = "C:/Program Files (x86)/Windows Kits/10"
- win_sdk_version = ""
}
assert(!(is_debug && is_official_build))
@@ -133,10 +129,42 @@ if (is_android) {
}
}
+msvc = ""
+if (target_os == "win") {
+ # By default we look for 2017, then 2015. If MSVC is installed in a non-default
+ # location, you can set win_vc to inform us where it is.
+ vc_2017_default =
+ "C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/VC"
+ vc_2015_default = "C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC"
+
+ if (win_vc == "") {
+ if ("True" ==
+ exec_script("//gn/checkdir.py", [ "$vc_2017_default" ], "trim string")) {
+ win_vc = vc_2017_default
+ msvc = 2017
+ } else if ("True" == exec_script("//gn/checkdir.py",
+ [ "$vc_2015_default" ],
+ "trim string")) {
+ win_vc = vc_2015_default
+ msvc = 2015
+ }
+ }
+ assert(win_vc != "") # Could not find VC installation. Set win_vc to your VC directory.
+
+ if (msvc == "") {
+ if ("True" ==
+ exec_script("//gn/checkdir.py", [ "$win_vc/Tools" ], "trim string")) {
+ msvc = 2017
+ } else {
+ msvc = 2015
+ }
+ }
+}
+
if (target_os == "win") {
if (msvc == 2017 && win_toolchain_version == "") {
win_toolchain_version = exec_script("//gn/highest_version_dir.py",
- [ "$windk/VC/Tools/MSVC" ],
+ [ "$win_vc/Tools/MSVC" ],
"trim string")
}
if (win_sdk_version == "") {