Skip to content

Commit

Permalink
Revert changes of win-setup-qt-env.bat due to unknown error occurs.
Browse files Browse the repository at this point in the history
  • Loading branch information
wangwenx190 committed Dec 1, 2018
1 parent 790c587 commit 91952ab
Showing 1 changed file with 23 additions and 16 deletions.
39 changes: 23 additions & 16 deletions win-setup-qt-env.bat
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,30 @@ TITLE Qt command line environment
CLS
REM Usage: %comspec% /k "path_of_this_file" arch
REM Eg: %comspec% /k "C:\Qt\Qt5.12.0\5.12.0\msvc2017\win-setup-qt-env.bat" x64
SET _TARGET_ARCH=%1
IF /I "%_TARGET_ARCH%" == "" SET _TARGET_ARCH=x64
SET _VS_DEV_CMD_PATH=
SET _VS_2017_PATH=
FOR /f "delims=" %%A IN ('"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -property installationPath -latest -requires Microsoft.Component.MSBuild Microsoft.VisualStudio.Component.VC.Tools.x86.x64') DO SET _VS_2017_PATH=%%A
SET _VS_DEV_CMD_PATH=%_VS_2017_PATH%\Common7\Tools\VsDevCmd.bat
IF NOT EXIST "%_VS_DEV_CMD_PATH%" (
ECHO Cannot find [VsDevCmd.bat], if you did't install vs in it's default location, please change this script
SET "_ARCH=%1"
IF /I "%_ARCH%" == "" SET "_ARCH=x86"
SET "_VC_BAT_PATH=%VS2017INSTALLDIR%\VC\Auxiliary\Build\vcvarsall.bat"
IF NOT EXIST "%_VC_BAT_PATH%" SET "_VC_BAT_PATH=%ProgramFiles(x86)%\Microsoft Visual Studio\Preview\Enterprise\VC\Auxiliary\Build\vcvarsall.bat"
IF NOT EXIST "%_VC_BAT_PATH%" SET "_VC_BAT_PATH=%ProgramFiles(x86)%\Microsoft Visual Studio\Preview\Professional\VC\Auxiliary\Build\vcvarsall.bat"
IF NOT EXIST "%_VC_BAT_PATH%" SET "_VC_BAT_PATH=%ProgramFiles(x86)%\Microsoft Visual Studio\Preview\Community\VC\Auxiliary\Build\vcvarsall.bat"
IF NOT EXIST "%_VC_BAT_PATH%" SET "_VC_BAT_PATH=%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat"
IF NOT EXIST "%_VC_BAT_PATH%" SET "_VC_BAT_PATH=%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Professional\VC\Auxiliary\Build\vcvarsall.bat"
IF NOT EXIST "%_VC_BAT_PATH%" SET "_VC_BAT_PATH=%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat"
IF NOT EXIST "%_VC_BAT_PATH%" SET "_VC_BAT_PATH=%ProgramFiles(x86)%\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliary\Build\vcvarsall.bat"
REM IF NOT EXIST "%_VC_BAT_PATH%" SET "_VC_BAT_PATH=%ProgramFiles(x86)%\Microsoft Visual Studio 14.0\VC\vcvarsall.bat"
REM IF NOT EXIST "%_VC_BAT_PATH%" SET "_VC_BAT_PATH=%ProgramFiles(x86)%\Microsoft Visual Studio\Shared\14.0\VC\vcvarsall.bat"
IF NOT EXIST "%_VC_BAT_PATH%" SET "_VC_BAT_PATH=%VS140COMNTOOLS%..\..\VC\vcvarsall.bat"
IF NOT EXIST "%_VC_BAT_PATH%" SET "_VC_BAT_PATH=%VCINSTALLDIR%\vcvarsall.bat"
IF NOT EXIST "%_VC_BAT_PATH%" SET _VC_BAT_PATH=
IF NOT EXIST "%_VC_BAT_PATH%" (
ECHO Cannot find [vcvarsall.bat], if you did't install vs in it's default location, please change this script
PAUSE
EXIT /B
)
SET _VS_ARCH=%_TARGET_ARCH%
IF /I "%_TARGET_ARCH%" == "x64" SET _VS_ARCH=amd64
CALL "%_VS_DEV_CMD_PATH%" -no_logo -arch=%_VS_ARCH%
SET _QT_DIR=%~dp0
IF NOT EXIST "%_QT_DIR%bin\qmake.exe" SET _QT_DIR=%~dp0..
IF NOT EXIST "%_QT_DIR%\bin\qmake.exe" SET _QT_DIR=%2
CALL "%_VC_BAT_PATH%" %_ARCH%
SET "_QT_DIR=%~dp0"
IF NOT EXIST "%_QT_DIR%bin\qmake.exe" SET "_QT_DIR=%~dp0.."
IF NOT EXIST "%_QT_DIR%\bin\qmake.exe" SET "_QT_DIR=%2"
IF NOT EXIST "%_QT_DIR%\bin\qmake.exe" (
ECHO [ERROR] Cannot find Qt directory!
PAUSE
Expand All @@ -28,10 +35,10 @@ IF NOT EXIST "%_QT_DIR%\bin\qmake.exe" (
IF EXIST "%_QT_DIR%\bin\qtenv2.bat" (
CALL "%_QT_DIR%\bin\qtenv2.bat"
) ELSE (
SET PATH=%_QT_DIR%\bin;%_QT_DIR%;%PATH%
SET "PATH=%_QT_DIR%\bin;%_QT_DIR%;%PATH%"
)
CD /D "%_QT_DIR%"
CLS
ECHO =====================================================
ECHO = Qt command line environment(%_TARGET_ARCH%) is ready =
ECHO = Qt command line environment(%_ARCH%) is ready =
ECHO =====================================================

0 comments on commit 91952ab

Please sign in to comment.