Skip to content

Commit

Permalink
Use "vcvarsall.bat" instead of "VsDevCmd.bat" to avoid some strange p…
Browse files Browse the repository at this point in the history
…roblems.
  • Loading branch information
wangwenx190 committed Dec 5, 2018
1 parent 24d5a60 commit a73c232
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 40 deletions.
8 changes: 3 additions & 5 deletions win-build-llvm.bat
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,9 @@ IF "%_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%
SET _VS_DEV_CMD_PATH=%_VS_2017_PATH%\VC\Auxiliary\Build\vcvarsall.bat
IF NOT EXIST "%_VS_DEV_CMD_PATH%" ECHO Cannot find [vcvarsall.bat], if you did't install VS2017 in it's default location, please change this script && GOTO Fin
CALL "%_VS_DEV_CMD_PATH%" %_TARGET_ARCH%
REM IF NOT EXIST "cmake.exe" ECHO Cannot find cmake, please install it and add it's path to your environment variables && GOTO Fin
IF "%_LLVM_SRC_DIR%" == "" SET _LLVM_SRC_DIR=%~dp0llvm.src
IF "%_LLVM_INST_DIR%" == "" (
Expand Down
8 changes: 3 additions & 5 deletions win-build-mesa.bat
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,9 @@ pip install -U mako
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%
SET _VS_DEV_CMD_PATH=%_VS_2017_PATH%\VC\Auxiliary\Build\vcvarsall.bat
IF NOT EXIST "%_VS_DEV_CMD_PATH%" ECHO Cannot find [vcvarsall.bat], if you did't install VS2017 in it's default location, please change this script && GOTO Fin
CALL "%_VS_DEV_CMD_PATH%" %_TARGET_ARCH%
IF EXIST "%_MESA_SRC_DIR%\win_flex_bison" SET "PATH=%_MESA_SRC_DIR%\win_flex_bison;%PATH%"
IF EXIST "%_MESA_SRC_DIR%\..\win_flex_bison" SET "PATH=%_MESA_SRC_DIR%\..\win_flex_bison;%PATH%"
CD /D %_MESA_SRC_DIR%
Expand Down
8 changes: 3 additions & 5 deletions win-build-openal.bat
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,9 @@ IF "%_BUILD_TYPE%" == "" SET _BUILD_TYPE=dll
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%
SET _VS_DEV_CMD_PATH=%_VS_2017_PATH%\VC\Auxiliary\Build\vcvarsall.bat
IF NOT EXIST "%_VS_DEV_CMD_PATH%" ECHO Cannot find [vcvarsall.bat], if you did't install VS2017 in it's default location, please change this script && GOTO Fin
CALL "%_VS_DEV_CMD_PATH%" %_TARGET_ARCH%
IF "%_OPENAL_SRC_DIR%" == "" SET _OPENAL_SRC_DIR=%~dp0openal-src
IF "%_OPENAL_INST_DIR%" == "" (
IF /I "%_TARGET_ARCH%" == "x64" (
Expand Down
8 changes: 3 additions & 5 deletions win-build-openssl.bat
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,9 @@ IF /I "%_INSTALL_DIR%" == "" SET "_INSTALL_DIR=%~dp0OpenSSL_%_OPENSSL_VERSION%_%
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%
SET _VS_DEV_CMD_PATH=%_VS_2017_PATH%\VC\Auxiliary\Build\vcvarsall.bat
IF NOT EXIST "%_VS_DEV_CMD_PATH%" ECHO Cannot find [vcvarsall.bat], if you did't install VS2017 in it's default location, please change this script && GOTO Fin
CALL "%_VS_DEV_CMD_PATH%" %_TARGET_ARCH%
CD /D "%_SRC_DIR%"
SET "_PLATFORM=VC-WIN64A"
IF /I "%_TARGET_ARCH%" NEQ "x64" SET "_PLATFORM=VC-WIN32"
Expand Down
8 changes: 3 additions & 5 deletions win-build-qt.bat
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,8 @@ REM Intel C++ Compiler(ICC), your only choice is to skip them.
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
SET _VS_DEV_CMD_PATH=%_VS_2017_PATH%\VC\Auxiliary\Build\vcvarsall.bat
IF NOT EXIST "%_VS_DEV_CMD_PATH%" ECHO Cannot find [vcvarsall.bat], if you did't install VS2017 in it's default location, please change this script && GOTO Fin
IF /I "%_QT_COMPILER:~0,9%" == "win32-icc" SET "_VS_DEV_CMD_PATH=%ProgramFiles(x86)%\IntelSWTools\compilers_and_libraries\windows\bin\ipsxe-comp-vars.bat"
IF NOT EXIST "%_VS_DEV_CMD_PATH%" ECHO You are using Intel C++ Compiler, however, this script cannot find [ipsxe-comp-vars.bat], if you didn't install ICC in it's default location, please change this script && GOTO Fin
REM Cross compile example for i686-w64-mingw32-g++(MinGW-w64):
Expand Down Expand Up @@ -168,7 +166,7 @@ IF EXIST "%_BUILD_BAT%" DEL /F /Q "%_BUILD_BAT%"
@ECHO TITLE Building Qt from source code
@ECHO CLS
@ECHO SETLOCAL
IF /I "%_QT_COMPILER:~-3%" NEQ "g++" @ECHO CALL "%_VS_DEV_CMD_PATH%" -no_logo -arch=%_VS_ARCH%
IF /I "%_QT_COMPILER:~-3%" NEQ "g++" @ECHO CALL "%_VS_DEV_CMD_PATH%" %_TARGET_ARCH%
@ECHO SET "PATH=%_ROOT%\qtbase\bin;%_ROOT%\gnuwin32\bin;%%PATH%%"
@ECHO REM SET "_ICU_DIR="
@ECHO REM SET "_OPENSSL_DIR="
Expand Down
21 changes: 6 additions & 15 deletions win-setup-qt-env.bat
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,16 @@ 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 "_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%" (
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%\VC\Auxiliary\Build\vcvarsall.bat
IF NOT EXIST "%_VS_DEV_CMD_PATH%" (
ECHO Cannot find [vcvarsall.bat], if you did't install vs in it's default location, please change this script
PAUSE
EXIT /B
)
CALL "%_VC_BAT_PATH%" %_ARCH%
CALL "%_VS_DEV_CMD_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"
Expand Down

0 comments on commit a73c232

Please sign in to comment.