Merge remote branch 'origin/v0.4'
[platform/upstream/nodejs.git] / vcbuild.bat
1 @echo off
2
3 cd %~dp0
4
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
13
14 @rem Bail out early if not running in VS build env.
15 if not defined VCINSTALLDIR goto msbuild-not-found
16
17 @rem Process arguments.
18 set config=Debug
19 set target=Build
20 set noprojgen=
21
22 :next-arg
23 if "%1"=="" goto args-done
24 if /i "%1"=="debug"        set config=Debug&goto arg-ok
25 if /i "%1"=="release"      set config=Release&goto arg-ok
26 if /i "%1"=="clean"        set target=Clean&goto arg-ok
27 if /i "%1"=="noprojgen"    set noprojgen=1&goto arg-ok
28 :arg-ok
29 shift
30 goto next-arg
31 :args-done
32
33
34 @rem Skip project generation if requested.
35 if defined noprojgen goto msbuild
36
37 :project-gen
38 @rem Generate the VS project.
39 call generate-projects.bat
40 if errorlevel 1 goto create-msvs-files-failed
41 if not exist node.sln goto create-msvs-files-failed
42
43 :msbuild
44 @rem Build the sln with msbuild.
45 msbuild node.sln /t:%target% /p:Configuration=%config% /clp:NoSummary;NoItemAndPropertyList;Verbosity=minimal /nologo
46 if errorlevel 1 goto exit
47 goto exit
48
49 :create-msvs-files-failed
50 echo Failed to create vc project files. 
51 goto exit
52
53 :msbuild-not-found
54 echo Failed to build.  In order to build the solution this file needs
55 echo to run from VS command script.
56 goto exit
57
58 :help
59 echo This script must run from VS command prompt.
60 echo vcbuild.bat [debug/release] [clean] [noprojgen]
61 echo Examples:
62 echo   vcbuild.bat              : builds debug build
63 echo   vcbuild.bat release bench: builds release build
64 goto exit
65
66 :exit