@echo off

set GYP_ARGS=

REM -------------------------------------------------------------------------
REM -- Copy CMakeLists.txt to src


COPY %RECIPE_DIR%\CMakeLists.txt src
cd src

REM -------------------------------------------------------------------------
REM -- Run cmake to generate MSVC project files.

%LIBRARY_BIN%\cmake -G "NMake Makefiles" -DCMAKE_INSTALL_PREFIX:PATH="%LIBRARY_PREFIX%" -DCMAKE_BUILD_TYPE:STRING=Release
if errorlevel 1 (
    echo error: cmake failed
    exit /b 1
)

REM -------------------------------------------------------------------------
REM -- Compile the project.

nmake || (
    echo error: nmake failed
    exit /b 1
)

REM -------------------------------------------------------------------------
REM -- Install the project.

rem nmake install

copy include\winpty.h %LIBRARY_INC%
copy include\winpty_constants.h %LIBRARY_INC%

copy lib\winpty.lib %LIBRARY_LIB%
copy lib\winpty.dll %LIBRARY_BIN%
copy bin\winpty-agent.exe %LIBRARY_BIN%
copy bin\winpty-debugserver.exe %LIBRARY_BIN%
