2013-11-15 19:47:02 +01:00
|
|
|
@echo off
|
|
|
|
:: Copyright (c) 2013 The Chromium Embedded Framework Authors. All rights
|
|
|
|
:: reserved. Use of this source code is governed by a BSD-style license
|
|
|
|
:: that can be found in the LICENSE file.
|
|
|
|
|
|
|
|
:: Set up the environment for use with MSVS tools and then execute whatever
|
|
|
|
:: was specified on the command-line.
|
|
|
|
|
|
|
|
set RC=
|
2018-01-05 19:30:05 +01:00
|
|
|
|
|
|
|
:: Support !! syntax for delayed variable expansion.
|
|
|
|
setlocal enabledelayedexpansion
|
2013-11-15 19:47:02 +01:00
|
|
|
|
2016-05-17 18:48:12 +02:00
|
|
|
:: Require that platform is passed as the first argument.
|
2018-01-05 19:30:05 +01:00
|
|
|
if "%1" == "win32" (
|
2020-02-19 17:33:27 +01:00
|
|
|
set vcvarsbat=vcvars32.bat
|
2018-01-05 19:30:05 +01:00
|
|
|
) else if "%1" == "win64" (
|
2020-02-19 17:33:27 +01:00
|
|
|
set vcvarsbat=vcvars64.bat
|
|
|
|
) else if "%1" == "winarm64" (
|
|
|
|
set vcvarsbat=vcvarsamd64_arm64.bat
|
2018-01-05 19:30:05 +01:00
|
|
|
) else (
|
2020-02-19 17:33:27 +01:00
|
|
|
echo ERROR: Please specify a target platform: win32, win64 or winarm64
|
2016-05-17 18:48:12 +02:00
|
|
|
set ERRORLEVEL=1
|
|
|
|
goto end
|
|
|
|
)
|
|
|
|
|
2018-01-05 19:30:05 +01:00
|
|
|
:: Check if vcvars is already provided via the environment.
|
2013-11-15 19:47:02 +01:00
|
|
|
set vcvars="%CEF_VCVARS%"
|
2016-05-29 03:58:53 +02:00
|
|
|
if %vcvars% == "none" goto found_vcvars
|
2017-11-01 21:24:16 +01:00
|
|
|
if exist %vcvars% goto found_vcvars
|
|
|
|
|
2018-01-05 19:30:05 +01:00
|
|
|
:: Search for the default VS2017 installation path.
|
|
|
|
for %%x in ("%PROGRAMFILES(X86)%" "%PROGRAMFILES%") do (
|
2018-11-15 21:24:37 +01:00
|
|
|
for %%y in (Professional Enterprise Community BuildTools) do (
|
2020-02-19 17:33:27 +01:00
|
|
|
set vcvars="%%~x\Microsoft Visual Studio\2017\%%y\VC\Auxiliary\Build\%vcvarsbat%"
|
2018-01-05 19:30:05 +01:00
|
|
|
if exist !vcvars! goto found_vcvars
|
|
|
|
)
|
|
|
|
)
|
2013-11-15 19:47:02 +01:00
|
|
|
|
2016-05-17 18:48:12 +02:00
|
|
|
echo ERROR: Failed to find vcvars
|
|
|
|
set ERRORLEVEL=1
|
2013-11-15 19:47:02 +01:00
|
|
|
goto end
|
|
|
|
|
|
|
|
:found_vcvars
|
|
|
|
echo vcvars:
|
|
|
|
echo %vcvars%
|
2018-01-05 19:30:05 +01:00
|
|
|
|
|
|
|
if not %vcvars% == "none" (
|
|
|
|
:: Set this variable to keep VS2017 < 15.5 from changing the current working directory.
|
|
|
|
set "VSCMD_START_DIR=%CD%"
|
|
|
|
call %vcvars%
|
|
|
|
)
|
2013-11-15 19:47:02 +01:00
|
|
|
|
|
|
|
echo PATH:
|
|
|
|
echo %PATH%
|
2016-05-17 18:48:12 +02:00
|
|
|
|
|
|
|
:: Remove the first argument and execute the command.
|
|
|
|
for /f "tokens=1,* delims= " %%a in ("%*") do set ALL_BUT_FIRST=%%b
|
|
|
|
echo command:
|
|
|
|
echo %ALL_BUT_FIRST%
|
|
|
|
%ALL_BUT_FIRST%
|
2013-11-15 19:47:02 +01:00
|
|
|
|
|
|
|
:end
|
|
|
|
endlocal & set RC=%ERRORLEVEL%
|
|
|
|
goto omega
|
|
|
|
|
|
|
|
:returncode
|
|
|
|
exit /B %RC%
|
|
|
|
|
|
|
|
:omega
|
|
|
|
call :returncode %RC%
|