Imported Upstream version 7.59.0
[platform/upstream/curl.git] / projects / build-wolfssl.bat
index 849357f..e5cf153 100644 (file)
@@ -6,7 +6,7 @@ rem *                             / __| | | | |_) | |
 rem *                            | (__| |_| |  _ <| |___
 rem *                             \___|\___/|_| \_\_____|
 rem *
-rem * Copyright (C) 2012 - 2015, Steve Holme, <steve_holme@hotmail.com>.
+rem * Copyright (C) 2012 - 2018, Steve Holme, <steve_holme@hotmail.com>.
 rem * Copyright (C) 2015, Jay Satiro, <raysatiro@yahoo.com>.
 rem *
 rem * This software is licensed as described in the file COPYING, which
@@ -35,6 +35,16 @@ rem ***************************************************************************
   rem Ensure we have the required arguments
   if /i "%~1" == "" goto syntax
 
+  rem Calculate the program files directory
+  if defined PROGRAMFILES (
+    set "PF=%PROGRAMFILES%"
+    set OS_PLATFORM=x86
+  )
+  if defined PROGRAMFILES(x86) (
+    set "PF=%PROGRAMFILES(x86)%"
+    set OS_PLATFORM=x64
+  )
+
 :parseArgs
   if "%~1" == "" goto prerequisites
 
@@ -58,6 +68,20 @@ rem ***************************************************************************
     set VC_DESC=VC14
     set VC_TOOLSET=v140
     set "VC_PATH=Microsoft Visual Studio 14.0\VC"
+  ) else if /i "%~1" == "vc15" (
+    set VC_VER=15.0
+    set VC_DESC=VC15
+    set VC_TOOLSET=v141
+
+    rem Determine the VC15 path based on the installed edition in decending
+    rem order (Enterprise, then Professional and finally Community)
+    if exist "%PF%\Microsoft Visual Studio\2017\Enterprise\VC" (
+      set "VC_PATH=Microsoft Visual Studio\2017\Enterprise\VC"
+    ) else if exist "%PF%\Microsoft Visual Studio\2017\Professional\VC" (
+      set "VC_PATH=Microsoft Visual Studio\2017\Professional\VC"
+    ) else (
+      set "VC_PATH=Microsoft Visual Studio\2017\Community\VC"
+    )    
   ) else if /i "%~1" == "x86" (
     set BUILD_PLATFORM=x86
   ) else if /i "%~1" == "x64" (
@@ -83,23 +107,12 @@ rem ***************************************************************************
   shift & goto parseArgs
 
 :prerequisites
-  rem Compiler and platform are required parameters.
+  rem Compiler is a required parameter
   if not defined VC_VER goto syntax
-  if not defined BUILD_PLATFORM goto syntax
 
   rem Default the start directory if one isn't specified
   if not defined START_DIR set START_DIR=..\..\wolfssl
 
-  rem Calculate the program files directory
-  if defined PROGRAMFILES (
-    set "PF=%PROGRAMFILES%"
-    set OS_PLATFORM=x86
-  )
-  if defined PROGRAMFILES(x86) (
-    set "PF=%PROGRAMFILES(x86)%"
-    set OS_PLATFORM=x64
-  )
-
   rem Check we have a program files directory
   if not defined PF goto nopf
 
@@ -119,14 +132,21 @@ rem ***************************************************************************
     if "%VC_VER%" == "11.0" set VCVARS_PLATFORM=amd64
     if "%VC_VER%" == "12.0" set VCVARS_PLATFORM=amd64
     if "%VC_VER%" == "14.0" set VCVARS_PLATFORM=amd64
+    if "%VC_VER%" == "15.0" set VCVARS_PLATFORM=amd64
   )
 
 :start
   echo.
-  call "%PF%\%VC_PATH%\vcvarsall" %VCVARS_PLATFORM%
+  set SAVED_PATH=%CD%
+
+  if "%VC_VER%" == "15.0" (
+    call "%PF%\%VC_PATH%\Auxiliary\Build\vcvarsall" %VCVARS_PLATFORM%
+  ) else (
+    call "%PF%\%VC_PATH%\vcvarsall" %VCVARS_PLATFORM%
+  )
 
   echo.
-  set SAVED_PATH=%CD%
+  cd %SAVED_PATH%
   cd %START_DIR%
   goto %BUILD_PLATFORM%
 
@@ -279,7 +299,7 @@ rem ***************************************************************************
 :syntax
   rem Display the help
   echo.
-  echo Usage: build-wolfssl ^<compiler^> ^<platform^> [configuration] [directory]
+  echo Usage: build-wolfssl ^<compiler^> [platform] [configuration] [directory]
   echo.
   echo Compiler:
   echo.
@@ -287,6 +307,7 @@ rem ***************************************************************************
   echo vc11      - Use Visual Studio 2012
   echo vc12      - Use Visual Studio 2013
   echo vc14      - Use Visual Studio 2015
+  echo vc15      - Use Visual Studio 2017
   echo.
   echo Platform:
   echo.