blob: 874ba2bbeedf1a06c4511c8e801f212eb3444e84 [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
9set doCompile=N
10set doBuild=N
11
12set SCRIPTNAME=%~nx0
13
14if "%1"=="compile" (
15 set doCompile=Y
16) else if "%1"=="build" (
17 set doBuild=Y
18) else (
19 goto Usage
20)
21
22set arch=N
23
24shift
25:ParseArgs
26if "%1" == "" goto FinishedArgs
27if /I "%1"=="x86" (
28 set arch=x86
29) else if /I "%1"=="x64" (
30 set arch=x64
31) else (
32 goto Usage
33)
34shift
35goto ParseArgs
36
37:FinishedArgs
38if "%arch%"=="x86" (
39 set MSBUILD_ARGS=/nologo /p:useenv=true /p:Platform=Win32 /maxcpucount:%NUMBER_OF_PROCESSORS%
40) else if "%arch%"=="x64" (
41 set MSBUILD_ARGS=/nologo /p:useenv=true /p:Platform=x64 /maxcpucount:%NUMBER_OF_PROCESSORS%
42)
43
44@setlocal
45
46set VSInstallerFolder="%ProgramFiles(x86)%\Microsoft Visual Studio\Installer"
47if %PROCESSOR_ARCHITECTURE%==x86 set VSInstallerFolder="%ProgramFiles%\Microsoft Visual Studio\Installer"
48
49pushd %VSInstallerFolder%
50for /f "usebackq tokens=*" %%i in (`vswhere -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath`) do (
51 set VSLATESTDIR=%%i
52)
53popd
54
55echo VS Installation folder: %VSLATESTDIR%
56
57if not exist "%VSLATESTDIR%\VC\Auxiliary\Build\vcvarsall.bat" (
58 echo:
59 echo VSInstallDir not found or not installed correctly.
60 goto cleanup
61)
62
63if %PROCESSOR_ARCHITECTURE%==x86 (
64 set Comp_x86=x86 10.0.15063.0
65 set Comp_x64=x86_amd64 10.0.15063.0
66) else (
67 set Comp_x86=amd64_x86 10.0.15063.0
68 set Comp_x64=amd64 10.0.15063.0
69)
70
71set path=%path:"=%
72if "%arch%"=="x86" (
73 call "%VSLATESTDIR%"\\VC\\Auxiliary\\Build\\vcvarsall.bat %Comp_x86%
74) else if "%arch%"=="x64" (
75 call "%VSLATESTDIR%"\\VC\\Auxiliary\\Build\\vcvarsall.bat %Comp_x64%
76)
77
78if "%arch%" neq "N" (
79 if "%doCompile%" neq "N" (
80 goto compileClient
81 ) else if "%doBuild%" neq "N" (
82 goto buildClient
83 )
84 goto :eof
85)
86goto Usage
87
88:compileClient
89msbuild ring-client-windows.vcxproj /verbosity:normal /p:Configuration=ReleaseCompile %MSBUILD_ARGS%
90goto cleanup
91
92:buildClient
93msbuild ring-client-windows.vcxproj /verbosity:normal /p:Configuration=Release %MSBUILD_ARGS%
94goto cleanup
95
96@endlocal
97
98:Usage
99echo:
100echo The correct usage is:
101echo:
102echo %0 [action] [architecture]
103echo:
104echo where
105echo:
106echo [action] is: compile ^| build
107echo [architecture] is: x86 ^| x64
108echo:
109echo For example:
110echo %0 compile x86 - compile only x86 (for CI)
111echo %0 build x64 - build x64 client
112echo:
113goto :eof
114
115:cleanup
116endlocal
117exit /B %ERRORLEVEL%