@echo off

::::   This is mpicc.bat sample for WMPI, not tested!!!    ::::
::::   Written at Jun 1999, Ilya Evseev (evseev@csa.ru)    ::::

::  Check self restarting with bigger environment space
if not "%1"=="-" goto CheckEnv
::  If i'm restarted, restore command line ( remove "-" )
shift
::  ...and go to setup Visual C++ environment variables
goto LoadEnv

:CheckEnv

::  Check Visual C++ environment variables already loaded
if not "%MSVCDir"=="" goto EnvOk

::  Under WinNT - load Visual C++ environment immediately
if not "%NUMBER_OF_PROCESSORS%"=="" goto LoadEnv

::  Under Win95 - restart COMMAND.COM for growing environment space
%COMSPEC% /e:4096 /c %0 - %1 %2 %3 %4 %5 %6 %7 %8 %9
goto Done

:LoadEnv
::  CAUTION: Change path of Visual C++ to proper value
call "C:\Program files\DevStudio\VC\bin\vcvars32" x86
:EnvOk

::  Add WMPI settings to environment variables used by compiler
::  CAUTION: Change path of WMPI to proper value
set WMPI=C:\Program files\WMPI_1.2
set INCLUDE=%WMPI%\Include;%INCLUDE%
set LIB=%WMPI%\Lib\Console;%LIB%

::  Run C++ compiler
cl %1 %2 %3 %4 %5 %6 %7 %8 %9 cvwmpi.lib vwmpi.res
::  Play sound if error
if errorlevel 1 start /min sndrec32 /play /close %windir%\media\ding.wav