From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.43; helo=mga05.intel.com; envelope-from=liming.gao@intel.com; receiver=edk2-devel@lists.01.org Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 335CB21CE740C for ; Wed, 18 Oct 2017 04:00:19 -0700 (PDT) Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga105.fm.intel.com with ESMTP; 18 Oct 2017 04:03:56 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.43,396,1503385200"; d="scan'208";a="161838326" Received: from shwde7172.ccr.corp.intel.com ([10.239.9.14]) by orsmga005.jf.intel.com with ESMTP; 18 Oct 2017 04:03:55 -0700 From: Liming Gao To: edk2-devel@lists.01.org Date: Wed, 18 Oct 2017 18:48:54 +0800 Message-Id: <1508323735-14344-4-git-send-email-liming.gao@intel.com> X-Mailer: git-send-email 2.8.0.windows.1 In-Reply-To: <1508323735-14344-1-git-send-email-liming.gao@intel.com> References: <1508323735-14344-1-git-send-email-liming.gao@intel.com> Subject: [Patch 3/4] BaseTools: Update VS batch file to auto detect VS2017 X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Oct 2017 11:00:19 -0000 This way depends on VS vswhere.exe to find VS2017 installed directory. vswhere.exe starts in Visual Studio 2017 version 15.2. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Liming Gao --- BaseTools/get_vsvars.bat | 8 ++++++++ BaseTools/set_vsprefix_envs.bat | 30 ++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/BaseTools/get_vsvars.bat b/BaseTools/get_vsvars.bat index 7649e1d..ba3e54d 100644 --- a/BaseTools/get_vsvars.bat +++ b/BaseTools/get_vsvars.bat @@ -16,6 +16,12 @@ @echo off goto :main +:set_vsvars +for /f "usebackq tokens=1* delims=: " %%i in (`%*`) do ( + if /i "%%i"=="installationPath" call "%%j\VC\Auxiliary\Build\vcvars32.bat" +) +goto :EOF + :read_vsvars @rem Do nothing if already found, otherwise call vsvars32.bat if there if defined VCINSTALLDIR goto :EOF @@ -33,6 +39,8 @@ REM (Or invoke the relevant vsvars32 file beforehand). :main if defined VCINSTALLDIR goto :done + if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" call :set_vsvars "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" + if exist "%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe" call :set_vsvars "%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe" if defined VS140COMNTOOLS call :read_vsvars "%VS140COMNTOOLS%" if defined VS120COMNTOOLS call :read_vsvars "%VS120COMNTOOLS%" if defined VS110COMNTOOLS call :read_vsvars "%VS110COMNTOOLS%" diff --git a/BaseTools/set_vsprefix_envs.bat b/BaseTools/set_vsprefix_envs.bat index b05b1d2..dbd4e98 100644 --- a/BaseTools/set_vsprefix_envs.bat +++ b/BaseTools/set_vsprefix_envs.bat @@ -90,6 +90,36 @@ if defined VS140COMNTOOLS ( ) ) +@REM set VS2017 +if not defined VS150COMNTOOLS ( + if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" ( + for /f "usebackq tokens=1* delims=: " %%i in (`"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe"`) do ( + if /i "%%i"=="installationPath" call "%%j\VC\Auxiliary\Build\vcvars32.bat" + ) + ) else if exist "%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe" ( + for /f "usebackq tokens=1* delims=: " %%i in (`"%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe"`) do ( + if /i "%%i"=="installationPath" call "%%j\VC\Auxiliary\Build\vcvars32.bat" + ) + ) else ( + goto SetWinDDK + ) +) + +if defined VCToolsInstallDir ( + if not defined VS2017_PREFIX ( + set "VS2017_PREFIX=%VCToolsInstallDir%bin\HostX86\x86" + set "VS2017X64_PREFIX=%VCToolsInstallDir%bin\HostX86\x64" + ) +) +if not defined WINSDK10_PREFIX ( + if exist "%ProgramFiles(x86)%\Windows Kits\10\bin\x86" ( + set "WINSDK10_PREFIX=%ProgramFiles(x86)%\Windows Kits\10\bin\x86" + ) else if exist "%ProgramFiles%\Windows Kits\10\bin\x86" ( + set "WINSDK10_PREFIX=%ProgramFiles%\Windows Kits\10\bin\x86" + ) +) + +:SetWinDDK if not defined WINDDK3790_PREFIX ( set WINDDK3790_PREFIX=C:\WINDDK\3790.1830\bin\ ) -- 2.8.0.windows.1