compile.bat 1.9 KB

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