• R/O
  • SSH

premake-stable: Commit

A friendly fork of Premake4 used to generate project files for WinDirStat. These patches applied for use in WinDirStat are not necessarily part of the upstream premake-stable. The WDS-build branch is the one used for the accumulated changes from all other branches. Code-signed binaries available.


Commit MetaInfo

Révisiona33e9a24de89e9cab9d05541945edb2374b07832 (tree)
l'heure2019-11-05 06:33:36
AuteurOliver Schneider <oliver@assa...>
CommiterOliver Schneider

Message de Log

"Upstream" changes to setvcvars.cmd

Change Summary

Modification

diff -r 9085e139a6a4 -r a33e9a24de89 setvcvars.cmd
--- a/setvcvars.cmd Thu Oct 31 22:45:08 2019 +0100
+++ b/setvcvars.cmd Mon Nov 04 22:33:36 2019 +0100
@@ -1,5 +1,5 @@
11 @echo off
2-@if not "%OS%"=="Windows_NT" @(echo This script requires Windows NT 4.0 or later to run properly! & goto :EOF)
2+@if not "%OS%"=="Windows_NT" (echo This script requires Windows NT 4.0 or later to run properly! & goto :EOF)
33 ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
44 ::: 2009-2019, Oliver Schneider (assarbad.net) - PUBLIC DOMAIN/CC0
55 ::: Available from: <https://bitbucket.org/assarbad/scripts/>
@@ -29,7 +29,7 @@
2929 :: Marketing name of the Visual Studio versions
3030 set SUPPORTED_NICE=2019 2017 2015 2013 2012 2010 2008 2005 2003 2002
3131 set DEFAULT_TSET=x86
32-if not "%~1" == "" @(
32+if not "%~1" == "" (
3333 if "%~1" == "/?" goto :Help
3434 if "%~1" == "-?" goto :Help
3535 if "%~1" == "/h" goto :Help
@@ -41,11 +41,12 @@
4141 set MIN_VC=7.0
4242 set MAX_VC=16.0
4343 set MIN_NICE=2002
44-reg /? > NUL 2>&1 || echo "REG.EXE is a prerequisite but wasn't found!" && goto :EOF
44+reg /? > NUL 2>&1
45+if not ERRORLEVEL 0 echo "REG.EXE is a prerequisite but wasn't found!" & goto :EOF
4546 set SETVCV_ERROR=0
4647 :: First parameter may point to a particular toolset ...
47-if not "%~1" == "" @(
48- for %%i in (%SUPPORTED_TSET%) do @(
48+if not "%~1" == "" (
49+ for %%i in (%SUPPORTED_TSET%) do (
4950 if "%~1" == "%%i" shift & call :SetVar VCTGT_TOOLSET %%i
5051 )
5152 )
@@ -55,30 +56,45 @@
5556 set SUPPORTED_PP=%SUPPORTED_NICE: =, %
5657 :: Allow the version to be overridden on the command line
5758 :: ... else find the VC versions in the order given by SUPPORTED_VC
58-if not "%~1" == "" @(
59- for %%i in (%~1) do @(
59+if not "%~1" == "" (
60+ for %%i in (%~1) do (
6061 call :FindVC "%%i"
6162 )
62-) else @(
63+) else (
6364 echo Trying to auto-detect supported MSVC version ^(%SUPPORTED_PP%^)
6465 echo HINT: pass one ^(or several^) of %SUPPORTED_PP% on the command line.
6566 echo alternatively one ^(or several^) of: %SUPPORTED_VC%
6667 echo.
67- for %%i in (%SUPPORTED_VC%) do @(
68+ for %%i in (%SUPPORTED_VC%) do (
6869 call :FindVC "%%i"
6970 )
7071 )
7172 :: Check result and quit with error if necessary
72-if not defined VCVARS_PATH @(
73- if not "%~1" == "" @(
73+if not defined VCVARS_PATH (
74+ if not "%~1" == "" (
7475 echo Requested version ^"%~1^" of Visual Studio not found.
75- ) else @(
76+ ) else (
7677 echo Could not find any supported version ^(%SUPPORTED_PP%^) of Visual C++.
7778 )
7879 popd & endlocal & exit /b %SETVCV_ERROR%
7980 )
80-:: Return and make sure the outside world sees the results (i.e. leave the scope)
81-popd & endlocal & if not "%VCVARS_PATH%" == "" @(call "%VCVARS_PATH%" %VCTGT_TOOLSET%) & if not "%VCVER_FRIENDLY%" == "" set VCVER_FRIENDLY=%VCVER_FRIENDLY%
81+set ALLORNOT=%VCVARS_PATH:~-7,3%
82+if "%ALLORNOT%" == "all" set VCTGT_TOOLSET_ARG=%VCTGT_TOOLSET%
83+set WINSDK_TOOLSET=%VCTGT_TOOLSET:~0,5%
84+if "%WINSDK_TOOLSET%" == "amd64" set WINSDK_TOOLSET=x64
85+set WINSDK_TOOLSET=%WINSDK_TOOLSET:~0,3%
86+:: ... make sure the outside world sees the results (i.e. leave the scope)
87+popd & endlocal & if not "%VCVARS_PATH%" == "" @call "%VCVARS_PATH%" %VCTGT_TOOLSET_ARG% & if not "%VCVER_FRIENDLY%" == "" set VCVER_FRIENDLY=%VCVER_FRIENDLY%&set WINSDK_TOOLSET=%WINSDK_TOOLSET%
88+:: ... and make sure the resource compiler (rc.exe) can be used (by default it can't on VS2015)
89+rc.exe /? > NUL 2>&1
90+:: Didn't fail, so nothing for us to fix
91+if not ERRORLEVEL 1 goto :EOF
92+:: We need those to locate rc.exe
93+if not defined WindowsSdkDir goto :EOF
94+if not defined WindowsSDKVersion goto :EOF
95+"%WindowsSdkDir%\bin\%WindowsSDKVersion%%WINSDK_TOOLSET%\rc.exe" > NUL 2>&1
96+if ERRORLEVEL 1 goto :EOF
97+call :SetVar PATH "%PATH%;%WindowsSdkDir%\bin\%WindowsSDKVersion%%WINSDK_TOOLSET%"
8298 goto :EOF
8399
84100 ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
@@ -90,7 +106,7 @@
90106 :FindVC
91107 setlocal ENABLEEXTENSIONS & set VCVER=%~1
92108 :: We're not interested in overwriting an already existing value
93-if defined VCVARS_PATH @( endlocal & goto :EOF )
109+if defined VCVARS_PATH ( endlocal & goto :EOF )
94110 :: Now let's distinguish the "nice" version numbers (2002, ... 2019) from the internal ones
95111 set VCVER=%VCVER:vs=%
96112 :: Not a "real" version number, but the marketing one (2002, ... 2019)?
@@ -101,7 +117,7 @@
101117 set VCVERLBL=%VCVER:.=_%
102118 call :PRETTY_%VCVERLBL% > NUL 2>&1
103119 call :TSET_%VCVERLBL% > NUL 2>&1
104-if not defined NICEVER @( echo ERROR: This script does not know the given version Visual C++ version&endlocal&set SETVCV_ERROR=1&goto :EOF )
120+if not defined NICEVER ( echo ERROR: This script does not know the given version Visual C++ version&endlocal&set SETVCV_ERROR=1&goto :EOF )
105121 :: Jump over those "subs"
106122 goto :NICE_SET
107123 :PRETTY_16_0
@@ -136,12 +152,10 @@
136152 goto :EOF
137153 :NICE_2019
138154 set VCVER=16.0
139- set VSWHERE_RANGE=16.0,17.0
140155 set NEWVS=1
141156 goto :EOF
142157 :NICE_2017
143158 set VCVER=15.0
144- set VSWHERE_RANGE=15.0,16.0
145159 set NEWVS=1
146160 goto :EOF
147161 :NICE_2015
@@ -191,25 +205,24 @@
191205 set _VSWHERE=%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe
192206 "%_VSWHERE%" -? > NUL 2>&1 || set _VSWHERE=vswhere.exe
193207 "%_VSWHERE%" -? > NUL 2>&1 || goto :SKIPVSWHERE
194-::%VSWHERE_RANGE%
195-if not defined _VCINSTALLDIR @(
208+if not defined _VCINSTALLDIR (
196209 for /f "usebackq tokens=*" %%i in (`"%_VSWHERE%" -products * -format value -property installationPath -version %NUMVER%`) do (
197- call :SetVar _VCINSTALLDIR "%%i"
210+ call :SetVar _VCINSTALLDIR "%%i\VC\"
198211 )
199212 )
200213 if defined _VCINSTALLDIR goto :DETECTION_FINISHED
201214 :SKIPVSWHERE
202215 if not "%NICEVER%" == "2017" goto :DETECTION_FINISHED
203216 set _VSINSTALLKEY=HKLM\SOFTWARE\Microsoft\VisualStudio\SxS\VS7
204-if not defined _VCINSTALLDIR @(
205- for /f "tokens=2*" %%i in ('reg query "%_VSINSTALLKEY%" /v %VCVER% 2^> NUL') do @(
217+if not defined _VCINSTALLDIR (
218+ for /f "tokens=2*" %%i in ('reg query "%_VSINSTALLKEY%" /v %VCVER% 2^> NUL') do (
206219 call :SetVar _VCINSTALLDIR "%%j"
207220 )
208221 )
209222 set _VSINSTALLKEY=HKLM\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\SxS\VS7
210223 :: If we haven't found it by now, try the WOW64 "Software" key
211-if not defined _VCINSTALLDIR @(
212- for /f "tokens=2*" %%i in ('reg query "%_VSINSTALLKEY%" /v %VCVER% 2^> NUL') do @(
224+if not defined _VCINSTALLDIR (
225+ for /f "tokens=2*" %%i in ('reg query "%_VSINSTALLKEY%" /v %VCVER% 2^> NUL') do (
213226 call :SetVar _VCINSTALLDIR "%%j"
214227 )
215228 )
@@ -218,42 +231,37 @@
218231 :: echo Old (^<2017) Visual Studio
219232 :: The versions of Visual Studio prior to 2017 were all using this key
220233 set _VSINSTALLKEY=HKLM\SOFTWARE\Microsoft\VisualStudio\%VCVER%\Setup\VC
221-if not defined _VCINSTALLDIR @(
222- for /f "tokens=2*" %%i in ('reg query "%_VSINSTALLKEY%" /v ProductDir 2^> NUL') do @(
234+if not defined _VCINSTALLDIR (
235+ for /f "tokens=2*" %%i in ('reg query "%_VSINSTALLKEY%" /v ProductDir 2^> NUL') do (
223236 call :SetVar _VCINSTALLDIR "%%j"
224237 )
225238 )
226239 set _VSINSTALLKEY=HKLM\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\%VCVER%\Setup\VC
227240 :: If we haven't found it by now, try the WOW64 "Software" key
228-if not defined _VCINSTALLDIR @(
229- for /f "tokens=2*" %%i in ('reg query "%_VSINSTALLKEY%" /v ProductDir 2^> NUL') do @(
241+if not defined _VCINSTALLDIR (
242+ for /f "tokens=2*" %%i in ('reg query "%_VSINSTALLKEY%" /v ProductDir 2^> NUL') do (
230243 call :SetVar _VCINSTALLDIR "%%j"
231244 )
232245 )
233246 :DETECTION_FINISHED
234-set TEMP_TOOLSET=%VCTGT_TOOLSET%
235247 set TEMP_SUPPORTED=
236-if defined _VCINSTALLDIR @(
237- if EXIST "%_VCINSTALLDIR%\VC\Auxiliary\Build\vcvarsall.bat" @(
238- call :SetVar VCVARS_PATH "%_VCINSTALLDIR%\VC\Auxiliary\Build\vcvarsall.bat"
239- )
240- if EXIST "%_VCINSTALLDIR%\vcvarsall.bat" @(
241- call :SetVar VCVARS_PATH "%_VCINSTALLDIR%\vcvarsall.bat"
242- )
243- if not defined VCVARS_PATH if EXIST "%_VCINSTALLDIR%\bin\vcvars32.bat" @(
244- call :SetVar VCVARS_PATH "%_VCINSTALLDIR%\bin\vcvars32.bat"
245- call :SetVar VCTGT_TOOLSET
246- )
248+echo _VCINSTALLDIR=%_VCINSTALLDIR%
249+if not defined _VCINSTALLDIR goto :SKIP_VCVARS
250+if "%VCTGT_TOOLSET%" == "x86" set BATCHNAME=vcvars32.bat
251+if "%VCTGT_TOOLSET%" == "amd64" set BATCHNAME=vcvars64.bat
252+if not defined BATCHNAME set BATCHNAME=vcvars%VCTGT_TOOLSET%.bat
253+for %%i in (Auxiliary\Build\%BATCHNAME% bin\%VCTGT_TOOLSET%\%BATCHNAME% bin\%BATCHNAME% Auxiliary\Build\vcvarsall.bat vcvarsall.bat) do (
254+ call :FindVCVarsScript "%_VCINSTALLDIR%" "%%i" "%VCTGT_TOOLSET%"
247255 )
248-if not "%VCTGT_TOOLSET%" == "" @(
249- for %%i in (%SUPPORTED_TSET%) do @(
256+:SKIP_VCVARS
257+if not "%VCTGT_TOOLSET%" == "" (
258+ for %%i in (%SUPPORTED_TSET%) do (
250259 if "%VCTGT_TOOLSET%" == "%%i" call :SetVar TEMP_SUPPORTED yes
251260 )
252261 )
253-if not "%TEMP_SUPPORTED%" == "yes" @( echo ERROR: Invalid toolset %TEMP_TOOLSET% for version %VCVER% of Visual C++&endlocal&set SETVCV_ERROR=2&goto :EOF )
254-set VCTGT_TOOLSET=%TEMP_TOOLSET%
262+if not "%TEMP_SUPPORTED%" == "yes" ( echo ERROR: Invalid toolset %TEMP_TOOLSET% for version %VCVER% of Visual C++&endlocal&set SETVCV_ERROR=2&goto :EOF )
255263 :: Return, in case nothing was found
256-if not defined VCVARS_PATH @( endlocal&set SETVCV_ERROR=3&goto :EOF )
264+if not defined VCVARS_PATH ( endlocal&set SETVCV_ERROR=3&goto :EOF )
257265 :: Replace the . in the version by an underscore
258266 set VCVERLBL=%VCVER:.=_%
259267 :: Try to set a friendlier name for the Visual Studio version
@@ -335,3 +343,29 @@
335343 ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
336344 ::: \ SetVar subroutine
337345 ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
346+
347+::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
348+::: / FindVCVarsScript subroutine
349+::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
350+:FindVCVarsScript
351+setlocal ENABLEEXTENSIONS
352+:: Do not overwrite any pre-existing path
353+if defined VCVARS_PATH endlocal&goto :EOF
354+set VCINSTALLDIR=%~1
355+set VCVARSGUESS=%~2
356+set VCTGT_TOOLSET=%~3
357+set VCVARS_CURRENT_GUESS=%VCINSTALLDIR%%VCVARSGUESS%
358+:: Use the guess passed as second argument, after building a path based on VCINSTALLDIR
359+if EXIST "%VCVARS_CURRENT_GUESS%" set VCVARS_PATH=%VCVARS_CURRENT_GUESS%
360+if defined VCVARS_PATH goto :VCVarsFound
361+:: Just in case the install directory path contains no trailing backslash
362+set VCVARS_CURRENT_GUESS=%VCINSTALLDIR%\%VCVARSGUESS%
363+if EXIST "%VCVARS_CURRENT_GUESS%" set VCVARS_PATH=%VCVARS_CURRENT_GUESS%
364+if defined VCVARS_PATH goto :VCVarsFound
365+endlocal & goto :EOF
366+:VCVarsFound
367+endlocal & set VCVARS_PATH=%VCVARS_PATH%
368+goto :EOF
369+::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
370+::: \ FindVCVarsScript subroutine
371+::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Afficher sur ancien navigateur de dépôt.