]> git.proxmox.com Git - mirror_edk2.git/blob - BaseTools/Scripts/SetVisualStudio.bat
BaseTools: Use absolute import in Scripts
[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 This program and the accompanying materials
15 @REM are licensed and made available under the terms and conditions of the BSD License
16 @REM which accompanies this distribution. The full text of the license may be found at
17 @REM http://opensource.org/licenses/bsd-license.php
18 @REM
19 @REM THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
20 @REM WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
21 @REM
22 @echo off
23 @if defined NT32_X64 @goto CheckLatest
24 @if "%REBUILD_TOOLS%"=="TRUE" @goto RebuildTools
25
26 :CheckLatest
27 echo.
28 @if defined VS140COMNTOOLS (
29 @set "COMMONTOOLSx64=C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\x86_amd64"
30 @goto SetVs
31 )
32
33 @if defined VS120COMNTOOLS (
34 @set "COMMONTOOLSx64=C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\x86_amd64"
35 @goto SetVs
36 )
37
38 @if defined VS110COMNTOOLS (
39 @set "COMMONTOOLSx64=C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\x86_amd64"
40 @goto SetVs
41 )
42
43 @if defined VS100COMNTOOLS (
44 @set "COMMONTOOLSx64=C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\x86_amd64"
45 @goto SetVs
46 )
47
48 @if defined VS90COMNTOOLS (
49 @set "COMMONTOOLSx64=C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\x86_amd64"
50 @goto SetVs
51 )
52 @echo.
53 @echo No version of Microsoft Visual Studio was found on this system
54 @echo.
55 @exit /B 1
56
57 @REM Set up the X64 environment for building Nt32Pkg/Nt32Pkg.dsc to run on an X64 platform
58 :SetVs
59 if exist "%COMMONTOOLSx64%\vcvarsx86_amd64.bat" (
60 @call "%COMMONTOOLSx64%\vcvarsx86_amd64.bat"
61 @if errorlevel 1 (
62 @echo. ERROR setting Microsoft Visual Studio %1
63 @set COMMONTOOLSx64=
64 @exit /B 1
65 )
66 )
67 if not exist "%COMMONTOOLSx64%\vcvarsx86_amd64.bat" (
68 @echo ERROR : This script does not exist: "%COMMONTOOLSx64%\vcvarsx86_amd64.bat"
69 @set COMMONTOOLSx64=
70 @exit /B 1
71 )
72 @set COMMONTOOLSx64=
73 @goto End
74
75 :RebuildTools
76 @call python "%BASE_TOOLS_PATH%\Scripts\UpdateBuildVersions.py"
77 @set "BIN_DIR=%EDK_TOOLS_PATH%\Bin\Win32"
78 if not exist "%BIN_DIR%" @mkdir "%BIN_DIR%"
79 @echo Removing temporary and binary files
80 @cd "%BASE_TOOLS_PATH%"
81 @call nmake cleanall
82 @echo Rebuilding the EDK II BaseTools
83 @cd "%BASE_TOOLS_PATH%\Source\C"
84 @call nmake -nologo -a -f Makefile
85 @if errorlevel 1 (
86 @echo Error building the C-based BaseTools
87 @cd "%WORKSPACE%"
88 @exit /B1
89 )
90 @cd %BASE_TOOLS_PATH%\Source\Python
91 @call nmake -nologo -a -f Makefile
92 @if errorlevel 1 (
93 @echo Error building the Python-based BaseTools
94 @cd %WORKSPACE%
95 @exit /B1
96 )
97 @cd %WORKSPACE%
98
99 @goto End
100
101 :VersionNotFound
102 @echo.
103 @echo This Microsoft Visual Studio version is in not installed on this system: %1
104 @echo.
105 @exit /B 1
106
107 :End
108 @exit /B 0