forked from vadosnaprimer/assrender
-
Notifications
You must be signed in to change notification settings - Fork 3
/
assrender_with_latest_sdk.bat
59 lines (48 loc) · 1.71 KB
/
assrender_with_latest_sdk.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
@ECHO OFF
SET PROJECT=assrender
@REM Detect the newest available Windows SDK
CALL :GetWindowsSdkVer
@REM Open the project
%PROJECT%.sln
EXIT /B 0
:GetWindowsSdkVer
SET WindowsTargetPlatformVersion=
IF "%WindowsTargetPlatformVersion%"=="" CALL :GetWin10SdkVer
IF "%WindowsTargetPlatformVersion%"=="" CALL :GetWin81SdkVer
EXIT /B 0
:GetWin10SdkVer
CALL :GetWin10SdkVerHelper HKLM\SOFTWARE\Wow6432Node > nul 2>&1
IF errorlevel 1 CALL :GetWin10SdkVerHelper HKCU\SOFTWARE\Wow6432Node > nul 2>&1
IF errorlevel 1 CALL :GetWin10SdkVerHelper HKLM\SOFTWARE > nul 2>&1
IF errorlevel 1 CALL :GetWin10SdkVerHelper HKCU\SOFTWARE > nul 2>&1
IF errorlevel 1 EXIT /B 1
EXIT /B 0
:GetWin10SdkVerHelper
@REM Get Windows 10 SDK installed folder
FOR /F "tokens=1,2*" %%i IN ('reg query "%1\Microsoft\Microsoft SDKs\Windows\v10.0" /v "InstallationFolder"') DO (
IF "%%i"=="InstallationFolder" (
SET WindowsSdkDir=%%~k
)
)
@REM get windows 10 sdk version number
SETLOCAL enableDelayedExpansion
IF NOT "%WindowsSdkDir%"=="" FOR /f %%i IN ('dir "%WindowsSdkDir%include\" /b /ad-h /on') DO (
@REM Skip if Windows.h is not found in %%i\um. This would indicate that only the UCRT MSIs were
@REM installed for this Windows SDK version.
IF EXIST "%WindowsSdkDir%include\%%i\um\Windows.h" (
SET result=%%i
IF "!result:~0,3!"=="10." (
SET SDK=!result!
IF "!result!"=="%VSCMD_ARG_WINSDK%" SET findSDK=1
)
)
)
IF "%findSDK%"=="1" SET SDK=%VSCMD_ARG_WINSDK%
ENDLOCAL & SET WindowsTargetPlatformVersion=%SDK%
IF "%WindowsTargetPlatformVersion%"=="" (
EXIT /B 1
)
EXIT /B 0
:GetWin81SdkVer
SET WindowsTargetPlatformVersion=8.1
EXIT /B 0