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 Process arguments.
15 set config=Debug
16 set target=Build
17 set noprojgen=
18 set nobuild=
19 set test=
20 set test_args=
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 if /i "%1"=="nobuild"      set nobuild=1&goto arg-ok
29 if /i "%1"=="test-uv"      set test=test-uv&goto arg-ok
30 if /i "%1"=="test-internet"set test=test-internet&goto arg-ok
31 if /i "%1"=="test-pummel"  set test=test-pummel&goto arg-ok
32 if /i "%1"=="test-simple"  set test=test-simple&goto arg-ok
33 if /i "%1"=="test-message" set test=test-message&goto arg-ok
34 if /i "%1"=="test-all"     set test=test-all&goto arg-ok
35 if /i "%1"=="test"         set test=test&goto arg-ok
36 :arg-ok
37 shift
38 goto next-arg
39 :args-done
40
41
42 :project-gen
43 @rem Skip project generation if requested.
44 if defined noprojgen goto msbuild
45
46 @rem Generate the VS project.
47 python tools\gyp_node -f msvs -G msvs_version=2010
48 if errorlevel 1 goto create-msvs-files-failed
49 if not exist node.sln goto create-msvs-files-failed
50 echo Project files generated.
51
52 :msbuild
53 @rem Skip project generation if requested.
54 if defined nobuild goto run
55
56 @rem Bail out early if not running in VS build env.
57 if defined VCINSTALLDIR goto msbuild-found
58 if not defined VS100COMNTOOLS goto msbuild-not-found
59 if not exist "%VS100COMNTOOLS%\..\..\vc\vcvarsall.bat" goto msbuild-not-found
60 call "%VS100COMNTOOLS%\..\..\vc\vcvarsall.bat"
61 if not defined VCINSTALLDIR goto msbuild-not-found
62 goto msbuild-found
63
64 :msbuild-not-found
65 echo Build skipped. To build, this file needs to run from VS cmd prompt.
66 goto run
67
68 :msbuild-found
69 @rem Build the sln with msbuild.
70 msbuild node.sln /t:%target% /p:Configuration=%config% /clp:NoSummary;NoItemAndPropertyList;Verbosity=minimal /nologo
71 if errorlevel 1 goto exit
72
73 :run
74 @rem Run tests if requested.
75 if "%test%"=="" goto exit
76
77 if "%config%"=="Debug" set test_args=--mode=debug
78 if "%config%"=="Release" set test_args=--mode=release
79
80 if "%test%"=="test" set test_args=%test_args% simple message
81 if "%test%"=="test-uv" set test_args=%test_args% --libuv simple
82 if "%test%"=="test-internet" set test_args=%test_args% internet
83 if "%test%"=="test-pummel" set test_args=%test_args% pummel
84 if "%test%"=="test-simple" set test_args=%test_args% simple
85 if "%test%"=="test-message" set test_args=%test_args% message
86 if "%test%"=="test-all" set test_args=%test_args%
87
88 echo running 'python tools/test.py %test_args%'
89 python tools/test.py %test_args%
90 goto exit
91
92 :create-msvs-files-failed
93 echo Failed to create vc project files. 
94 goto exit
95
96 :help
97 echo vcbuild.bat [debug/release] [test-all/test-uv/test-internet/test-pummel/test-simple/test-message] [clean] [noprojgen] [nobuild]
98 echo Examples:
99 echo   vcbuild.bat                : builds debug build
100 echo   vcbuild.bat test           : builds debug build and runs tests
101 echo   vcbuild.bat release test-uv: builds release build and runs --libuv tests
102 goto exit
103
104 :exit