summaryrefslogtreecommitdiff
path: root/vcbuild.bat
blob: 2465626add0bcde657d64f207d17b5d4ac54604b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
@echo off

cd %~dp0

if /i "%1"=="help" goto help
if /i "%1"=="--help" goto help
if /i "%1"=="-help" goto help
if /i "%1"=="/help" goto help
if /i "%1"=="?" goto help
if /i "%1"=="-?" goto help
if /i "%1"=="--?" goto help
if /i "%1"=="/?" goto help

@rem Bail out early if not running in VS build env.
if not defined VCINSTALLDIR goto msbuild-not-found

@rem Process arguments.
set config=Debug
set target=Build
set noprojgen=

:next-arg
if "%1"=="" goto args-done
if /i "%1"=="debug"        set config=Debug&goto arg-ok
if /i "%1"=="release"      set config=Release&goto arg-ok
if /i "%1"=="clean"        set target=Clean&goto arg-ok
if /i "%1"=="noprojgen"    set noprojgen=1&goto arg-ok
:arg-ok
shift
goto next-arg
:args-done


@rem Skip project generation if requested.
if defined noprojgen goto msbuild

:project-gen
@rem Generate the VS project.
call generate-projects.bat
if errorlevel 1 goto create-msvs-files-failed
if not exist node.sln goto create-msvs-files-failed

:msbuild
@rem Build the sln with msbuild.
msbuild node.sln /t:%target% /p:Configuration=%config% /clp:NoSummary;NoItemAndPropertyList;Verbosity=minimal /nologo
if errorlevel 1 goto exit
goto exit

:create-msvs-files-failed
echo Failed to create vc project files. 
goto exit

:msbuild-not-found
echo Failed to build.  In order to build the solution this file needs
echo to run from VS command script.
goto exit

:help
echo This script must run from VS command prompt.
echo vcbuild.bat [debug/release] [clean] [noprojgen]
echo Examples:
echo   vcbuild.bat              : builds debug build
echo   vcbuild.bat release bench: builds release build
goto exit

:exit