1@echo off
2rem This script adds the latest available tools to the path for the current
3rem command window. However, most builds of Python will ignore the version
4rem of the tools on PATH and use PlatformToolset instead. Ideally, both sets of
5rem tools should be the same version to avoid potential conflicts.
6rem
7rem To build Python with an earlier toolset, pass "/p:PlatformToolset=v100" (or
8rem 'v110', 'v120' or 'v140') to the build script.
9
10echo Build environments: x86, amd64, x86_amd64
11echo.
12set _ARGS=%*
13if NOT DEFINED _ARGS set _ARGS=x86
14
15if not exist "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" goto :skip_vswhere
16set VSTOOLS=
17for /F "tokens=*" %%i in ('"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -property installationPath -latest -prerelease -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64') DO @(set VSTOOLS=%%i\VC\Auxiliary\Build\vcvarsall.bat)
18if not defined VSTOOLS goto :skip_vswhere
19call "%VSTOOLS%" %_ARGS%
20exit /B 0
21
22:skip_vswhere
23if not defined VSTOOLS set VSTOOLS=%VS140COMNTOOLS%
24if not defined VSTOOLS set VSTOOLS=%VS120COMNTOOLS%
25if not defined VSTOOLS set VSTOOLS=%VS110COMNTOOLS%
26if not defined VSTOOLS set VSTOOLS=%VS100COMNTOOLS%
27call "%VSTOOLS%..\..\VC\vcvarsall.bat" %_ARGS%
28