runprebuild.bat 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. @echo OFF
  2. bin\Prebuild.exe /target vs2015
  3. setlocal ENABLEEXTENSIONS
  4. set VALUE_NAME=MSBuildToolsPath
  5. if "%PROCESSOR_ARCHITECTURE%"=="x86" set PROGRAMS=%ProgramFiles%
  6. if defined ProgramFiles(x86) set PROGRAMS=%ProgramFiles(x86)%
  7. rem Try to find VS2019
  8. for %%e in (Enterprise Professional Community) do (
  9. if exist "%PROGRAMS%\Microsoft Visual Studio\2019\%%e\MSBuild\Current\Bin\MSBuild.exe" (
  10. set ValueValue="%PROGRAMS%\Microsoft Visual Studio\2019\%%e\MSBuild\Current\Bin\MSBuild"
  11. goto :found
  12. )
  13. )
  14. rem try find vs2017
  15. for %%e in (Enterprise Professional Community) do (
  16. if exist "%PROGRAMS%\Microsoft Visual Studio\2017\%%e\MSBuild\15.0\Bin\MSBuild.exe" (
  17. set ValueValue="%PROGRAMS%\Microsoft Visual Studio\2017\%%e\MSBuild\15.0\Bin\MSBuild"
  18. goto :found
  19. )
  20. )
  21. rem We have to use grep or find to locate the correct line, because reg query spits
  22. rem out 4 lines before Windows 7 but 2 lines after Windows 7.
  23. rem We use grep if it's on the path; otherwise we use the built-in find command
  24. rem from Windows. (We must use grep on Cygwin because it overrides the "find" command.)
  25. for %%X in (grep.exe) do (set FOUNDGREP=%%~$PATH:X)
  26. if defined FOUNDGREP (
  27. set FINDCMD=grep
  28. ) else (
  29. set FINDCMD=find
  30. )
  31. rem try vs2015
  32. FOR /F "usebackq tokens=1-3" %%A IN (`REG QUERY "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild\ToolsVersions\14.0" /v %VALUE_NAME% 2^>nul ^| %FINDCMD% "%VALUE_NAME%"`) DO (
  33. set ValueValue=%%C\msbuild
  34. goto :found
  35. )
  36. @echo msbuild for at least VS2015 not found, please install a (Community) edition of VS2017 or VS2015
  37. @echo Not creating compile.bat
  38. if exist "compile.bat" (
  39. del compile.bat
  40. )
  41. goto :done
  42. :found
  43. @echo Found msbuild at %ValueValue%
  44. @echo Creating compile.bat
  45. rem To compile in debug mode
  46. @echo %ValueValue% opensim.sln > compile.bat
  47. rem To compile in release mode comment line (add rem to start) above and uncomment next (remove rem)
  48. rem @echo %ValueValue% /P:Config=Release opensim.sln > compile.bat
  49. :done