11@ echo off
22@ setlocal EnableDelayedExpansion
33
4- if NOT DEFINED MSVC_VERSION set MSVC_VERSION = 14
4+ REM ------Set Your Environment-------------------------------
5+ if NOT DEFINED MSVC_VERSION set MSVC_VERSION = 15
56if NOT DEFINED CMAKE_CONFIG set CMAKE_CONFIG = Release
67if NOT DEFINED PYTHONHOME set PYTHONHOME = C:/Users/%username% /Anaconda3
8+ REM ---------------------------------------------------------
9+
10+ set KEY_NAME = " HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\VisualStudio\SxS\VS7"
11+ set VALUE_NAME = 15.0
712
813if " %MSVC_VERSION% " == " 14" (
914 if " %processor_architecture% " == " AMD64" (
@@ -14,13 +19,23 @@ if "%MSVC_VERSION%"=="14" (
1419) else if " %MSVC_VERSION% " == " 12" (
1520 if " %processor_architecture% " == " AMD64" (
1621 set CMAKE_GENERATOR = Visual Studio 12 2013 Win64
17-
1822 ) else (
1923 set CMAKE_GENERATOR = Visual Studio 12 2013
2024 )
25+ ) else if " %MSVC_VERSION% " == " 15" (
26+ if " %processor_architecture% " == " AMD64" (
27+ set CMAKE_GENERATOR = Visual Studio 15 2017 Win64
28+ ) else (
29+ set CMAKE_GENERATOR = Visual Studio 15 2017
30+ )
31+ )
32+ if " %MSVC_VERSION% " == " 15" (
33+ for /F " usebackq tokens=1,2,*" %%A in (`REG QUERY %KEY_NAME% /v %VALUE_NAME% `) do (
34+ set batch_file = %%C VC\Auxiliary\Build\vcvarsall.bat
35+ )
36+ ) else (
37+ set batch_file = !VS%MSVC_VERSION%0COMNTOOLS! ..\..\VC\vcvarsall.bat
2138)
22-
23- set batch_file = !VS%MSVC_VERSION%0COMNTOOLS! ..\..\VC\vcvarsall.bat
2439call " %batch_file% " %processor_architecture%
2540
2641pushd ..
0 commit comments