Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/windirstat/premake-4.x-stable.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOliver Schneider <oliver@assarbad.net>2022-01-23 03:21:28 +0300
committerOliver Schneider <oliver@assarbad.net>2022-01-23 03:21:28 +0300
commit2d36609e8ab587519f30e7adfeae85801815a154 (patch)
tree35ec9d06ec077e6bf718457f2047ce2d1496e02d /setvcvars.cmd
parentd49d821dc0340c412e1d0f9fd02cd82ffd3613f4 (diff)
Arranging for VS2022 support
--HG-- branch : WDS-build
Diffstat (limited to 'setvcvars.cmd')
-rw-r--r--setvcvars.cmd48
1 files changed, 40 insertions, 8 deletions
diff --git a/setvcvars.cmd b/setvcvars.cmd
index 97c55fd..8eddda1 100644
--- a/setvcvars.cmd
+++ b/setvcvars.cmd
@@ -2,11 +2,11 @@
@if not "%OS%"=="Windows_NT" (echo This script requires Windows NT 4.0 or later to run properly! & goto :EOF)
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::: 2009-2019, Oliver Schneider (assarbad.net) - PUBLIC DOMAIN/CC0
-::: Available from: <https://bitbucket.org/assarbad/scripts/>
+::: Available from Git mirror: <https://github.com/assarbad/scripts>
:::
::: PURPOSE: This script can be used to run the vcvars32.bat/vcvarsall.bat
::: from any of the existing Visual C++ versions starting with .NET
-::: (2002) through 2019 or versions (or a single version) given on
+::: (2002) through 2022 or versions (or a single version) given on
::: the command line.
::: The script will try to find the newest installed VC version by
::: iterating over the space-separated (descending) list of versions
@@ -25,9 +25,29 @@ setlocal & pushd .
:: Toolsets (potentially) supported
set SUPPORTED_TSET=amd64 x86 ia64 x86_ia64 x86_amd64 amd64_x86 x86_arm amd64_arm
:: Internal representation of the version number
-set SUPPORTED_VC=16.0 15.0 14.0 12.0 11.0 10.0 9.0 8.0 7.1 7.0
+set SUPPORTED_VC=17.0 ^
+16.0 ^
+15.0 ^
+14.0 ^
+12.0 ^
+11.0 ^
+10.0 ^
+9.0 ^
+8.0 ^
+7.1 ^
+7.0
:: Marketing name of the Visual Studio versions
-set SUPPORTED_NICE=2019 2017 2015 2013 2012 2010 2008 2005 2003 2002
+set SUPPORTED_NICE=2022 ^
+2019 ^
+2017 ^
+2015 ^
+2013 ^
+2012 ^
+2010 ^
+2008 ^
+2005 ^
+2003 ^
+2002
set DEFAULT_TSET=x86
if not "%~1" == "" (
if "%~1" == "/?" goto :Help
@@ -107,9 +127,9 @@ goto :EOF
setlocal ENABLEEXTENSIONS & set VCVER=%~1
:: We're not interested in overwriting an already existing value
if defined VCVARS_PATH ( endlocal & goto :EOF )
-:: Now let's distinguish the "nice" version numbers (2002, ... 2019) from the internal ones
+:: Now let's distinguish the "nice" version numbers (2002, ... 2022) from the internal ones
set VCVER=%VCVER:vs=%
-:: Not a "real" version number, but the marketing one (2002, ... 2019)?
+:: Not a "real" version number, but the marketing one (2002, ... 2022)?
if %VCVER% GEQ %MIN_NICE% call :NICE_%VCVER% > NUL 2>&1
set NUMVER=%VCVER:.0=%
set NUMVER=%NUMVER:.1=%
@@ -120,6 +140,9 @@ call :TSET_%VCVERLBL% > NUL 2>&1
if not defined NICEVER ( echo ERROR: This script does not know the given version Visual C++ version&endlocal&set SETVCV_ERROR=1&goto :EOF )
:: Jump over those "subs"
goto :NICE_SET
+:PRETTY_17_0
+ set NICEVER=2022
+ goto :EOF
:PRETTY_16_0
set NICEVER=2019
goto :EOF
@@ -150,6 +173,10 @@ goto :NICE_SET
:PRETTY_7_0
set NICEVER=2002
goto :EOF
+:NICE_2022
+ set VCVER=17.0
+ set NEWVS=1
+ goto :EOF
:NICE_2019
set VCVER=16.0
set NEWVS=1
@@ -200,13 +227,18 @@ goto :NICE_SET
echo Trying to locate Visual C++ %NICEVER% ^(= %VCVER%, %VCTGT_TOOLSET%^)
:: Is it a version below 15? Then we use the old registry keys
if %NUMVER% LSS 15 goto :OLDVS
+set /a NUMVERNEXT=%NUMVER%+1
echo Modern (^>=2017) Visual Studio
:: This is where we intend to find the installation path in the registry
-set _VSWHERE=%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe
+set _VSWHERE_PATH=%ProgramFiles(x86)%\Microsoft Visual Studio\Installer
+set _VSWHERE=%_VSWHERE_PATH%\vswhere.exe
"%_VSWHERE%" -? > NUL 2>&1 || set _VSWHERE=vswhere.exe
"%_VSWHERE%" -? > NUL 2>&1 || goto :SKIPVSWHERE
+set PATH=%_VSWHERE_PATH%;%PATH%
+::@echo Trying to call vswhere.exe from ^(%_VSWHERE_PATH%^) with:
+@echo Running: vswhere -products * -format value -property installationPath -version ^"^[%NUMVER%.0,%NUMVERNEXT%.0^)^"
if not defined _VCINSTALLDIR (
- for /f "usebackq tokens=*" %%i in (`"%_VSWHERE%" -products * -format value -property installationPath -version %NUMVER%`) do (
+ for /f "usebackq tokens=*" %%i in (`vswhere -products * -format value -property installationPath -version "[%NUMVER%.0,%NUMVERNEXT%.0)"`) do (
call :SetVar _VCINSTALLDIR "%%i\VC\"
)
)