-
Notifications
You must be signed in to change notification settings - Fork 89
/
build.bat
100 lines (92 loc) · 3.04 KB
/
build.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
90
91
92
93
94
95
96
97
98
99
100
@echo off
setlocal
if exist .\_project\vs2022\streamline.sln (
rem find VS 2022
for /f "usebackq tokens=1* delims=: " %%i in (`.\tools\vswhere.exe -version [17^,18^) -requires Microsoft.VisualStudio.Workload.NativeDesktop`) do (
if /i "%%i"=="installationPath" (
set VS_PATH=%%j
GOTO :found_vs
)
)
rem Try looking for VS Build Tools 2022
for /f "usebackq tokens=1* delims=: " %%i in (`.\tools\vswhere.exe -products * -version [17^,18^) -requires Microsoft.VisualStudio.Workload.VCTools -requires Microsoft.VisualStudio.Workload.MSBuildTools`) do (
if /i "%%i"=="installationPath" (
set VS_PATH=%%j
GOTO :found_vs
)
)
) else if exist .\_project\vs2019\streamline.sln (
rem find VS 2019
for /f "usebackq tokens=1* delims=: " %%i in (`.\tools\vswhere.exe -version [16^,17^) -requires Microsoft.VisualStudio.Workload.NativeDesktop `) do (
if /i "%%i"=="installationPath" (
set VS_PATH=%%j
GOTO :found_vs
)
)
rem Try looking for VS Build Tools 2019
for /f "usebackq tokens=1* delims=: " %%i in (`.\tools\vswhere.exe -products * -version [16^,17^) -requires Microsoft.VisualStudio.Workload.VCTools -requires Microsoft.VisualStudio.Workload.MSBuildTools`) do (
if /i "%%i"=="installationPath" (
set VS_PATH=%%j
GOTO :found_vs
)
)
) else (
rem find VS 2017
for /f "usebackq tokens=1* delims=: " %%i in (`.\tools\vswhere.exe -version [15^,16^) -requires Microsoft.VisualStudio.Workload.NativeDesktop`) do (
if /i "%%i"=="installationPath" (
set VS_PATH=%%j
GOTO :found_vs
)
)
)
:found_vs
echo off
set cfg=Debug
set bld=Clean,Build
:loop
IF NOT "%1"=="" (
IF "%1"=="-debug" (
SET cfg=Debug
SHIFT
)
IF "%1"=="-develop" (
SET cfg=Develop
SHIFT
)
IF "%1"=="-production" (
SET cfg=Production
SHIFT
)
:: Deprecated build configuration names
IF "%1"=="-release" (
SET cfg=Debug
SHIFT
)
IF "%1"=="-profiling" (
SET cfg=Develop
SHIFT
)
IF "%1"=="-relextdev" (
SET cfg=Develop
SHIFT
)
SHIFT
GOTO :loop
)
if not exist "%VS_PATH%" (
echo "%VS_PATH%" not found. Is Visual Studio installed? && goto :ErrorExit
)
for /f "delims=" %%F in ('dir /b /s "%VS_PATH%\vsdevcmd.bat" 2^>nul') do set VSDEVCMD_PATH=%%F
echo ********Executing %VSDEVCMD_PATH%********
call "%VSDEVCMD_PATH%"
goto :SetVSEnvFinished
:ErrorExit
exit /b 1
:SetVSEnvFinished
if exist .\_project\vs2022\streamline.sln (
msbuild .\_project\vs2022\streamline.sln /m /t:%bld% /property:Configuration=%cfg%
) else if exist .\_project\vs2019\streamline.sln (
msbuild .\_project\vs2019\streamline.sln /m /t:%bld% /property:Configuration=%cfg%
) else (
msbuild .\_project\vs2017\streamline.sln /m /t:%bld% /property:Configuration=%cfg%
)