SetVisualStudio.bat 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. @REM @file
  2. @REM Windows batch file to set up the Microsoft Visual Studio environment
  3. @REM
  4. @REM This script is used to set up one of the Microsoft Visual Studio
  5. @REM environments, VS2008x86, VS2010x86, VS2012x86 or VS2013x86 for
  6. @REM building the Nt32Pkg/Nt32Pkg.dsc emulation environment to run on
  7. @REM an X64 version of Windows.
  8. @REM The system environment variables in this script are set by the
  9. @rem Edk2Setup.bat script (that will be renamed to edksetup.bat).
  10. @REM
  11. @REM This script can also be used to build the Win32 binaries
  12. @REM
  13. @REM Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>
  14. @REM SPDX-License-Identifier: BSD-2-Clause-Patent
  15. @REM
  16. @echo off
  17. @if defined NT32_X64 @goto CheckLatest
  18. @if "%REBUILD_TOOLS%"=="TRUE" @goto RebuildTools
  19. :CheckLatest
  20. echo.
  21. @if defined VS140COMNTOOLS (
  22. @set "COMMONTOOLSx64=C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\x86_amd64"
  23. @goto SetVs
  24. )
  25. @if defined VS120COMNTOOLS (
  26. @set "COMMONTOOLSx64=C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\x86_amd64"
  27. @goto SetVs
  28. )
  29. @if defined VS110COMNTOOLS (
  30. @set "COMMONTOOLSx64=C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\x86_amd64"
  31. @goto SetVs
  32. )
  33. @if defined VS100COMNTOOLS (
  34. @set "COMMONTOOLSx64=C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\x86_amd64"
  35. @goto SetVs
  36. )
  37. @if defined VS90COMNTOOLS (
  38. @set "COMMONTOOLSx64=C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\x86_amd64"
  39. @goto SetVs
  40. )
  41. @echo.
  42. @echo No version of Microsoft Visual Studio was found on this system
  43. @echo.
  44. @exit /B 1
  45. @REM Set up the X64 environment for building Nt32Pkg/Nt32Pkg.dsc to run on an X64 platform
  46. :SetVs
  47. if exist "%COMMONTOOLSx64%\vcvarsx86_amd64.bat" (
  48. @call "%COMMONTOOLSx64%\vcvarsx86_amd64.bat"
  49. @if errorlevel 1 (
  50. @echo. ERROR setting Microsoft Visual Studio %1
  51. @set COMMONTOOLSx64=
  52. @exit /B 1
  53. )
  54. )
  55. if not exist "%COMMONTOOLSx64%\vcvarsx86_amd64.bat" (
  56. @echo ERROR : This script does not exist: "%COMMONTOOLSx64%\vcvarsx86_amd64.bat"
  57. @set COMMONTOOLSx64=
  58. @exit /B 1
  59. )
  60. @set COMMONTOOLSx64=
  61. @goto End
  62. :RebuildTools
  63. @call python "%BASE_TOOLS_PATH%\Scripts\UpdateBuildVersions.py"
  64. @set "BIN_DIR=%EDK_TOOLS_PATH%\Bin\Win32"
  65. if not exist "%BIN_DIR%" @mkdir "%BIN_DIR%"
  66. @echo Removing temporary and binary files
  67. @cd "%BASE_TOOLS_PATH%"
  68. @call nmake cleanall
  69. @echo Rebuilding the EDK II BaseTools
  70. @cd "%BASE_TOOLS_PATH%\Source\C"
  71. @call nmake -nologo -a -f Makefile
  72. @if errorlevel 1 (
  73. @echo Error building the C-based BaseTools
  74. @cd "%WORKSPACE%"
  75. @exit /B1
  76. )
  77. @cd %BASE_TOOLS_PATH%\Source\Python
  78. @call nmake -nologo -a -f Makefile
  79. @if errorlevel 1 (
  80. @echo Error building the Python-based BaseTools
  81. @cd %WORKSPACE%
  82. @exit /B1
  83. )
  84. @cd %WORKSPACE%
  85. @goto End
  86. :VersionNotFound
  87. @echo.
  88. @echo This Microsoft Visual Studio version is in not installed on this system: %1
  89. @echo.
  90. @exit /B 1
  91. :End
  92. @exit /B 0