From a73c2326cc390fa0d6837ee6c26e88e48f2fbb47 Mon Sep 17 00:00:00 2001 From: wangwenx190 <2546789017@qq.com> Date: Wed, 5 Dec 2018 19:24:38 +0800 Subject: [PATCH] Use "vcvarsall.bat" instead of "VsDevCmd.bat" to avoid some strange problems. --- win-build-llvm.bat | 8 +++----- win-build-mesa.bat | 8 +++----- win-build-openal.bat | 8 +++----- win-build-openssl.bat | 8 +++----- win-build-qt.bat | 8 +++----- win-setup-qt-env.bat | 21 ++++++--------------- 6 files changed, 21 insertions(+), 40 deletions(-) diff --git a/win-build-llvm.bat b/win-build-llvm.bat index 6f4fa75..e1640f0 100644 --- a/win-build-llvm.bat +++ b/win-build-llvm.bat @@ -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%" == "" ( diff --git a/win-build-mesa.bat b/win-build-mesa.bat index 1bbe217..af4cb2d 100644 --- a/win-build-mesa.bat +++ b/win-build-mesa.bat @@ -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% diff --git a/win-build-openal.bat b/win-build-openal.bat index a7cae25..94fe3f8 100644 --- a/win-build-openal.bat +++ b/win-build-openal.bat @@ -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" ( diff --git a/win-build-openssl.bat b/win-build-openssl.bat index 26228da..7aba6fd 100644 --- a/win-build-openssl.bat +++ b/win-build-openssl.bat @@ -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" diff --git a/win-build-qt.bat b/win-build-qt.bat index 04d0d43..1ed69a8 100644 --- a/win-build-qt.bat +++ b/win-build-qt.bat @@ -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): @@ -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=" diff --git a/win-setup-qt-env.bat b/win-setup-qt-env.bat index 1d82efb..c79183b 100644 --- a/win-setup-qt-env.bat +++ b/win-setup-qt-env.bat @@ -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"