ソースを参照

Updates hctbuild to better handle VS2017 (#212)

Defaults to VS2017 if VS2015 isn't available.
Avoids using the VS2015 tools when VS2017 is selected.
Marcelo Lopez Ruiz 8 年 前
コミット
76d518d57d
1 ファイル変更19 行追加2 行削除
  1. 19 2
      utils/hct/hctbuild.cmd

+ 19 - 2
utils/hct/hctbuild.cmd

@@ -41,6 +41,7 @@ if "%BUILD_ARCH%"=="" (
 )
 
 set BUILD_GENERATOR=Visual Studio 14 2015
+set BUILD_VS_VER=2015
 set BUILD_CONFIG=Debug
 set DO_SETUP=1
 set DO_BUILD=1
@@ -98,9 +99,20 @@ if "%1"=="-Release" (
 )
 if "%1"=="-vs2017" (
   set BUILD_GENERATOR=Visual Studio 15 2017
+  set BUILD_VS_VER=2017
   shift /1
 )
 
+rem If only VS 2017 is available, pick that by default.
+if "%BUILD_VS_VER%"=="2015" (
+  reg query HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\DevDiv\vs\Servicing\14.0\devenv /v Install /reg:32 1>nul 2>nul
+  if errorlevel 1 (
+    echo Visual Studio 2015 not available, setting up build for Visual Studio 2017.
+    set BUILD_GENERATOR=Visual Studio 15 2017
+    set BUILD_VS_VER=2017
+  )
+)
+
 if "%BUILD_ARCH%"=="x64" (
   set BUILD_GENERATOR=%BUILD_GENERATOR% %BUILD_ARCH:x64=Win64%
 )
@@ -225,9 +237,14 @@ if "%DO_SETUP%"=="1" (
 if "%DO_BUILD%"=="1" (
   rem Should add support for the non-x86-qualified programfiles.
   echo Building solution files for %2 with %1 configuration.
-  if exist "%ProgramFiles(x86)%\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" (
-    call :buildvs_x86dir %1 %2 %3
+  if "%BUILD_VS_VER%"=="2015" (
+    if exist "%ProgramFiles(x86)%\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" (
+      call :buildvs_x86dir %1 %2 %3
+    ) else (
+      cmake --build . --config %1
+    )
   ) else (
+    rem Just defer to cmake for now.
     cmake --build . --config %1
   )
   if errorlevel 1 (