2014-07-01 09:10:10 +02:00
|
|
|
@REM @file
|
|
|
|
@REM Windows batch file to find the Visual Studio set up script
|
|
|
|
@REM
|
|
|
|
@REM Copyright (c) 2013-2014, ARM Limited. All rights reserved.
|
|
|
|
|
2019-04-04 01:03:11 +02:00
|
|
|
@REM SPDX-License-Identifier: BSD-2-Clause-Patent
|
2014-07-01 09:10:10 +02:00
|
|
|
@REM
|
|
|
|
|
|
|
|
|
|
|
|
@echo off
|
2019-06-12 05:28:46 +02:00
|
|
|
set SCRIPT_ERROR=0
|
|
|
|
if "%1"=="" goto main
|
|
|
|
if /I "%1"=="VS2017" goto VS2017Vars
|
|
|
|
if /I "%1"=="VS2015" goto VS2015Vars
|
|
|
|
if /I "%1"=="VS2013" goto VS2013Vars
|
|
|
|
if /I "%1"=="VS2012" goto VS2012Vars
|
2014-07-01 09:10:10 +02:00
|
|
|
|
2017-11-22 17:26:09 +01:00
|
|
|
:set_vsvars
|
|
|
|
for /f "usebackq tokens=1* delims=: " %%i in (`%*`) do (
|
|
|
|
if /i "%%i"=="installationPath" call "%%j\VC\Auxiliary\Build\vcvars32.bat"
|
|
|
|
)
|
|
|
|
goto :EOF
|
|
|
|
|
2014-07-01 09:10:10 +02:00
|
|
|
:read_vsvars
|
|
|
|
@rem Do nothing if already found, otherwise call vsvars32.bat if there
|
|
|
|
if defined VCINSTALLDIR goto :EOF
|
|
|
|
set GET_VSVARS_BAT_CHECK_DIR=%*
|
|
|
|
set GET_VSVARS_BAT_CHECK_DIR=%GET_VSVARS_BAT_CHECK_DIR:"=%
|
|
|
|
if exist "%GET_VSVARS_BAT_CHECK_DIR%\vsvars32.bat" call "%GET_VSVARS_BAT_CHECK_DIR%\vsvars32.bat"
|
|
|
|
:vsvars_done
|
|
|
|
goto :EOF
|
|
|
|
|
|
|
|
|
2019-06-12 05:28:46 +02:00
|
|
|
:ToolNotInstall
|
|
|
|
set SCRIPT_ERROR=1
|
|
|
|
goto :EOF
|
|
|
|
|
2014-07-01 09:10:10 +02:00
|
|
|
REM NOTE: This file will find the most recent Visual Studio installation
|
|
|
|
REM apparent from the environment.
|
|
|
|
REM To use an older version, modify your environment set up.
|
|
|
|
REM (Or invoke the relevant vsvars32 file beforehand).
|
|
|
|
|
|
|
|
:main
|
|
|
|
if defined VCINSTALLDIR goto :done
|
2019-06-12 05:28:46 +02:00
|
|
|
: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
|
|
|
|
) else (
|
|
|
|
call :set_vsvars "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe"
|
|
|
|
)
|
|
|
|
)
|
|
|
|
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
|
|
|
|
) else (
|
|
|
|
call :set_vsvars "%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe"
|
|
|
|
)
|
|
|
|
)
|
|
|
|
if /I "%1"=="VS2017" goto ToolNotInstall
|
|
|
|
|
|
|
|
:VS2015Vars
|
|
|
|
if defined VS140COMNTOOLS (call :read_vsvars "%VS140COMNTOOLS%") else (if /I "%1"=="VS2015" goto ToolNotInstall)
|
|
|
|
|
|
|
|
:VS2013Vars
|
|
|
|
if defined VS120COMNTOOLS ( call :read_vsvars "%VS120COMNTOOLS%") else (if /I "%1"=="VS2013" goto ToolNotInstall)
|
|
|
|
|
|
|
|
:VS2012Vars
|
|
|
|
if defined VS110COMNTOOLS (call :read_vsvars "%VS110COMNTOOLS%") else (if /I "%1"=="VS2012" goto ToolNotInstall)
|
|
|
|
|
2014-07-01 09:10:10 +02:00
|
|
|
if defined VS100COMNTOOLS call :read_vsvars "%VS100COMNTOOLS%"
|
|
|
|
if defined VS90COMNTOOLS call :read_vsvars "%VS90COMNTOOLS%"
|
|
|
|
if defined VS80COMNTOOLS call :read_vsvars "%VS80COMNTOOLS%"
|
|
|
|
if defined VS71COMNTOOLS call :read_vsvars "%VS71COMNTOOLS%"
|
|
|
|
|
|
|
|
:done
|
|
|
|
set GET_VSVARS_BAT_CHECK_DIR=
|