From 857e4e04d89f30727d60e16c7320a72718a76d1a Mon Sep 17 00:00:00 2001 From: Ray Molenkamp Date: Fri, 25 May 2018 17:57:13 -0600 Subject: make.bat: refactor make.bat make.bat was starting to become hard to maintain, this refactors it into separate batch files for each stage of the process. -Improved detection of msvc2013/2015 -Improved failure handling. -Added check for working msbuild and C++ compiler -Added verbose switch to ease trouble shooting. -Added Check if svn/cmake/git are in the path before using them -Display the build configuration before asking to download the libraries -Offer an option to recover an interrupted checkout of the libraries. -Automatically check out sub-modules in-case they are missing. --- build_files/windows/detect_msvc2017.cmd | 70 +++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 build_files/windows/detect_msvc2017.cmd (limited to 'build_files/windows/detect_msvc2017.cmd') diff --git a/build_files/windows/detect_msvc2017.cmd b/build_files/windows/detect_msvc2017.cmd new file mode 100644 index 00000000000..6a82adb5a4d --- /dev/null +++ b/build_files/windows/detect_msvc2017.cmd @@ -0,0 +1,70 @@ +if NOT "%verbose%" == "" ( + echo Detecting msvc 2017 +) +set BUILD_VS_VER=15 +set ProgramFilesX86=%ProgramFiles(x86)% +if not exist "%ProgramFilesX86%" set ProgramFilesX86=%ProgramFiles% + +set vs_where=%ProgramFilesX86%\Microsoft Visual Studio\Installer\vswhere.exe +if not exist "%vs_where%" ( + if NOT "%verbose%" == "" ( + echo Visual Studio 2017 ^(15.2 or newer^) is not detected + goto FAIL + ) +) +for /f "usebackq tokens=1* delims=: " %%i in (`"%vs_where%" -latest %VSWHERE_ARGS% -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64`) do ( + if /i "%%i"=="installationPath" set VS_InstallDir=%%j +) + +if "%VS_InstallDir%"=="" ( + if NOT "%verbose%" == "" ( + echo Visual Studio is detected but the "Desktop development with C++" workload has not been instlled + goto FAIL + ) +) + +set VCVARS=%VS_InstallDir%\VC\Auxiliary\Build\vcvarsall.bat +if exist "%VCVARS%" ( + call "%VCVARS%" %BUILD_ARCH% +) else ( + if NOT "%verbose%" == "" ( + echo "%VCVARS%" not found + ) + goto FAIL +) + +rem try msbuild +msbuild /version > NUL +if errorlevel 1 ( + if NOT "%verbose%" == "" ( + echo Visual Studio %BUILD_VS_YEAR% msbuild not found + ) + goto FAIL +) + +if NOT "%verbose%" == "" ( + echo Visual Studio %BUILD_VS_YEAR% msbuild found +) + +REM try the c++ compiler +cl 2> NUL 1>&2 +if errorlevel 1 ( + if NOT "%verbose%" == "" ( + echo Visual Studio %BUILD_VS_YEAR% C/C++ Compiler not found + ) + goto FAIL +) + +if NOT "%verbose%" == "" ( + echo Visual Studio %BUILD_VS_YEAR% C/C++ Compiler found +) + +if NOT "%verbose%" == "" ( + echo Visual Studio 2017 is detected successfully +) +goto EOF + +:FAIL +exit /b 1 + +:EOF -- cgit v1.2.3