From cc6efa84e5021092bcae3d071231eaadb59fd1b0 Mon Sep 17 00:00:00 2001 From: wangwenx190 <2546789017@qq.com> Date: Sat, 1 Dec 2018 15:24:56 +0800 Subject: [PATCH] Update. --- win-build-llvm.bat | 23 ++++++++--------------- win-build-mesa.bat | 23 ++++++++--------------- win-build-openal.bat | 24 ++++++++---------------- win-build-openssl.bat | 23 ++++++++--------------- win-build-qt.bat | 29 +++++++++++------------------ win-setup-qt-env.bat | 27 +++++++++++---------------- 6 files changed, 54 insertions(+), 95 deletions(-) diff --git a/win-build-llvm.bat b/win-build-llvm.bat index ef7b7c6..6f4fa75 100644 --- a/win-build-llvm.bat +++ b/win-build-llvm.bat @@ -7,21 +7,14 @@ SET _TARGET_ARCH=%1 SET _LLVM_SRC_DIR=%2 SET _LLVM_INST_DIR=%3 IF "%_TARGET_ARCH%" == "" SET _TARGET_ARCH=x64 -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 && GOTO Fin -CALL "%_VC_BAT_PATH%" %_TARGET_ARCH% +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% 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 816894b..1bbe217 100644 --- a/win-build-mesa.bat +++ b/win-build-mesa.bat @@ -15,21 +15,14 @@ pip install -U setuptools pip install -U wheel pip install -U scons pip install -U mako -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 && GOTO Fin -CALL "%_VC_BAT_PATH%" %_TARGET_ARCH% +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 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 b895162..a7cae25 100644 --- a/win-build-openal.bat +++ b/win-build-openal.bat @@ -13,22 +13,14 @@ SET _OPENAL_SRC_DIR=%3 SET _OPENAL_INST_DIR=%4 IF "%_TARGET_ARCH%" == "" SET _TARGET_ARCH=x64 IF "%_BUILD_TYPE%" == "" SET _BUILD_TYPE=dll -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 && GOTO Fin -CALL "%_VC_BAT_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 +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 "%_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 77c8ab2..26228da 100644 --- a/win-build-openssl.bat +++ b/win-build-openssl.bat @@ -16,21 +16,14 @@ IF /I "%_BUILD_TYPE%" == "" SET "_BUILD_TYPE=dll" IF /I "%_COMP_MODE%" == "" SET "_COMP_MODE=release" IF /I "%_SRC_DIR%" == "" SET "_SRC_DIR=%~dp0src" IF /I "%_INSTALL_DIR%" == "" SET "_INSTALL_DIR=%~dp0OpenSSL_%_OPENSSL_VERSION%_%_BUILD_TYPE%_%_COMP_MODE%_%_TARGET_ARCH%" -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 && GOTO Fin -CALL "%_VC_BAT_PATH%" %_TARGET_ARCH% +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% 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 ca2f41e..eba307f 100644 --- a/win-build-qt.bat +++ b/win-build-qt.bat @@ -56,22 +56,15 @@ REM Using the latest MSVC compiler on Windows platform is the best choice, REM you will finish the compilation with no errors and warnings. REM You may fail to compile some repositories if you are using REM Intel C++ Compiler(ICC), your only choice is to skip them. -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 && GOTO Fin -IF /I "%_QT_COMPILER:~0,9%" == "win32-icc" SET "_VC_BAT_PATH=%ProgramFiles(x86)%\IntelSWTools\compilers_and_libraries\windows\bin\ipsxe-comp-vars.bat" -IF NOT EXIST "%_VC_BAT_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 +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 +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): REM configure -xplatform win32-g++ -device-option CROSS_COMPILE=i686-w64-mingw32- REM It means you should use "-xplatform" instead of "-platform" and @@ -138,7 +131,7 @@ ECHO Compiler: %_QT_COMPILER% ECHO Target architecture: %_TARGET_ARCH% ECHO Source code directory: %_ROOT% ECHO Install directory: %_INSTALL_DIR% -IF /I "%_QT_COMPILER:~-3%" NEQ "g++" ECHO Compiler batch script: %_VC_BAT_PATH% +IF /I "%_QT_COMPILER:~-3%" NEQ "g++" ECHO Compiler batch script: %_VS_DEV_CMD_PATH% ECHO Build tool: %_MAKE_TOOL% ECHO Qt configuration parameters: %_CFG_PARAMS% ECHO --------------------------------------- @@ -175,7 +168,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 "%_VC_BAT_PATH%" %_TARGET_ARCH% + IF /I "%_QT_COMPILER:~-3%" NEQ "g++" @ECHO CALL "%_VS_DEV_CMD_PATH%" %_VS_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..7a8d832 100644 --- a/win-setup-qt-env.bat +++ b/win-setup-qt-env.bat @@ -5,25 +5,20 @@ 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%" ( - ECHO Cannot find [vcvarsall.bat], if you did't install vs in it's default location, please change this script +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 "%_VC_BAT_PATH%" %_ARCH% +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"