2016-10-28 04:34:24 +02:00
|
|
|
@REM @file
|
|
|
|
@REM This stand-alone program is typically called by the toolsetup.bat file,
|
|
|
|
@REM however it may be executed directly from the BaseTools project folder
|
|
|
|
@REM if the file is not executed within a WORKSPACE\BaseTools folder.
|
|
|
|
@REM
|
2020-08-13 08:40:39 +02:00
|
|
|
@REM Copyright (c) 2016-2020, Intel Corporation. All rights reserved.<BR>
|
2016-10-28 04:34:24 +02:00
|
|
|
@REM
|
2019-04-04 01:03:11 +02:00
|
|
|
@REM SPDX-License-Identifier: BSD-2-Clause-Patent
|
2016-10-28 04:34:24 +02:00
|
|
|
@REM
|
|
|
|
|
|
|
|
@echo off
|
|
|
|
pushd .
|
2019-06-12 05:28:46 +02:00
|
|
|
set SCRIPT_ERROR=0
|
|
|
|
goto main
|
|
|
|
|
|
|
|
:ToolNotInstall
|
|
|
|
set SCRIPT_ERROR=1
|
|
|
|
goto :EOF
|
|
|
|
|
|
|
|
:main
|
2019-09-19 10:52:26 +02:00
|
|
|
if /I "%1"=="VS2019" goto SetVS2019
|
2019-06-12 05:28:46 +02:00
|
|
|
if /I "%1"=="VS2017" goto SetVS2017
|
|
|
|
if /I "%1"=="VS2015" goto SetVS2015
|
2016-10-28 04:34:24 +02:00
|
|
|
|
|
|
|
if defined VS71COMNTOOLS (
|
|
|
|
if not defined VS2003_PREFIX (
|
|
|
|
set "VS2003_PREFIX=%VS71COMNTOOLS:~0,-14%"
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
2019-06-12 05:28:46 +02:00
|
|
|
:SetVS2015
|
2016-10-28 04:34:24 +02:00
|
|
|
if defined VS140COMNTOOLS (
|
|
|
|
if not defined VS2015_PREFIX (
|
|
|
|
set "VS2015_PREFIX=%VS140COMNTOOLS:~0,-14%"
|
|
|
|
)
|
|
|
|
if not defined WINSDK81_PREFIX (
|
|
|
|
set "WINSDK81_PREFIX=c:\Program Files\Windows Kits\8.1\bin\"
|
|
|
|
)
|
|
|
|
if not defined WINSDK81x86_PREFIX (
|
|
|
|
set "WINSDK81x86_PREFIX=c:\Program Files (x86)\Windows Kits\8.1\bin\"
|
|
|
|
)
|
2019-06-12 05:28:46 +02:00
|
|
|
) else (
|
|
|
|
if /I "%1"=="VS2015" goto ToolNotInstall
|
2016-10-28 04:34:24 +02:00
|
|
|
)
|
2019-06-12 05:28:46 +02:00
|
|
|
if /I "%1"=="VS2015" goto SetWinDDK
|
2016-10-28 04:34:24 +02:00
|
|
|
|
2020-08-13 08:40:39 +02:00
|
|
|
:SetVS2017
|
|
|
|
if not defined VS150COMNTOOLS (
|
2020-08-13 08:40:40 +02:00
|
|
|
@REM clear two envs so that vcvars32.bat can run successfully.
|
|
|
|
set VSINSTALLDIR=
|
|
|
|
set VCToolsVersion=
|
2019-09-19 10:52:26 +02:00
|
|
|
if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" (
|
2020-08-13 08:40:39 +02:00
|
|
|
if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2017\BuildTools" (
|
|
|
|
call "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -products Microsoft.VisualStudio.Product.BuildTools -version 15,16 > vswhereInfo
|
2019-09-19 10:52:26 +02:00
|
|
|
for /f "usebackq tokens=1* delims=: " %%i in (vswhereInfo) do (
|
|
|
|
if /i "%%i"=="installationPath" call "%%j\VC\Auxiliary\Build\vcvars32.bat"
|
|
|
|
)
|
|
|
|
del vswhereInfo
|
|
|
|
) else (
|
2020-08-13 08:40:39 +02:00
|
|
|
call "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -version 15,16 > vswhereInfo
|
2019-09-19 10:52:26 +02:00
|
|
|
for /f "usebackq tokens=1* delims=: " %%i in (vswhereInfo) do (
|
|
|
|
if /i "%%i"=="installationPath" call "%%j\VC\Auxiliary\Build\vcvars32.bat"
|
|
|
|
)
|
|
|
|
del vswhereInfo
|
|
|
|
)
|
|
|
|
) else if exist "%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe" (
|
2020-08-13 08:40:39 +02:00
|
|
|
if exist "%ProgramFiles%\Microsoft Visual Studio\2017\BuildTools" (
|
|
|
|
call "%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe" -products Microsoft.VisualStudio.Product.BuildTools -version 15,16 > vswhereInfo
|
2019-09-19 10:52:26 +02:00
|
|
|
for /f "usebackq tokens=1* delims=: " %%i in (vswhereInfo) do (
|
|
|
|
if /i "%%i"=="installationPath" call "%%j\VC\Auxiliary\Build\vcvars32.bat"
|
|
|
|
)
|
|
|
|
del vswhereInfo
|
|
|
|
) else (
|
2020-08-13 08:40:39 +02:00
|
|
|
call "%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe" -version 15,16 > vswhereInfo
|
2019-09-19 10:52:26 +02:00
|
|
|
for /f "usebackq tokens=1* delims=: " %%i in (vswhereInfo) do (
|
|
|
|
if /i "%%i"=="installationPath" call "%%j\VC\Auxiliary\Build\vcvars32.bat"
|
|
|
|
)
|
|
|
|
del vswhereInfo
|
|
|
|
)
|
|
|
|
) else (
|
2020-08-13 08:40:39 +02:00
|
|
|
if /I "%1"=="VS2017" goto ToolNotInstall
|
2019-09-19 10:52:26 +02:00
|
|
|
goto SetWinDDK
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
if defined VCToolsInstallDir (
|
2020-08-13 08:40:39 +02:00
|
|
|
if not defined VS2017_PREFIX (
|
|
|
|
set "VS2017_PREFIX=%VCToolsInstallDir%"
|
2019-09-19 10:52:26 +02:00
|
|
|
)
|
|
|
|
if not defined WINSDK10_PREFIX (
|
|
|
|
if defined WindowsSdkVerBinPath (
|
|
|
|
set "WINSDK10_PREFIX=%WindowsSdkVerBinPath%"
|
|
|
|
) else if exist "%ProgramFiles(x86)%\Windows Kits\10\bin" (
|
|
|
|
set "WINSDK10_PREFIX=%ProgramFiles(x86)%\Windows Kits\10\bin\"
|
|
|
|
) else if exist "%ProgramFiles%\Windows Kits\10\bin" (
|
|
|
|
set "WINSDK10_PREFIX=%ProgramFiles%\Windows Kits\10\bin\"
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
2019-10-08 04:54:21 +02:00
|
|
|
if not defined WINSDK_PATH_FOR_RC_EXE (
|
|
|
|
if defined WINSDK10_PREFIX (
|
|
|
|
set "WINSDK_PATH_FOR_RC_EXE=%WINSDK10_PREFIX%x86"
|
|
|
|
)
|
|
|
|
)
|
2019-09-19 10:52:26 +02:00
|
|
|
|
2020-08-13 09:59:05 +02:00
|
|
|
if /I "%1"=="VS2017" goto SetWinDDK
|
|
|
|
|
2020-08-13 08:40:39 +02:00
|
|
|
:SetVS2019
|
|
|
|
if not defined VS160COMNTOOLS (
|
2020-08-13 08:40:40 +02:00
|
|
|
@REM clear two envs so that vcvars32.bat can run successfully.
|
|
|
|
set VSINSTALLDIR=
|
|
|
|
set VCToolsVersion=
|
2017-11-22 17:26:09 +01:00
|
|
|
if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" (
|
2020-08-13 08:40:39 +02:00
|
|
|
if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2019\BuildTools" (
|
|
|
|
call "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -products Microsoft.VisualStudio.Product.BuildTools -version 16,17 > vswhereInfo
|
2019-09-19 10:52:26 +02:00
|
|
|
for /f "usebackq tokens=1* delims=: " %%i in (vswhereInfo) do (
|
2019-06-12 05:28:46 +02:00
|
|
|
if /i "%%i"=="installationPath" call "%%j\VC\Auxiliary\Build\vcvars32.bat"
|
|
|
|
)
|
2019-09-19 10:52:26 +02:00
|
|
|
del vswhereInfo
|
2019-06-12 05:28:46 +02:00
|
|
|
) else (
|
2020-08-13 08:40:39 +02:00
|
|
|
call "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -version 16,17 > vswhereInfo
|
2019-09-19 10:52:26 +02:00
|
|
|
for /f "usebackq tokens=1* delims=: " %%i in (vswhereInfo) do (
|
2019-06-12 05:28:46 +02:00
|
|
|
if /i "%%i"=="installationPath" call "%%j\VC\Auxiliary\Build\vcvars32.bat"
|
|
|
|
)
|
2019-09-19 10:52:26 +02:00
|
|
|
del vswhereInfo
|
2017-11-22 17:26:09 +01:00
|
|
|
)
|
|
|
|
) else if exist "%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe" (
|
2020-08-13 08:40:39 +02:00
|
|
|
if exist "%ProgramFiles%\Microsoft Visual Studio\2019\BuildTools" (
|
|
|
|
call "%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe" -products Microsoft.VisualStudio.Product.BuildTools -version 16,17 > vswhereInfo
|
2019-09-19 10:52:26 +02:00
|
|
|
for /f "usebackq tokens=1* delims=: " %%i in (vswhereInfo) do (
|
2019-06-12 05:28:46 +02:00
|
|
|
if /i "%%i"=="installationPath" call "%%j\VC\Auxiliary\Build\vcvars32.bat"
|
|
|
|
)
|
2019-09-19 10:52:26 +02:00
|
|
|
del vswhereInfo
|
2019-06-12 05:28:46 +02:00
|
|
|
) else (
|
2020-08-13 08:40:39 +02:00
|
|
|
call "%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe" -version 16,17 > vswhereInfo
|
2019-09-19 10:52:26 +02:00
|
|
|
for /f "usebackq tokens=1* delims=: " %%i in (vswhereInfo) do (
|
2019-06-12 05:28:46 +02:00
|
|
|
if /i "%%i"=="installationPath" call "%%j\VC\Auxiliary\Build\vcvars32.bat"
|
|
|
|
)
|
2019-09-19 10:52:26 +02:00
|
|
|
del vswhereInfo
|
2017-11-22 17:26:09 +01:00
|
|
|
)
|
|
|
|
) else (
|
2020-08-13 08:40:39 +02:00
|
|
|
if /I "%1"=="VS2019" goto ToolNotInstall
|
2017-11-22 17:26:09 +01:00
|
|
|
goto SetWinDDK
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
if defined VCToolsInstallDir (
|
2020-08-13 08:40:39 +02:00
|
|
|
if not defined VS2019_PREFIX (
|
|
|
|
set "VS2019_PREFIX=%VCToolsInstallDir%"
|
2017-11-22 17:26:09 +01:00
|
|
|
)
|
2019-09-19 10:52:26 +02:00
|
|
|
if not defined WINSDK10_PREFIX (
|
|
|
|
if defined WindowsSdkVerBinPath (
|
|
|
|
set "WINSDK10_PREFIX=%WindowsSdkVerBinPath%"
|
|
|
|
) else if exist "%ProgramFiles(x86)%\Windows Kits\10\bin" (
|
|
|
|
set "WINSDK10_PREFIX=%ProgramFiles(x86)%\Windows Kits\10\bin\"
|
|
|
|
) else if exist "%ProgramFiles%\Windows Kits\10\bin" (
|
|
|
|
set "WINSDK10_PREFIX=%ProgramFiles%\Windows Kits\10\bin\"
|
|
|
|
)
|
2017-11-22 17:26:09 +01:00
|
|
|
)
|
|
|
|
)
|
2019-10-08 04:54:21 +02:00
|
|
|
if not defined WINSDK_PATH_FOR_RC_EXE (
|
|
|
|
if defined WINSDK10_PREFIX (
|
|
|
|
set "WINSDK_PATH_FOR_RC_EXE=%WINSDK10_PREFIX%x86"
|
|
|
|
)
|
|
|
|
)
|
2017-11-22 17:26:09 +01:00
|
|
|
|
2020-08-13 09:59:05 +02:00
|
|
|
if /I "%1"=="VS2019" goto SetWinDDK
|
|
|
|
|
2017-11-22 17:26:09 +01:00
|
|
|
:SetWinDDK
|
2016-10-28 04:34:24 +02:00
|
|
|
if not defined WINDDK3790_PREFIX (
|
|
|
|
set WINDDK3790_PREFIX=C:\WINDDK\3790.1830\bin\
|
|
|
|
)
|
|
|
|
|
|
|
|
if not defined IASL_PREFIX (
|
|
|
|
set IASL_PREFIX=C:\ASL\
|
|
|
|
)
|
|
|
|
|
|
|
|
popd
|