mkdir C:\bld
cd C:\bld

set "CMAKE_GENERATOR=Visual Studio 9 2008"
if "%PY_VER%" == "3.3" set "CMAKE_GENERATOR=Visual Studio 10"
if "%PY_VER%" == "3.4" set "CMAKE_GENERATOR=Visual Studio 10"
if "%PY_VER%" == "3.5" set "CMAKE_GENERATOR=Visual Studio 13"

if "%ARCH%" == "64" set "CMAKE_GENERATOR=%CMAKE_GENERATOR% Win64"

REM Remove dot from PY_VER for use in library name
set MY_PY_VER=%PY_VER:.=%

REM Configure Step
cmake -G "%CMAKE_GENERATOR%" ^
    -DSimpleITK_BUILD_DISTRIBUTE:BOOL=ON ^
    -DBUILD_SHARED_LIBS:BOOL=OFF ^
    -DCMAKE_BUILD_TYPE=Release ^
    -DBUILD_TESTING:BOOL=OFF ^
    -DBUILD_EXAMPLES:BOOL=OFF ^
    -DWRAP_CSHARP:BOOL=OFF ^
    -DWRAP_LUA:BOOL=OFF ^
    -DWRAP_PYTHON:BOOL=ON ^
    -DWRAP_JAVA:BOOL=OFF ^
    -DWRAP_CSHARP:BOOL=OFF ^
    -DWRAP_TCL:BOOL=OFF ^
    -DWRAP_R:BOOL=OFF ^
    -DWRAP_RUBY:BOOL=OFF ^
    -DITK_USE_SYSTEM_JPEG:BOOL=OFF ^
    -DITK_USE_SYSTEM_PNG:BOOL=OFF ^
    -DITK_USE_SYSTEM_TIFF:BOOL=OFF ^
    -DITK_USE_SYSTEM_ZLIB:BOOL=OFF ^
    "-DCMAKE_SYSTEM_PREFIX_PATH:PATH=%PREFIX%/Library" ^
    "-DPYTHON_EXECUTABLE:FILEPATH=%PYTHON%" ^
    "-DPYTHON_INCLUDE_DIR:PATH=%PREFIX%/include" ^
    "-DPYTHON_LIBRARY:FILEPATH=%PREFIX%/libs/python%MY_PY_VER%.lib" ^
     %CMAKE_CUSTOM% ^
    "%SRC_DIR%/SuperBuild"

if errorlevel 1 exit 1
    
REM Build step
cmake --build  . --config Release
if errorlevel 1 exit 1

REM Install step
REM cmake --build  . --config Release --target INSTALL
if errorlevel 1 exit 1

cd SimpleITK-build\Wrapping
%PYTHON% PythonPackage\setup.py install
