if %PY_VER% == 2.7 (
    xcopy /E %RECIPE_DIR%\vc9 .
) else (
    xcopy /E %RECIPE_DIR%\vc10 .
    devenv /Upgrade Thrift.sln
)
if errorlevel 1 exit 1

copy %RECIPE_DIR%\stdint.h .
if errorlevel 1 exit 1

mkdir %LIBRARY_INC%\thrift
mkdir %LIBRARY_INC%\thrift\protocol
mkdir %LIBRARY_INC%\thrift\processor
mkdir %LIBRARY_INC%\thrift\transport
mkdir %LIBRARY_INC%\thrift\windows
mkdir %LIBRARY_INC%\thrift\concurrency
copy lib\cpp\src\thrift\*.h %LIBRARY_INC%\thrift
copy lib\cpp\src\thrift\transport\*.h %LIBRARY_INC%\thrift\transport
copy lib\cpp\src\thrift\protocol\*.h %LIBRARY_INC%\thrift\protocol
copy lib\cpp\src\thrift\protocol\*.tcc %LIBRARY_INC%\thrift\protocol
copy lib\cpp\src\thrift\processor\*.h %LIBRARY_INC%\thrift\processor
copy lib\cpp\src\thrift\windows\*.h %LIBRARY_INC%\thrift\windows
copy lib\cpp\src\thrift\concurrency\*.h %LIBRARY_INC%\thrift\concurrency
if errorlevel 1 exit 1

if "%ARCH%"=="64" (
    set PLAT=x64
    set REL_DIR=x64\Release
) else (
    set PLAT=x86
    set REL_DIR=Release
)

if %PY_VER% == 2.7 (
    vcbuild Thrift.sln
) else (
    msbuild Thrift.sln /property:Configuration=Release /property:Platform=%PLAT%
)
if errorlevel 1 exit 1
copy %REL_DIR%\Thrift.lib %LIBRARY_LIB%
if errorlevel 1 exit 1
