Skip to content

Commit

Permalink
Fixed a bug.
Browse files Browse the repository at this point in the history
  • Loading branch information
wangwenx190 committed Dec 1, 2018
1 parent cc6efa8 commit 790c587
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions win-setup-qt-env.bat
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,23 @@ 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 "_ARCH=%1"
IF /I "%_ARCH%" == "" SET "_ARCH=x86"
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 VS2017 in it's default location, please change this script && GOTO Fin
SET _VS_ARCH=%_TARGET_ARCH%
IF /I "%_TARGET_ARCH%" == "x64" SET _VS_ARCH=amd64
CALL "%_VS_DEV_CMD_PATH%" -no_logo -arch=%_VS_ARCH%
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
PAUSE
EXIT /B
)
CALL "%_VS_DEV_CMD_PATH%" %_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"
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
IF NOT EXIST "%_QT_DIR%\bin\qmake.exe" (
ECHO [ERROR] Cannot find Qt directory!
PAUSE
Expand All @@ -30,10 +28,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(%_ARCH%) is ready =
ECHO = Qt command line environment(%_TARGET_ARCH%) is ready =
ECHO =====================================================

0 comments on commit 790c587

Please sign in to comment.