5 if /i "%1"=="help" goto help
6 if /i "%1"=="--help" goto help
7 if /i "%1"=="-help" goto help
8 if /i "%1"=="/help" goto help
9 if /i "%1"=="?" goto help
10 if /i "%1"=="-?" goto help
11 if /i "%1"=="--?" goto help
12 if /i "%1"=="/?" goto help
14 @rem Process arguments.
23 set library=static_library
26 if "%1"=="" goto args-done
27 if /i "%1"=="debug" set config=Debug&goto arg-ok
28 if /i "%1"=="release" set config=Release&goto arg-ok
29 if /i "%1"=="test" set run=run-tests.exe&goto arg-ok
30 if /i "%1"=="bench" set run=run-benchmarks.exe&goto arg-ok
31 if /i "%1"=="clean" set target=Clean&goto arg-ok
32 if /i "%1"=="noprojgen" set noprojgen=1&goto arg-ok
33 if /i "%1"=="nobuild" set nobuild=1&goto arg-ok
34 if /i "%1"=="x86" set target_arch=ia32&set platform=WIN32&set vs_toolset=x86&goto arg-ok
35 if /i "%1"=="ia32" set target_arch=ia32&set platform=WIN32&set vs_toolset=x86&goto arg-ok
36 if /i "%1"=="x64" set target_arch=x64&set platform=amd64&set vs_toolset=x64&goto arg-ok
37 if /i "%1"=="shared" set library=shared_library&goto arg-ok
38 if /i "%1"=="static" set library=static_library&goto arg-ok
44 @rem Look for Visual Studio 2012
45 if not defined VS110COMNTOOLS goto vc-set-2010
46 if not exist "%VS110COMNTOOLS%\..\..\vc\vcvarsall.bat" goto vc-set-2010
47 call "%VS110COMNTOOLS%\..\..\vc\vcvarsall.bat" %vs_toolset%
48 set GYP_MSVS_VERSION=2012
52 @rem Look for Visual Studio 2010
53 if not defined VS100COMNTOOLS goto vc-set-2008
54 if not exist "%VS100COMNTOOLS%\..\..\vc\vcvarsall.bat" goto vc-set-2008
55 call "%VS100COMNTOOLS%\..\..\vc\vcvarsall.bat" %vs_toolset%
56 set GYP_MSVS_VERSION=2010
60 @rem Look for Visual Studio 2008
61 if not defined VS90COMNTOOLS goto vc-set-notfound
62 if not exist "%VS90COMNTOOLS%\..\..\vc\vcvarsall.bat" goto vc-set-notfound
63 call "%VS90COMNTOOLS%\..\..\vc\vcvarsall.bat" %vs_toolset%
64 set GYP_MSVS_VERSION=2008
68 echo Warning: Visual Studio not found
71 if not "%config%"=="" goto project-gen
72 if "%run%"=="run-tests.exe" set config=Debug& goto project-gen
73 if "%run%"=="run-benchmarks.exe" set config=Release& goto project-gen
77 @rem Skip project generation if requested.
78 if defined noprojgen goto msbuild
80 @rem Generate the VS project.
81 if exist build\gyp goto have_gyp
82 echo git clone https://git.chromium.org/external/gyp.git build/gyp
83 git clone https://git.chromium.org/external/gyp.git build/gyp
84 if errorlevel 1 goto gyp_install_failed
88 echo Failed to download gyp. Make sure you have git installed, or
89 echo manually install gyp into %~dp0build\gyp.
93 if not defined PYTHON set PYTHON="python"
94 %PYTHON% gyp_uv.py -Dtarget_arch=%target_arch% -Dlibrary=%library%
95 if errorlevel 1 goto create-msvs-files-failed
96 if not exist uv.sln goto create-msvs-files-failed
97 echo Project files generated.
100 @rem Skip project generation if requested.
101 if defined nobuild goto run
103 @rem Check if VS build env is available
104 if not defined VCINSTALLDIR goto msbuild-not-found
108 echo Build skipped. To build, this file needs to run from VS cmd prompt.
111 @rem Build the sln with msbuild.
113 msbuild uv.sln /t:%target% /p:Configuration=%config% /p:Platform="%platform%" /clp:NoSummary;NoItemAndPropertyList;Verbosity=minimal /nologo
114 if errorlevel 1 exit /b 1
117 @rem Run tests if requested.
118 if "%run%"=="" goto exit
119 if not exist %config%\%run% goto exit
120 echo running '%config%\%run%'
124 :create-msvs-files-failed
125 echo Failed to create vc project files.
129 echo vcbuild.bat [debug/release] [test/bench] [clean] [noprojgen] [nobuild] [x86/x64] [static/shared]
131 echo vcbuild.bat : builds debug build
132 echo vcbuild.bat test : builds debug build and runs tests
133 echo vcbuild.bat release bench: builds release build and runs benchmarks