forked from rprichard/winpty
-
Notifications
You must be signed in to change notification settings - Fork 1
/
vcbuild.bat
executable file
·83 lines (72 loc) · 2.29 KB
/
vcbuild.bat
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
@echo off
REM -- Script requirements:
REM --
REM -- * git This program must be in the Path to check out
REM -- build-gyp. If that directory already exists, then
REM -- git isn't necessary, but if it is missing, no
REM -- commit hash will be embedded into binaries.
REM --
REM -- * python A non-Cygwin Python 2 python.exe must be in the
REM -- Path to run gyp.
REM --
REM -- * msbuild msbuild must be in the Path. It is probably
REM -- important to have msbuild from the correct MSVC
REM -- release.
REM --
REM -- The script's output binaries are in the src/Release/{Win32,x64}
REM -- directory.
REM -------------------------------------------------------------------------
REM -- Parse arguments
setlocal
cd %~dp0
set GYP_ARGS=
set MSVC_PLATFORM=x64
:ParamLoop
if "%1" == "" goto :ParamDone
if "%1" == "--msvc-platform" (
REM -- One of Win32 or x64.
set MSVC_PLATFORM=%2
shift && shift
goto :ParamLoop
)
if "%1" == "--gyp-msvs-version" (
set GYP_ARGS=%GYP_ARGS% -G msvs_version=%2
shift && shift
goto :ParamLoop
)
if "%1" == "--toolset" (
set GYP_ARGS=%GYP_ARGS% -D WINPTY_MSBUILD_TOOLSET=%2
shift && shift
goto :ParamLoop
)
if "%1" == "--commit-hash" (
set GYP_ARGS=%GYP_ARGS% -D WINPTY_COMMIT_HASH=%2
shift && shift
goto :ParamLoop
)
echo error: Unrecognized argument: %1
exit /b 1
:ParamDone
REM -------------------------------------------------------------------------
REM -- Check out GYP. GYP doesn't seem to have releases, so just use the
REM -- current master commit.
if not exist build-gyp (
git clone https://chromium.googlesource.com/external/gyp build-gyp || (
echo error: GYP clone failed
exit /b 1
)
)
REM -------------------------------------------------------------------------
REM -- Run gyp to generate MSVC project files.
cd src
call ..\build-gyp\gyp.bat winpty.gyp -I configurations.gypi %GYP_ARGS%
if errorlevel 1 (
echo error: GYP failed
exit /b 1
)
REM -------------------------------------------------------------------------
REM -- Compile the project.
msbuild winpty.sln /m /p:Platform=%MSVC_PLATFORM% || (
echo error: msbuild failed
exit /b 1
)