Skip to content

Commit

Permalink
Remove support for GYP_MSVS_VERSION env variable
Browse files Browse the repository at this point in the history
We support changing Visual Studio versions with the `--ide=vs2017`
flag to `gn gen`. The default version is now VS2019.

Bug: 1038364
Change-Id: I4de7849aab72bfdf1a4ba7465858816500abf122
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1984705
Reviewed-by: Bruce Dawson <brucedawson@chromium.org>
Reviewed-by: Peter Kasting <pkasting@chromium.org>
Commit-Queue: Aaron Gable <agable@chromium.org>
Cr-Commit-Position: refs/heads/master@{#729856}
  • Loading branch information
aarongable authored and Commit Bot committed Jan 9, 2020
1 parent 77eb7e8 commit dad9e0f
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 20 deletions.
2 changes: 1 addition & 1 deletion build/toolchain/win/setup_toolchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def _ExtractImportantEnvironment(output_of_set):


def _DetectVisualStudioPath():
"""Return path to the GYP_MSVS_VERSION of Visual Studio.
"""Return path to the installed Visual Studio.
"""

# Use the code in build/vs_toolchain.py to avoid duplicating code.
Expand Down
16 changes: 2 additions & 14 deletions build/vs_toolchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ def SetEnvironmentAndGetRuntimeDllDirs():
vs_runtime_dll_dirs.append('Arm64Unused')

os.environ['GYP_MSVS_OVERRIDE_PATH'] = toolchain
os.environ['GYP_MSVS_VERSION'] = version

os.environ['WINDOWSSDKDIR'] = win_sdk
os.environ['WDK_DIR'] = wdk
Expand All @@ -92,8 +91,6 @@ def SetEnvironmentAndGetRuntimeDllDirs():
elif sys.platform == 'win32' and not depot_tools_win_toolchain:
if not 'GYP_MSVS_OVERRIDE_PATH' in os.environ:
os.environ['GYP_MSVS_OVERRIDE_PATH'] = DetectVisualStudioPath()
if not 'GYP_MSVS_VERSION' in os.environ:
os.environ['GYP_MSVS_VERSION'] = GetVisualStudioVersion()

# When using an installed toolchain these files aren't needed in the output
# directory in order to run binaries locally, but they are needed in order
Expand Down Expand Up @@ -143,11 +140,6 @@ def _RegistryGetValue(key, value):
def GetVisualStudioVersion():
"""Return best available version of Visual Studio.
"""

env_version = os.environ.get('GYP_MSVS_VERSION')
if env_version:
return env_version

supported_versions = MSVS_VERSIONS.keys()

# VS installed in depot_tools for Googlers
Expand Down Expand Up @@ -175,7 +167,7 @@ def GetVisualStudioVersion():


def DetectVisualStudioPath():
"""Return path to the GYP_MSVS_VERSION of Visual Studio.
"""Return path to the installed Visual Studio.
"""

# Note that this code is used from
Expand Down Expand Up @@ -203,8 +195,7 @@ def DetectVisualStudioPath():
if path and os.path.exists(path):
return path

raise Exception('Visual Studio Version %s (from GYP_MSVS_VERSION)'
' not found.' % version_as_year)
raise Exception('Visual Studio Version %s not found.' % version_as_year)


def _CopyRuntimeImpl(target, source, verbose=True):
Expand Down Expand Up @@ -500,9 +491,6 @@ def Update(force=False, no_download=False):
subprocess.check_call([
ciopfs, '-o', 'use_ino', toolchain_dir + '.ciopfs', toolchain_dir])

# Necessary so that get_toolchain_if_necessary.py will put the VS toolkit
# in the correct directory.
os.environ['GYP_MSVS_VERSION'] = GetVisualStudioVersion()
get_toolchain_args = [
sys.executable,
os.path.join(depot_tools_path,
Expand Down
7 changes: 3 additions & 4 deletions docs/windows_build_instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,7 @@ if your system PATH has a Python in it, you will be out of luck.

Also, add a DEPOT_TOOLS_WIN_TOOLCHAIN system variable in the same way, and set
it to 0. This tells depot_tools to use your locally installed version of Visual
Studio (by default, depot_tools will try to use a google-internal version). If
you want to build with Visual Studio 2017 instead of Visual Studio 2019 (the
default) then set the GYP_MSVS_VERSION environment variable to 2017.
Studio (by default, depot_tools will try to use a google-internal version).

From a cmd.exe shell, run the command gclient (without arguments). On first
run, gclient will install all the Windows-specific bits needed to work with
Expand Down Expand Up @@ -168,7 +166,8 @@ $ gn gen out/Default
update the build files as needed.
* You can replace `Default` with another name, but
it should be a subdirectory of `out`.
* For other build arguments, including release settings, see [GN build
* For other build arguments, including release settings or using an alternate
version of Visual Studio, see [GN build
configuration](https://www.chromium.org/developers/gn-build-configuration).
The default will be a debug component build matching the current host
operating system and CPU.
Expand Down
2 changes: 1 addition & 1 deletion tools/win/setenv.bat
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ REM Use of this source code is governed by a BSD-style license that can be
REM found in the LICENSE file.

REM Run this script to add the current toolchain, as determined by
REM GYP_MSVS_VERSION, DEPOT_TOOLS_WIN_TOOLCHAIN and the hash in vs_toolchain.py,
REM DEPOT_TOOLS_WIN_TOOLCHAIN and the hash in vs_toolchain.py,
REM to the path. Be aware of running this multiple times as too-long paths will
REM break things.
REM To get the toolchain for x64 targets pass /x64 to this batch file.
Expand Down

0 comments on commit dad9e0f

Please sign in to comment.