]> git.proxmox.com Git - mirror_edk2.git/blob - BaseTools/Scripts/SetVisualStudio.bat
BaseTools: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / BaseTools / Scripts / SetVisualStudio.bat
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
20 :CheckLatest
21 echo.
22 @if defined VS140COMNTOOLS (
23 @set "COMMONTOOLSx64=C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\x86_amd64"
24 @goto SetVs
25 )
26
27 @if defined VS120COMNTOOLS (
28 @set "COMMONTOOLSx64=C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\x86_amd64"
29 @goto SetVs
30 )
31
32 @if defined VS110COMNTOOLS (
33 @set "COMMONTOOLSx64=C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\x86_amd64"
34 @goto SetVs
35 )
36
37 @if defined VS100COMNTOOLS (
38 @set "COMMONTOOLSx64=C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\x86_amd64"
39 @goto SetVs
40 )
41
42 @if defined VS90COMNTOOLS (
43 @set "COMMONTOOLSx64=C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\x86_amd64"
44 @goto SetVs
45 )
46 @echo.
47 @echo No version of Microsoft Visual Studio was found on this system
48 @echo.
49 @exit /B 1
50
51 @REM Set up the X64 environment for building Nt32Pkg/Nt32Pkg.dsc to run on an X64 platform
52 :SetVs
53 if exist "%COMMONTOOLSx64%\vcvarsx86_amd64.bat" (
54 @call "%COMMONTOOLSx64%\vcvarsx86_amd64.bat"
55 @if errorlevel 1 (
56 @echo. ERROR setting Microsoft Visual Studio %1
57 @set COMMONTOOLSx64=
58 @exit /B 1
59 )
60 )
61 if not exist "%COMMONTOOLSx64%\vcvarsx86_amd64.bat" (
62 @echo ERROR : This script does not exist: "%COMMONTOOLSx64%\vcvarsx86_amd64.bat"
63 @set COMMONTOOLSx64=
64 @exit /B 1
65 )
66 @set COMMONTOOLSx64=
67 @goto End
68
69 :RebuildTools
70 @call python "%BASE_TOOLS_PATH%\Scripts\UpdateBuildVersions.py"
71 @set "BIN_DIR=%EDK_TOOLS_PATH%\Bin\Win32"
72 if not exist "%BIN_DIR%" @mkdir "%BIN_DIR%"
73 @echo Removing temporary and binary files
74 @cd "%BASE_TOOLS_PATH%"
75 @call nmake cleanall
76 @echo Rebuilding the EDK II BaseTools
77 @cd "%BASE_TOOLS_PATH%\Source\C"
78 @call nmake -nologo -a -f Makefile
79 @if errorlevel 1 (
80 @echo Error building the C-based BaseTools
81 @cd "%WORKSPACE%"
82 @exit /B1
83 )
84 @cd %BASE_TOOLS_PATH%\Source\Python
85 @call nmake -nologo -a -f Makefile
86 @if errorlevel 1 (
87 @echo Error building the Python-based BaseTools
88 @cd %WORKSPACE%
89 @exit /B1
90 )
91 @cd %WORKSPACE%
92
93 @goto End
94
95 :VersionNotFound
96 @echo.
97 @echo This Microsoft Visual Studio version is in not installed on this system: %1
98 @echo.
99 @exit /B 1
100
101 :End
102 @exit /B 0