windows-build.bat 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. @echo off
  2. setlocal enabledelayedexpansion
  3. set top=%cd%
  4. if not exist "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" (
  5. echo ERROR: cannot find vswhere.exe
  6. pause
  7. exit
  8. )
  9. for /f "usebackq tokens=*" %%i in (`"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -latest -property catalog_productLineVersion`) do (
  10. set version=%%i
  11. )
  12. if %version%==2022 (
  13. echo Found VS2022.
  14. ) else (
  15. echo ERROR: could not find Visual Studio 2022.
  16. pause
  17. exit
  18. )
  19. for /f "usebackq tokens=*" %%i in (`"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -latest -requires Microsoft.Component.MSBuild -find MSBuild\**\Bin\MSBuild.exe`) do (
  20. set msbuild=%%i
  21. )
  22. if not exist "%msbuild%" (
  23. echo ERROR: cannot find msbuild.exe
  24. pause
  25. exit
  26. )
  27. cd scripts
  28. call .\windows-prebuild.bat %version%
  29. cd %top%
  30. "%msbuild%" /t:Build /m /p:PreferredToolArchitecture=x64 /p:Configuration=Release;Platform=x64 %CD%\build-vs%version%\CoolVLViewer.sln
  31. echo Compilation finished (and hopefully successful). Press a key to exit.
  32. pause