Allen: In my machine, I install VS2017, but not install VS2019. I call edksetup.bat. It will set up VS2017 environment. But with this change, it will set the wrong WINSDK10_PREFIX. I add the comments in the patch.
>-----Original Message----- >From: Cheng, Ching JenX >Sent: Tuesday, September 17, 2019 11:16 AM >To: devel@edk2.groups.io >Cc: Chan, Amy <amy.c...@intel.com>; Feng, Bob C <bob.c.f...@intel.com>; >Gao, Liming <liming....@intel.com> >Subject: [PATCH v2 2/2] Add VS2019 Support on ToolSetup Batches > >REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2182 > >Inorder to support VS2019, we add VS2019 config process >in Setup Batch Files, >Because VS2019 and VS2017 could using same vswhere.exe >to detect the InstallationPath, >So we add the -version as the parameter of vswhere >to get the correct VS2017/VS2019's InstallationPath > >Cc: Amy Chan <amy.c...@intel.com> >Cc: Bob Feng <bob.c.f...@intel.com> >Cc: Liming Gao <liming....@intel.com> >Signed-off-by: Ching JenX Cheng <ching.jenx.ch...@intel.com> >--- > BaseTools/get_vsvars.bat | 37 ++++++++++++++++++++++++++++++----- >-- > BaseTools/set_vsprefix_envs.bat | 70 >+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ >++++++----- > BaseTools/toolsetup.bat | 16 +++++++++++++--- > edksetup.bat | 6 ++++-- > 4 files changed, 112 insertions(+), 17 deletions(-) > >diff --git a/BaseTools/get_vsvars.bat b/BaseTools/get_vsvars.bat >index 9f3759b2a9..3beb113be2 100644 >--- a/BaseTools/get_vsvars.bat >+++ b/BaseTools/get_vsvars.bat >@@ -10,15 +10,21 @@ > @echo off > set SCRIPT_ERROR=0 > if "%1"=="" goto main >+if /I "%1"=="VS2019" goto VS2019Vars > if /I "%1"=="VS2017" goto VS2017Vars > if /I "%1"=="VS2015" goto VS2015Vars > if /I "%1"=="VS2013" goto VS2013Vars > if /I "%1"=="VS2012" goto VS2012Vars > > :set_vsvars >-for /f "usebackq tokens=1* delims=: " %%i in (`%*`) do ( >- if /i "%%i"=="installationPath" call "%%j\VC\Auxiliary\Build\vcvars32.bat" >-) >+if defined VCINSTALLDIR goto :EOF >+ call %* > vswhereInfo >+ for /f "usebackq tokens=1* delims=: " %%i in (vswhereInfo) do ( >+ if /i "%%i"=="installationPath" ( >+ call "%%j\VC\Auxiliary\Build\vcvars32.bat" >+ ) >+ ) >+ del vswhereInfo > goto :EOF > > :read_vsvars >@@ -42,19 +48,36 @@ REM (Or invoke the relevant vsvars32 file >beforehand). > > :main > if defined VCINSTALLDIR goto :done >+ :VS2019Vars >+ if exist "%ProgramFiles(x86)%\Microsoft Visual >Studio\Installer\vswhere.exe" ( >+ if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2019\BuildTools" ( >+ call :set_vsvars "%ProgramFiles(x86)%\Microsoft Visual >Studio\Installer\vswhere.exe" -products >Microsoft.VisualStudio.Product.BuildTools -version 16,17 >+ ) else ( >+ call :set_vsvars "%ProgramFiles(x86)%\Microsoft Visual >Studio\Installer\vswhere.exe" -version 16,17 >+ ) >+ ) >+ if exist "%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe" ( >+ if exist "%ProgramFiles%\Microsoft Visual Studio\2019\BuildTools" ( >+ call :set_vsvars "%ProgramFiles%\Microsoft Visual >Studio\Installer\vswhere.exe" -products >Microsoft.VisualStudio.Product.BuildTools -version 16,17 >+ ) else ( >+ call :set_vsvars "%ProgramFiles%\Microsoft Visual >Studio\Installer\vswhere.exe" -version 16,17 >+ ) >+ ) >+ if /I "%1"=="VS2019" goto ToolNotInstall >+ > :VS2017Vars > if exist "%ProgramFiles(x86)%\Microsoft Visual >Studio\Installer\vswhere.exe" ( > if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2017\BuildTools" ( >- call :set_vsvars "%ProgramFiles(x86)%\Microsoft Visual >Studio\Installer\vswhere.exe" -products >Microsoft.VisualStudio.Product.BuildTools >+ call :set_vsvars "%ProgramFiles(x86)%\Microsoft Visual >Studio\Installer\vswhere.exe" -products >Microsoft.VisualStudio.Product.BuildTools -version 15,16 > ) else ( >- call :set_vsvars "%ProgramFiles(x86)%\Microsoft Visual >Studio\Installer\vswhere.exe" >+ call :set_vsvars "%ProgramFiles(x86)%\Microsoft Visual >Studio\Installer\vswhere.exe" -version 15,16 > ) > ) > if exist "%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe" ( > if exist "%ProgramFiles%\Microsoft Visual Studio\2017\BuildTools" ( >- call :set_vsvars "%ProgramFiles%\Microsoft Visual >Studio\Installer\vswhere.exe" -products >Microsoft.VisualStudio.Product.BuildTools >+ call :set_vsvars "%ProgramFiles%\Microsoft Visual >Studio\Installer\vswhere.exe" -products >Microsoft.VisualStudio.Product.BuildTools -version 15,16 > ) else ( >- call :set_vsvars "%ProgramFiles%\Microsoft Visual >Studio\Installer\vswhere.exe" >+ call :set_vsvars "%ProgramFiles%\Microsoft Visual >Studio\Installer\vswhere.exe" -version 15,16 > ) > ) > if /I "%1"=="VS2017" goto ToolNotInstall >diff --git a/BaseTools/set_vsprefix_envs.bat >b/BaseTools/set_vsprefix_envs.bat >index 81686f5b63..46b84713a6 100644 >--- a/BaseTools/set_vsprefix_envs.bat >+++ b/BaseTools/set_vsprefix_envs.bat >@@ -3,7 +3,7 @@ > @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 >-@REM Copyright (c) 2016-2017, Intel Corporation. All rights reserved.<BR> >+@REM Copyright (c) 2016-2019, Intel Corporation. All rights reserved.<BR> > @REM > @REM SPDX-License-Identifier: BSD-2-Clause-Patent > @REM >@@ -18,6 +18,7 @@ set SCRIPT_ERROR=1 > goto :EOF > > :main >+if /I "%1"=="VS2019" goto SetVS2019 > if /I "%1"=="VS2017" goto SetVS2017 > if /I "%1"=="VS2015" goto SetVS2015 > if /I "%1"=="VS2013" goto SetVS2013 >@@ -107,27 +108,86 @@ if defined VS140COMNTOOLS ( > ) > if /I "%1"=="VS2015" goto SetWinDDK > >+:SetVS2019 >+if not defined VS160COMNTOOLS ( >+ if exist "%ProgramFiles(x86)%\Microsoft Visual >Studio\Installer\vswhere.exe" ( >+ 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 >+ for /f "usebackq tokens=1* delims=: " %%i in (vswhereInfo) do ( >+ if /i "%%i"=="installationPath" call >"%%j\VC\Auxiliary\Build\vcvars32.bat" >+ ) >+ del vswhereInfo >+ ) else ( >+ call "%ProgramFiles(x86)%\Microsoft Visual >Studio\Installer\vswhere.exe" -version 16,17 > vswhereInfo >+ 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" ( >+ 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 >+ for /f "usebackq tokens=1* delims=: " %%i in (vswhereInfo) do ( >+ if /i "%%i"=="installationPath" call >"%%j\VC\Auxiliary\Build\vcvars32.bat" >+ ) >+ del vswhereInfo >+ ) else ( >+ call "%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe" - >version 16,17 > vswhereInfo >+ 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 /I "%1"=="VS2019" goto ToolNotInstall >+ goto SetWinDDK >+ ) >+) >+ >+if defined VCToolsInstallDir ( >+ if not defined VS2019_PREFIX ( >+ set "VS2019_PREFIX=%VCToolsInstallDir%" >+ ) >+) >+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\" >+ ) >+) In my machine, VS2019 is not installed. Then, WindowsSdkVerBinPath is not set. So, set "WINSDK10_PREFIX=%ProgramFiles(x86)%\Windows Kits\10\bin\" But, I install VS2017. WINSDK10_PREFIX should be set later. Here, the suggest change is to move WINSDK10_PREFIX setting into VCToolsInstallDir check condition. WINSDK10_PREFIX is only set when VCToolsInstallDir is defined. Thanks Liming >+ > :SetVS2017 > if not defined VS150COMNTOOLS ( > if exist "%ProgramFiles(x86)%\Microsoft Visual >Studio\Installer\vswhere.exe" ( > if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2017\BuildTools" ( >- for /f "usebackq tokens=1* delims=: " %%i in >(`"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" - >products Microsoft.VisualStudio.Product.BuildTools`) do ( >+ call "%ProgramFiles(x86)%\Microsoft Visual >Studio\Installer\vswhere.exe" -products >Microsoft.VisualStudio.Product.BuildTools -version 15,16 > vswhereInfo >+ for /f "usebackq tokens=1* delims=: " %%i in (vswhereInfo) do ( > if /i "%%i"=="installationPath" call > "%%j\VC\Auxiliary\Build\vcvars32.bat" > ) >+ del vswhereInfo > ) else ( >- for /f "usebackq tokens=1* delims=: " %%i in >(`"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe"`) do ( >+ call "%ProgramFiles(x86)%\Microsoft Visual >Studio\Installer\vswhere.exe" -version 15,16 > vswhereInfo >+ 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" ( > if exist "%ProgramFiles%\Microsoft Visual Studio\2017\BuildTools" ( >- for /f "usebackq tokens=1* delims=: " %%i in >(`"%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe" -products >Microsoft.VisualStudio.Product.BuildTools`) do ( >+ call "%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe" - >products Microsoft.VisualStudio.Product.BuildTools -version 15,16 > >vswhereInfo >+ for /f "usebackq tokens=1* delims=: " %%i in (vswhereInfo) do ( > if /i "%%i"=="installationPath" call > "%%j\VC\Auxiliary\Build\vcvars32.bat" > ) >+ del vswhereInfo > ) else ( >- for /f "usebackq tokens=1* delims=: " %%i in >(`"%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe"`) do ( >+ call "%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe" - >version 15,16 > vswhereInfo >+ 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 /I "%1"=="VS2017" goto ToolNotInstall >diff --git a/BaseTools/toolsetup.bat b/BaseTools/toolsetup.bat >index 395694fa09..61ebf4ae09 100755 >--- a/BaseTools/toolsetup.bat >+++ b/BaseTools/toolsetup.bat >@@ -3,7 +3,7 @@ > @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 >-@REM Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR> >+@REM Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR> > @REM (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR> > @REM > @REM SPDX-License-Identifier: BSD-2-Clause-Patent >@@ -42,6 +42,12 @@ if /I "%1"=="/?" goto Usage > set FORCE_REBUILD=TRUE > goto loop > ) >+ if /I "%1"=="VS2019" ( >+ shift >+ set VS2019=TRUE >+ set VSTool=VS2019 >+ goto loop >+ ) > if /I "%1"=="VS2017" ( > shift > set VS2017=TRUE >@@ -176,7 +182,9 @@ IF NOT exist >"%EDK_TOOLS_PATH%\set_vsprefix_envs.bat" ( > @echo. > goto end > ) >-if defined VS2017 ( >+if defined VS2019 ( >+ call %EDK_TOOLS_PATH%\set_vsprefix_envs.bat VS2019 >+) else if defined VS2017 ( > call %EDK_TOOLS_PATH%\set_vsprefix_envs.bat VS2017 > ) else if defined VS2015 ( > call %EDK_TOOLS_PATH%\set_vsprefix_envs.bat VS2015 >@@ -444,7 +452,7 @@ goto end > > :Usage > @echo. >- echo Usage: "%0 [-h | -help | --help | /h | /help | /?] [ Rebuild | >ForceRebuild ] [Reconfig] [base_tools_path [edk_tools_path]] [VS2017] >[VS2015] [VS2013] [VS2012]" >+ echo Usage: "%0 [-h | -help | --help | /h | /help | /?] [ Rebuild | >ForceRebuild ] [Reconfig] [base_tools_path [edk_tools_path]] [VS2019] >[VS2017] [VS2015] [VS2013] [VS2012]" > @echo. > @echo base_tools_path BaseTools project path, BASE_TOOLS_PATH >will be set to this path. > @echo edk_tools_path EDK_TOOLS_PATH will be set to this path. >@@ -457,12 +465,14 @@ goto end > @echo VS2013 Set the env for VS2013 build. > @echo VS2015 Set the env for VS2015 build. > @echo VS2017 Set the env for VS2017 build. >+ @echo VS2019 Set the env for VS2019 build. > @echo. > > :end > set REBUILD= > set FORCE_REBUILD= > set RECONFIG= >+set VS2019= > set VS2017= > set VS2015= > set VS2013= >diff --git a/edksetup.bat b/edksetup.bat >index 5f6028deff..024f57a4b7 100755 >--- a/edksetup.bat >+++ b/edksetup.bat >@@ -1,7 +1,7 @@ > @REM @file > @REM Windows batch file to setup a WORKSPACE environment > @REM >-@REM Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR> >+@REM Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR> > @REM (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR> > @REM SPDX-License-Identifier: BSD-2-Clause-Patent > @REM >@@ -133,6 +133,7 @@ if defined CYGWIN_HOME ( > :cygwin_done > if /I "%1"=="Rebuild" shift > if /I "%1"=="ForceRebuild" shift >+if /I "%1"=="VS2019" shift > if /I "%1"=="VS2017" shift > if /I "%1"=="VS2015" shift > if /I "%1"=="VS2013" shift >@@ -141,7 +142,7 @@ if "%1"=="" goto end > > :Usage > @echo. >- @echo Usage: "%0 [-h | -help | --help | /h | /help | /?] [Reconfig] >[Rebuild] >[ForceRebuild] [VS2017] [VS2015] [VS2013] [VS2012]" >+ @echo Usage: "%0 [-h | -help | --help | /h | /help | /?] [Reconfig] >[Rebuild] >[ForceRebuild] [VS2019] [VS2017] [VS2015] [VS2013] [VS2012]" > @echo. > @echo Reconfig Reinstall target.txt, tools_def.txt and > build_rule.txt. > @echo Rebuild Perform incremental rebuild of BaseTools > binaries. >@@ -150,6 +151,7 @@ if "%1"=="" goto end > @echo VS2013 Set the env for VS2013 build. > @echo VS2015 Set the env for VS2015 build. > @echo VS2017 Set the env for VS2017 build. >+ @echo VS2019 Set the env for VS2019 build. > @echo. > @echo Note that target.template, tools_def.template and >build_rules.template > @echo will only be copied to target.txt, tools_def.txt and build_rule.txt >-- >2.21.0.windows.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#47566): https://edk2.groups.io/g/devel/message/47566 Mute This Topic: https://groups.io/mt/34172666/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-