runprebuild.bat 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. @echo OFF
  2. bin\Prebuild.exe /target vs2015
  3. setlocal ENABLEEXTENSIONS
  4. set VALUE_NAME=MSBuildToolsPath
  5. rem try find vs2017
  6. if "%PROCESSOR_ARCHITECTURE%"=="x86" set PROGRAMS=%ProgramFiles%
  7. if defined ProgramFiles(x86) set PROGRAMS=%ProgramFiles(x86)%
  8. for %%e in (Enterprise Professional Community) do (
  9. if exist "%PROGRAMS%\Microsoft Visual Studio\2017\%%e\MSBuild\15.0\Bin\MSBuild.exe" (
  10. set ValueValue="%PROGRAMS%\Microsoft Visual Studio\2017\%%e\MSBuild\15.0\Bin\"
  11. goto :found
  12. )
  13. )
  14. rem We have to use grep or find to locate the correct line, because reg query spits
  15. rem out 4 lines before Windows 7 but 2 lines after Windows 7.
  16. rem We use grep if it's on the path; otherwise we use the built-in find command
  17. rem from Windows. (We must use grep on Cygwin because it overrides the "find" command.)
  18. for %%X in (grep.exe) do (set FOUNDGREP=%%~$PATH:X)
  19. if defined FOUNDGREP (
  20. set FINDCMD=grep
  21. ) else (
  22. set FINDCMD=find
  23. )
  24. for %%v in (14.0, 12.0, 4.0) do (
  25. FOR /F "usebackq tokens=1-3" %%A IN (`REG QUERY "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild\ToolsVersions\%%v" /v %VALUE_NAME% 2^>nul ^| %FINDCMD% "%VALUE_NAME%"`) DO (
  26. set ValueValue=%%C
  27. goto :found
  28. )
  29. )
  30. @echo %KEY_NAME%\%VALUE_NAME% not found.
  31. @echo Not creating compile.bat
  32. exit
  33. :found
  34. @echo Found msbuild at %ValueValue%
  35. @echo Creating compile.bat
  36. @echo %ValueValue%\msbuild opensim.sln > compile.bat