| 1 |
@echo off |
| 2 |
|
| 3 |
REM -- Script requirements: |
| 4 |
REM -- |
| 5 |
REM -- * git This program must be in the Path to check out |
| 6 |
REM -- build-gyp. If that directory already exists, then |
| 7 |
REM -- git isn't necessary, but if it is missing, no |
| 8 |
REM -- commit hash will be embedded into binaries. |
| 9 |
REM -- |
| 10 |
REM -- * python A non-Cygwin Python 2 python.exe must be in the |
| 11 |
REM -- Path to run gyp. |
| 12 |
REM -- |
| 13 |
REM -- * msbuild msbuild must be in the Path. It is probably |
| 14 |
REM -- important to have msbuild from the correct MSVC |
| 15 |
REM -- release. |
| 16 |
REM -- |
| 17 |
REM -- The script's output binaries are in the src/Release/{Win32,x64} |
| 18 |
REM -- directory. |
| 19 |
|
| 20 |
REM ------------------------------------------------------------------------- |
| 21 |
REM -- Parse arguments |
| 22 |
|
| 23 |
setlocal |
| 24 |
cd %~dp0 |
| 25 |
set GYP_ARGS= |
| 26 |
set MSVC_PLATFORM=x64 |
| 27 |
|
| 28 |
:ParamLoop |
| 29 |
if "%1" == "" goto :ParamDone |
| 30 |
if "%1" == "--msvc-platform" ( |
| 31 |
REM -- One of Win32 or x64. |
| 32 |
set MSVC_PLATFORM=%2 |
| 33 |
shift && shift |
| 34 |
goto :ParamLoop |
| 35 |
) |
| 36 |
if "%1" == "--gyp-msvs-version" ( |
| 37 |
set GYP_ARGS=%GYP_ARGS% -G msvs_version=%2 |
| 38 |
shift && shift |
| 39 |
goto :ParamLoop |
| 40 |
) |
| 41 |
if "%1" == "--toolset" ( |
| 42 |
set GYP_ARGS=%GYP_ARGS% -D WINPTY_MSBUILD_TOOLSET=%2 |
| 43 |
shift && shift |
| 44 |
goto :ParamLoop |
| 45 |
) |
| 46 |
if "%1" == "--commit-hash" ( |
| 47 |
set GYP_ARGS=%GYP_ARGS% -D WINPTY_COMMIT_HASH=%2 |
| 48 |
shift && shift |
| 49 |
goto :ParamLoop |
| 50 |
) |
| 51 |
echo error: Unrecognized argument: %1 |
| 52 |
exit /b 1 |
| 53 |
:ParamDone |
| 54 |
|
| 55 |
REM ------------------------------------------------------------------------- |
| 56 |
REM -- Check out GYP. GYP doesn't seem to have releases, so just use the |
| 57 |
REM -- current master commit. |
| 58 |
|
| 59 |
if not exist build-gyp ( |
| 60 |
git clone https://chromium.googlesource.com/external/gyp build-gyp || ( |
| 61 |
echo error: GYP clone failed |
| 62 |
exit /b 1 |
| 63 |
) |
| 64 |
) |
| 65 |
|
| 66 |
REM ------------------------------------------------------------------------- |
| 67 |
REM -- Run gyp to generate MSVC project files. |
| 68 |
|
| 69 |
cd src |
| 70 |
|
| 71 |
call ..\build-gyp\gyp.bat winpty.gyp -I configurations.gypi %GYP_ARGS% |
| 72 |
if errorlevel 1 ( |
| 73 |
echo error: GYP failed |
| 74 |
exit /b 1 |
| 75 |
) |
| 76 |
|
| 77 |
REM ------------------------------------------------------------------------- |
| 78 |
REM -- Compile the project. |
| 79 |
|
| 80 |
msbuild winpty.sln /m /p:Platform=%MSVC_PLATFORM% || ( |
| 81 |
echo error: msbuild failed |
| 82 |
exit /b 1 |
| 83 |
) |