diff options
author | Ray Molenkamp <github@lazydodo.com> | 2018-05-26 02:57:13 +0300 |
---|---|---|
committer | Ray Molenkamp <github@lazydodo.com> | 2018-05-26 02:57:13 +0300 |
commit | 857e4e04d89f30727d60e16c7320a72718a76d1a (patch) | |
tree | 2c490024ab773024ae33ccca2b9e31c6e6875be6 /build_files/windows/detect_msvc_classic.cmd | |
parent | 4dee702332abee23086dc0d26e79f014a27a3bb3 (diff) |
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.
Diffstat (limited to 'build_files/windows/detect_msvc_classic.cmd')
-rw-r--r-- | build_files/windows/detect_msvc_classic.cmd | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/build_files/windows/detect_msvc_classic.cmd b/build_files/windows/detect_msvc_classic.cmd new file mode 100644 index 00000000000..61bfcf92ddf --- /dev/null +++ b/build_files/windows/detect_msvc_classic.cmd @@ -0,0 +1,69 @@ +if NOT "%verbose%" == "" ( + echo Detecting msvc %BUILD_VS_YEAR% +) +set KEY_NAME="HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\%BUILD_VS_VER%.0\Setup\VC" +for /F "usebackq skip=2 tokens=1-2*" %%A IN (`REG QUERY %KEY_NAME% /v ProductDir 2^>nul`) DO set MSVC_VC_DIR=%%C +if DEFINED MSVC_VC_DIR ( + if NOT "%verbose%" == "" ( + echo Visual Studio %BUILD_VS_YEAR% on Win64 detected at "%MSVC_VC_DIR%" + ) + goto msvc_detect_finally +) + +REM Check 32 bits +set KEY_NAME="HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\%BUILD_VS_VER%.0\Setup\VC" +for /F "usebackq skip=2 tokens=1-2*" %%A IN (`REG QUERY %KEY_NAME% /v ProductDir 2^>nul`) DO set MSVC_VC_DIR=%%C +if DEFINED MSVC_VC_DIR ( + if NOT "%verbose%" == "" ( + echo Visual Studio %BUILD_VS_YEAR% on Win32 detected at "%MSVC_VC_DIR%" + ) + goto msvc_detect_finally +) +if NOT "%verbose%" == "" ( + echo Visual Studio %BUILD_VS_YEAR% not found. +) +goto FAIL +:msvc_detect_finally +set VCVARS=%MSVC_VC_DIR%\vcvarsall.bat +if not exist "%VCVARS%" ( + echo "%VCVARS%" not found. + goto FAIL +) + +call "%vcvars%" %BUILD_ARCH% + +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 +) +goto DetectionComplete + +:FAIL +exit /b 1 + +:DetectionComplete +if NOT "%verbose%" == "" ( + echo Visual Studio %BUILD_VS_YEAR% Detected successfuly +) +exit /b 0 |