-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstall_vs_llvm_toolset.bat
89 lines (76 loc) · 3.23 KB
/
install_vs_llvm_toolset.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
@ECHO OFF
SETLOCAL EnableExtensions EnableDelayedExpansion
SET "EXIT_ON_ERROR=%~1"
SET SUCCESS=0
PUSHD %~dp0
SET VSWHERE=%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe
@rem Visual Studio 2017
FOR /f "delims=" %%A IN ('"%VSWHERE%" -property installationPath -prerelease -version [15.0^,16.0^)') DO (
SET VCT_PATH=%%A\Common7\IDE\VC\VCTargets\Platforms
IF EXIST "!VCT_PATH!" CALL :SUB_VS2017 "!VCT_PATH!"
)
@rem Visual Studio 2017 Build Tools
FOR /f "delims=" %%A IN ('"%VSWHERE%" -products Microsoft.VisualStudio.Product.BuildTools -property installationPath -prerelease -version [15.0^,16.0^)') DO (
SET VCT_PATH=%%A\Common7\IDE\VC\VCTargets\Platforms
IF EXIST "!VCT_PATH!" CALL :SUB_VS2017 "!VCT_PATH!"
)
@rem Visual Studio 2019, 2022
FOR /f "delims=" %%A IN ('"%VSWHERE%" -property installationPath -prerelease -version [16.0^,18.0^)') DO (
@rem Visual C++ 2022 v143 toolset
SET VCT_PATH=%%A\MSBuild\Microsoft\VC\v170\Platforms
IF EXIST "!VCT_PATH!" CALL :SUB_VS2022 "!VCT_PATH!"
@rem Visual C++ 2019 v142 toolset
SET VCT_PATH=%%A\MSBuild\Microsoft\VC\v160\Platforms
IF EXIST "!VCT_PATH!" CALL :SUB_VS2019 "!VCT_PATH!"
@rem Visual C++ 2017 v141 toolset
SET VCT_PATH=%%A\MSBuild\Microsoft\VC\v150\Platforms
IF EXIST "!VCT_PATH!" CALL :SUB_VS2017 "!VCT_PATH!"
)
@rem Visual Studio 2019, 2022 Build Tools
FOR /f "delims=" %%A IN ('"%VSWHERE%" -products Microsoft.VisualStudio.Product.BuildTools -property installationPath -prerelease -version [16.0^,18.0^)') DO (
@rem Visual C++ 2022 v143 toolset
SET VCT_PATH=%%A\MSBuild\Microsoft\VC\v170\Platforms
IF EXIST "!VCT_PATH!" CALL :SUB_VS2022 "!VCT_PATH!"
@rem Visual C++ 2019 v142 toolset
SET VCT_PATH=%%A\MSBuild\Microsoft\VC\v160\Platforms
IF EXIST "!VCT_PATH!" CALL :SUB_VS2019 "!VCT_PATH!"
@rem Visual C++ 2017 v141 toolset
SET VCT_PATH=%%A\MSBuild\Microsoft\VC\v150\Platforms
IF EXIST "!VCT_PATH!" CALL :SUB_VS2017 "!VCT_PATH!"
)
IF %SUCCESS% == 0 (
ECHO Visual C++ 2017, 2019 or 2022 NOT Installed.
IF "%EXIT_ON_ERROR%" == "" PAUSE
)
POPD
ENDLOCAL
EXIT /B
:SUB_VS2017
ECHO VCTargetsPath for Visual Studio 2017: %~1
XCOPY /Q /Y "LLVM" "%~1\..\LLVM\"
XCOPY /Q /Y "LLVM_v141" "%~1\x64\PlatformToolsets\LLVM_v141\"
XCOPY /Q /Y "LLVM_v141" "%~1\Win32\PlatformToolsets\LLVM_v141\"
XCOPY /Q /Y "LLVM_v141" "%~1\ARM64\PlatformToolsets\LLVM_v141\"
XCOPY /Q /Y "LLVM_v141" "%~1\ARM\PlatformToolsets\LLVM_v141\"
XCOPY /Q /Y "LLVM_v141_xp" "%~1\Win32\PlatformToolsets\LLVM_v141_xp\"
XCOPY /Q /Y "LLVM_v141_xp" "%~1\x64\PlatformToolsets\LLVM_v141_xp\"
SET SUCCESS=1
EXIT /B
:SUB_VS2019
ECHO VCTargetsPath for Visual Studio 2019: %~1
XCOPY /Q /Y "LLVM" "%~1\..\LLVM\"
XCOPY /Q /Y "LLVM_v142" "%~1\x64\PlatformToolsets\LLVM_v142\"
XCOPY /Q /Y "LLVM_v142" "%~1\Win32\PlatformToolsets\LLVM_v142\"
XCOPY /Q /Y "LLVM_v142" "%~1\ARM64\PlatformToolsets\LLVM_v142\"
XCOPY /Q /Y "LLVM_v142" "%~1\ARM\PlatformToolsets\LLVM_v142\"
SET SUCCESS=1
EXIT /B
:SUB_VS2022
ECHO VCTargetsPath for Visual Studio 2022: %~1
XCOPY /Q /Y "LLVM" "%~1\..\LLVM\"
XCOPY /Q /Y "LLVM_v143" "%~1\x64\PlatformToolsets\LLVM_v143\"
XCOPY /Q /Y "LLVM_v143" "%~1\Win32\PlatformToolsets\LLVM_v143\"
XCOPY /Q /Y "LLVM_v143" "%~1\ARM64\PlatformToolsets\LLVM_v143\"
XCOPY /Q /Y "LLVM_v143" "%~1\ARM\PlatformToolsets\LLVM_v143\"
SET SUCCESS=1
EXIT /B