2
0

compile.bat 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. @echo off
  2. REM Handle our optional parameters
  3. SET COMPILER=%1
  4. SET CONFIG=%2
  5. IF NOT DEFINED COMPILER SET COMPILER=VS2008
  6. IF NOT DEFINED CONFIG SET CONFIG=Release
  7. REM Setting up some variables
  8. REM Detecting the correct Program Files
  9. IF DEFINED PROGRAMFILES(X86) SET PROGRAMROOT=%ProgramFiles(x86)%
  10. IF NOT DEFINED PROGRAMROOT SET PROGRAMROOT=%ProgramFiles%
  11. REM First the defaults (set up for VS2008 by default)
  12. SET ENVVAR="%PROGRAMROOT%\Microsoft Visual Studio 9.0\VC\vcvarsall.bat"
  13. SET BUILDCMD=devenv.com
  14. SET OPTIONS= /build "%CONFIG%|Win32"
  15. SET BUILDDIR="VisualStudio 2008"
  16. REM Handle the non-defaults
  17. IF %COMPILER% == VS2005 SET ENVVAR="%PROGRAMROOT%\Microsoft Visual Studio 8\VC\vcvarsall.bat"
  18. IF %COMPILER% == VS2010 SET ENVVAR="%PROGRAMROOT%\Microsoft Visual Studio 10.0\VC\vcvarsall.bat"
  19. IF EXIST "%PROGRAMROOT%\Xoreax\IncrediBuild\BuildConsole.exe" SET BUILDCMD="%PROGRAMROOT%\Xoreax\IncrediBuild\BuildConsole.exe"
  20. IF EXIST "%PROGRAMROOT%\Xoreax\IncrediBuild\BuildConsole.exe" SET OPTIONS=/build "%CONFIG%|Win32"
  21. IF %COMPILER% == VS2005 SET BUILDDIR="VisualStudio 2005"
  22. IF %COMPILER% == VS2010 SET BUILDDIR="VisualStudio 2010"
  23. echo Building all solutions under %COMPILER% with the %CONFIG% configuration
  24. echo Initializing %COMPILER% environment variables...
  25. call %ENVVAR%
  26. echo Initializing the DirectX SDK environment variables...
  27. IF "%DXSDK_DIR%" == "" goto error_no_DXSDK_DIR
  28. call "%DXSDK_DIR%Utilities\Bin\dx_setenv.cmd" x86
  29. echo Moving to our build directory
  30. cd %BUILDDIR%
  31. echo - Building
  32. for %%a in (*.sln) do %BUILDCMD% "%%a" %OPTIONS% & IF ERRORLEVEL 1 goto error_compile
  33. REM It is just polite for a batch file to leave you in the same dir you started in
  34. cd ..
  35. REM We were successful in everything so go to the end
  36. goto :end
  37. :error_no_DXSDK_DIR
  38. @echo ERROR: DXSDK_DIR variable is not set. Make sure the DirectX SDK is installed properly.
  39. @goto end_error
  40. :error_compile
  41. @echo ERROR: There was an error compiling a solution in %CD%
  42. @goto end_error
  43. :end_error
  44. EXIT 1
  45. :end