blob: 6b293ae895f33ba54e7ebd1b3268893a8d0fa07a [file] [log] [blame]
Andreas Traczyk43c08232018-10-31 13:42:09 -04001:: Ring - native Windows client project build script
2
3@echo off
4setlocal
5
6if "%1" == "/?" goto Usage
7if "%~1" == "" goto Usage
8
Andreas Traczyke303bc62018-12-05 11:06:31 -05009set doDeps=N
Andreas Traczyk43c08232018-10-31 13:42:09 -040010set doCompile=N
11set doBuild=N
12
13set SCRIPTNAME=%~nx0
14
15if "%1"=="compile" (
16 set doCompile=Y
17) else if "%1"=="build" (
18 set doBuild=Y
Andreas Traczyke303bc62018-12-05 11:06:31 -050019) else if "%1"=="deps" (
20 set doDeps=Y
Andreas Traczyk43c08232018-10-31 13:42:09 -040021) else (
22 goto Usage
23)
24
25set arch=N
26
27shift
28:ParseArgs
29if "%1" == "" goto FinishedArgs
30if /I "%1"=="x86" (
31 set arch=x86
32) else if /I "%1"=="x64" (
33 set arch=x64
34) else (
35 goto Usage
36)
37shift
38goto ParseArgs
39
40:FinishedArgs
41if "%arch%"=="x86" (
42 set MSBUILD_ARGS=/nologo /p:useenv=true /p:Platform=Win32 /maxcpucount:%NUMBER_OF_PROCESSORS%
43) else if "%arch%"=="x64" (
44 set MSBUILD_ARGS=/nologo /p:useenv=true /p:Platform=x64 /maxcpucount:%NUMBER_OF_PROCESSORS%
45)
46
47@setlocal
48
49set VSInstallerFolder="%ProgramFiles(x86)%\Microsoft Visual Studio\Installer"
50if %PROCESSOR_ARCHITECTURE%==x86 set VSInstallerFolder="%ProgramFiles%\Microsoft Visual Studio\Installer"
51
52pushd %VSInstallerFolder%
53for /f "usebackq tokens=*" %%i in (`vswhere -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath`) do (
54 set VSLATESTDIR=%%i
55)
56popd
57
58echo VS Installation folder: %VSLATESTDIR%
59
60if not exist "%VSLATESTDIR%\VC\Auxiliary\Build\vcvarsall.bat" (
61 echo:
62 echo VSInstallDir not found or not installed correctly.
63 goto cleanup
64)
65
66if %PROCESSOR_ARCHITECTURE%==x86 (
67 set Comp_x86=x86 10.0.15063.0
68 set Comp_x64=x86_amd64 10.0.15063.0
69) else (
70 set Comp_x86=amd64_x86 10.0.15063.0
71 set Comp_x64=amd64 10.0.15063.0
72)
73
74set path=%path:"=%
75if "%arch%"=="x86" (
76 call "%VSLATESTDIR%"\\VC\\Auxiliary\\Build\\vcvarsall.bat %Comp_x86%
77) else if "%arch%"=="x64" (
78 call "%VSLATESTDIR%"\\VC\\Auxiliary\\Build\\vcvarsall.bat %Comp_x64%
79)
80
81if "%arch%" neq "N" (
82 if "%doCompile%" neq "N" (
83 goto compileClient
84 ) else if "%doBuild%" neq "N" (
85 goto buildClient
Andreas Traczyke303bc62018-12-05 11:06:31 -050086 ) else if "%doDeps%" neq "N" (
87 goto buildDeps
Andreas Traczyk43c08232018-10-31 13:42:09 -040088 )
89 goto :eof
90)
91goto Usage
92
Andreas Traczyke303bc62018-12-05 11:06:31 -050093:buildDeps
94set TOBUILD=qrencode-win32\qrencode-win32\vc8\qrcodelib\qrcodelib.vcxproj
95msbuild %TOBUILD% /verbosity:normal /p:Configuration=Release-Lib %MSBUILD_ARGS%
96set TOBUILD=winsparkle\WinSparkle-2015.sln
97set WGET_CMD=wget --no-check-certificate --retry-connrefused --waitretry=1 --read-timeout=20 --timeout=15 --tries=4
98%WGET_CMD% https://dist.nuget.org/win-x86-commandline/latest/nuget.exe
99nuget restore %TOBUILD%
100msbuild %TOBUILD% /verbosity:normal /p:Configuration=Release %MSBUILD_ARGS%
101goto cleanup
102
Andreas Traczyk43c08232018-10-31 13:42:09 -0400103:compileClient
104msbuild ring-client-windows.vcxproj /verbosity:normal /p:Configuration=ReleaseCompile %MSBUILD_ARGS%
105goto cleanup
106
107:buildClient
108msbuild ring-client-windows.vcxproj /verbosity:normal /p:Configuration=Release %MSBUILD_ARGS%
109goto cleanup
110
111@endlocal
112
113:Usage
114echo:
115echo The correct usage is:
116echo:
117echo %0 [action] [architecture]
118echo:
119echo where
120echo:
121echo [action] is: compile ^| build
122echo [architecture] is: x86 ^| x64
123echo:
124echo For example:
125echo %0 compile x86 - compile only x86 (for CI)
126echo %0 build x64 - build x64 client
127echo:
128goto :eof
129
130:cleanup
131endlocal
132exit /B %ERRORLEVEL%