set __sourceDir=%~dp0
set __ExtraCmakeParams=
-:: VS 2015 is the minimum supported toolset
-if "%__VSVersion%" == "vs2017" (
- set __VSString=15 2017
+:: VS 2017 is the minimum supported toolset
+if "%__VSVersion%" == "vs2019" (
+ set __VSString=16 2019
) else (
- set __VSString=14 2015
+ set __VSString=15 2017
)
:: Set the target architecture to a format cmake understands. ANYCPU defaults to x64
echo "Usage..."
echo "gen-buildsys-win.bat <path to top level CMakeLists.txt> <VSVersion> <Target Architecture>"
echo "Specify the path to the top level CMake file"
- echo "Specify the VSVersion to be used - VS2015 or VS2017"
+ echo "Specify the VSVersion to be used - VS2017 or VS2019"
echo "Specify the Target Architecture - AnyCPU, x86, x64, ARM, or ARM64."
EXIT /B 1
:ToolsVersion
:: Default to highest Visual Studio version available
::
-:: For VS2015 (and prior), only a single instance is allowed to be installed on a box
-:: and VS140COMNTOOLS is set as a global environment variable by the installer. This
-:: allows users to locate where the instance of VS2015 is installed.
-::
-:: For VS2017 and later, multiple instances can be installed on the same box SxS and VSxxxCOMNTOOLS
-:: is no longer set as a global environment variable and is instead only set if the user
+:: For VS2017 and later, multiple instances can be installed on the same box SxS and VSxxxCOMNTOOLS is only set if the user
:: has launched the VS2017 or VS2019 Developer Command Prompt.
::
:: Following this logic, we will default to the VS2017 or VS2019 toolset if VS150COMNTOOLS or VS160COMMONTOOLS tools is
:: set, as this indicates the user is running from the VS2017 or VS2019 Developer Command Prompt and
-:: is already configured to use that toolset. Otherwise, we will fallback to using the VS2015
-:: toolset if it is installed. Finally, we will fail the script if no supported VS instance
-:: can be found.
+:: is already configured to use that toolset. Otherwise, we will fail the script if no supported VS instance can be found.
if defined VisualStudioVersion goto :RunVCVars
if exist %_VSWHERE% (
for /f "usebackq tokens=*" %%i in (`%_VSWHERE% -latest -prerelease -property installationPath`) do set _VSCOMNTOOLS=%%i\Common7\Tools
)
-if not exist "%_VSCOMNTOOLS%" set _VSCOMNTOOLS=%VS140COMNTOOLS%
if not exist "%_VSCOMNTOOLS%" goto :MissingVersion
call "%_VSCOMNTOOLS%\VsDevCmd.bat"
goto :VS2019
) else if "%VisualStudioVersion%"=="15.0" (
goto :VS2017
-) else if "%VisualStudioVersion%"=="14.0" (
- goto :VS2015
)
:MissingVersion
-:: Can't find VS 2015, 2017, 2019
-echo Error: Visual Studio 2015, 2017 or 2019 required
+:: Can't find VS 2017, 2019
+echo Error: Visual Studio 2017 or 2019 required
echo Please see https://github.com/dotnet/corefx/tree/master/Documentation for build instructions.
exit /b 1
call "%VS150COMNTOOLS%..\..\VC\Auxiliary\Build\vcvarsall.bat" %__VCBuildArch%
goto :SetupDirs
-:VS2015
-:: Setup vars for VS2015
-set __VSVersion=vs2015
-set __PlatformToolset=v140
-:: Set the environment for the native build
-call "%VS140COMNTOOLS%..\..\VC\vcvarsall.bat" %__VCBuildArch%
-goto :SetupDirs
-
:SetupDirs
:: Setup to cmake the native components
echo Commencing build of native components