Skip to content
This repository was archived by the owner on Aug 30, 2024. It is now read-only.

Commit 5639708

Browse files
committed
Refinement of toolchain setting script.
1 parent bf08073 commit 5639708

File tree

2 files changed

+19
-7
lines changed

2 files changed

+19
-7
lines changed
Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
@@echo on
2-
REM set Visual Studio 2017 toolchain (v141)
2+
REM set Visual Studio toolchain given bitness, VS year and toolchain number.
33
IF [%1] == [] GOTO NoArgErr
44
set VS_BITS=%1
55
IF [%2] == [] GOTO NoArgErr
66
set VS_YEAR=%2
7+
IF [%3] == [] GOTO NoArgErr
8+
set VS_TOOLCHAIN=%3
79

810

11+
REM Tools can come from any of Professional, Community, BuildTools or Enterprise install.
912
if not exist "%VSINSTALLDIR%" (
1013
set "VSINSTALLDIR=%ProgramFiles(x86)%\Microsoft Visual Studio\%VS_YEAR%\Professional\"
1114
)
@@ -19,6 +22,7 @@ if not exist "%VSINSTALLDIR%" (
1922
set "VSINSTALLDIR=%ProgramFiles(x86)%\Microsoft Visual Studio\%VS_YEAR%\Enterprise\"
2023
)
2124

25+
REM Discover the latest Windows SDK available.
2226
call :GetWin10SdkDir
2327
:: dir /ON here is sorting the list of folders, such that we use the latest one that we have
2428
for /F %%i in ('dir /ON /B "%WindowsSdkDir%\include\10.*"') DO (
@@ -30,13 +34,20 @@ if errorlevel 1 (
3034
echo Windows SDK version found as: "%WindowsSDKVer%"
3135
)
3236

33-
call "%VSINSTALLDIR%\VC\Auxiliary\Build\vcvars%1.bat" -vcvars_ver=14.16 %WindowsSDKVer%
37+
REM Set bitness, toolchain version and SDK.
38+
call "%VSINSTALLDIR%\VC\Auxiliary\Build\vcvars%1.bat" -vcvars_ver=%VS_TOOLCHAIN% %WindowsSDKVer%
3439
REM https://docs.python.org/3.9/distutils/apiref.html#module-distutils.msvccompiler
35-
REM Force our SDK, rather than Python's
40+
REM or
41+
REM https://setuptools.pypa.io/en/latest/deprecated/distutils/apiref.html#module-distutils.msvccompiler
42+
REM Force our SDK, rather than the Python was built with.
3643
set DISTUTILS_USE_SDK=1
3744
set MSSdk=1
45+
46+
REM All done, finish here.
3847
goto:eof
3948

49+
REM Various subroutines.
50+
4051
:GetWin10SdkDir
4152
call :GetWin10SdkDirHelper HKLM\SOFTWARE\Wow6432Node > nul 2>&1
4253
if errorlevel 1 call :GetWin10SdkDirHelper HKCU\SOFTWARE\Wow6432Node > nul 2>&1
@@ -55,5 +66,6 @@ for /F "tokens=1,2*" %%i in ('reg query "%1\Microsoft\Microsoft SDKs\Windows\v10
5566
exit /B 0
5667

5768
:NoArgErr
58-
echo "Need to specify input bitness and VS year"
59-
exit 1
69+
echo "Need to specify input bitness, VS year and toolchain number"
70+
echo "e.g 64 2019 14.16"
71+
exit 1

azure/windows.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ jobs:
2222

2323
- task: BatchScript@1
2424
inputs:
25-
filename: azure/set_141.cmd
26-
arguments: $(BITS) 2019
25+
filename: azure/set_vs_toolchain.cmd
26+
arguments: $(BITS) 2019 14.16
2727
modifyEnvironment: True
2828

2929
- powershell: |

0 commit comments

Comments
 (0)