Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

Support building with VS2019 Preview #22525

Merged
merged 4 commits into from
Feb 12, 2019
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Documentation/building/windows-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ You must install several components to build the CoreCLR and CoreFX repos. These
Visual Studio must be installed. Supported versions:
- [Visual Studio 2015](https://www.visualstudio.com/vs/older-downloads/) (Community, Professional, Enterprise). The community version is completely free.
- [Visual Studio 2017](https://www.visualstudio.com/downloads/) (Community, Professional, Enterprise). The community version is completely free.
- [Visual Studio 2019 Preview](https://visualstudio.microsoft.com/vs/preview/) (Community, Professional, Enterprise). The community version is completely free.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The exact workloads required should probably be figured out. It might be worth updating the VS2017 entries as well (as it specifies more than actually required in the latest release).

Copy link

@TylerBrinkley TylerBrinkley Mar 13, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should have been noted that the CMake version needs to be 3.14-rc for VS 2019.


For Visual Studio 2015:
tannergooding marked this conversation as resolved.
Show resolved Hide resolved
* Ensure you have installed at least [Visual Studio 2015 Update 3](https://www.visualstudio.com/en-us/news/releasenotes/vs2015-update3-vs).
Expand Down
8 changes: 6 additions & 2 deletions build-test.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ set __ThisScriptDir="%~dp0"
call "%__ThisScriptDir%"\setup_vs_tools.cmd
if NOT '%ERRORLEVEL%' == '0' exit /b 1

if defined VS150COMNTOOLS (
if defined VS160COMNTOOLS (
set "__VSToolsRoot=%VS160COMNTOOLS%"
set "__VCToolsRoot=%VS160COMNTOOLS%\..\..\VC\Auxiliary\Build"
set __VSVersion=vs2019
) else if defined VS150COMNTOOLS (
set "__VSToolsRoot=%VS150COMNTOOLS%"
set "__VCToolsRoot=%VS150COMNTOOLS%\..\..\VC\Auxiliary\Build"
set __VSVersion=vs2017
Expand Down Expand Up @@ -633,7 +637,7 @@ at the install location of previous Visual Studio version. The workaround is to
of the previous version to "%VSINSTALLDIR%" and then build.
REM DIA SDK not included in Express editions
echo Visual Studio Express does not include the DIA SDK. ^
You need Visual Studio 2015 or 2017 (Community is free).
You need Visual Studio 2015, 2017, or 2019 (Community is free).
tannergooding marked this conversation as resolved.
Show resolved Hide resolved
echo See: https://github.com/dotnet/coreclr/blob/master/Documentation/project-docs/developer-guide.md#prerequisites
exit /b 1

Expand Down
8 changes: 6 additions & 2 deletions build.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ set __ThisScriptDir="%~dp0"
call "%__ThisScriptDir%"\setup_vs_tools.cmd
if NOT '%ERRORLEVEL%' == '0' exit /b 1

if defined VS150COMNTOOLS (
if defined VS160COMNTOOLS (
set "__VSToolsRoot=%VS160COMNTOOLS%"
set "__VCToolsRoot=%VS160COMNTOOLS%\..\..\VC\Auxiliary\Build"
set __VSVersion=vs2019
) else if defined VS150COMNTOOLS (
set "__VSToolsRoot=%VS150COMNTOOLS%"
set "__VCToolsRoot=%VS150COMNTOOLS%\..\..\VC\Auxiliary\Build"
set __VSVersion=vs2017
Expand Down Expand Up @@ -1056,6 +1060,6 @@ at the install location of previous Visual Studio version. The workaround is to
of the previous version to "%VSINSTALLDIR%" and then build.
REM DIA SDK not included in Express editions
echo Visual Studio Express does not include the DIA SDK. ^
You need Visual Studio 2015 or 2017 (Community is free).
You need Visual Studio 2015, 2017, or 2019 (Community is free).
echo See: https://github.com/dotnet/coreclr/blob/master/Documentation/project-docs/developer-guide.md#prerequisites
exit /b 1
20 changes: 10 additions & 10 deletions setup_vs_tools.cmd
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
@if not defined _echo @echo off

REM This script is responsible for setting up either the vs2015 or vs2017 env
REM This script is responsible for setting up the vs2015, vs2017, or vs2019 env
REM All passed arguments are ignored
REM Script will return with 0 if pass, 1 if there is a failure to find either
REM vs2015 or vs2017
REM vs2015, vs2017, or vs2019

:: 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, multiple instances can be installed on the same box SxS and VS150COMNTOOLS
:: For VS2017 and VS2019, multiple instances can be installed on the same box SxS and VS150COMNTOOLS/VS160COMNTOOLS
:: is no longer set as a global environment variable and is instead only set if the user
:: has launched the VS2017 Developer Command Prompt.
:: has launched the VS2017/VS2019 Developer Command Prompt.
::
:: Following this logic, we will default to the VS2017 toolset if VS150COMNTOOLS tools is
:: set, as this indicates the user is running from the VS2017 Developer Command Prompt and
:: Following this logic, we will default to the VS2017/VS2019 toolset if VS150COMNTOOLS/VS160COMNTOOLS tools is
:: set, as this indicates the user is running from the VS2017/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.
Expand All @@ -26,17 +26,17 @@ if defined VisualStudioVersion (
goto skip_setup
)

echo %__MsgPrefix%Searching ^for Visual Studio 2017 or 2015 installation
echo %__MsgPrefix%Searching ^for Visual Studio 2015, 2017, or 2019 installation
set _VSWHERE="%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe"
if exist %_VSWHERE% (
for /f "usebackq tokens=*" %%i in (`%_VSWHERE% -latest -prerelease -property installationPath`) do set _VSCOMNTOOLS=%%i\Common7\Tools
goto call_vs
)
if not exist "%_VSCOMNTOOLS%" set _VSCOMNTOOLS=%VS140COMNTOOLS%
echo VS2017 not found, using VS2015
echo VS2017 nor VS2019 found, using VS2015
:call_vs
if not exist "%_VSCOMNTOOLS%" (
echo %__MsgPrefix%Error: Visual Studio 2015 or 2017 required.
echo %__MsgPrefix%Error: Visual Studio 2015, 2017, or 2019 required.
echo Please see https://github.com/dotnet/coreclr/blob/master/Documentation/building/windows-instructions.md for build instructions.
exit /b 1
)
Expand All @@ -45,4 +45,4 @@ call "%_VSCOMNTOOLS%\VsDevCmd.bat"

:skip_setup

exit /b 0
exit /b 0
19 changes: 12 additions & 7 deletions src/pal/tools/gen-buildsys-win.bat
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,18 @@ set __SourceDir=%1
set __VSVersion=%2
set __Arch=%3
set __CmakeGenerator=Visual Studio
if /i "%__VSVersion%" == "vs2017" (set __CmakeGenerator=%__CmakeGenerator% 15 2017)
if /i "%__VSVersion%" == "vs2015" (set __CmakeGenerator=%__CmakeGenerator% 14 2015)
if /i "%__Arch%" == "x64" (set __CmakeGenerator=%__CmakeGenerator% Win64)
if /i "%__Arch%" == "arm" (set __CmakeGenerator=%__CmakeGenerator% ARM)
if /i "%__Arch%" == "arm64" (set __ExtraCmakeParams=%__ExtraCmakeParams% -A ARM64)

if /i "%__NMakeMakefiles%" == "1" (set __CmakeGenerator=NMake Makefiles)
if /i "%__NMakeMakefiles%" == "1" (
set __CmakeGenerator=NMake Makefiles
) else (
if /i "%__VSVersion%" == "vs2019" (set __CmakeGenerator=%__CmakeGenerator% 16 2019)
if /i "%__VSVersion%" == "vs2017" (set __CmakeGenerator=%__CmakeGenerator% 15 2017)
if /i "%__VSVersion%" == "vs2015" (set __CmakeGenerator=%__CmakeGenerator% 14 2015)

if /i "%__Arch%" == "x64" (set __ExtraCmakeParams=%__ExtraCmakeParams% -A x64)
if /i "%__Arch%" == "arm" (set __ExtraCmakeParams=%__ExtraCmakeParams% -A ARM)
if /i "%__Arch%" == "arm64" (set __ExtraCmakeParams=%__ExtraCmakeParams% -A ARM64)
)

:loop
if [%4] == [] goto end_loop
Expand All @@ -48,7 +53,7 @@ GOTO :DONE
echo "Usage..."
echo "gen-buildsys-win.bat <path to top level CMakeLists.txt> <VSVersion>"
echo "Specify the path to the top level CMake file - <ProjectK>/src/NDP"
echo "Specify the VSVersion to be used - VS2015 or VS2017"
echo "Specify the VSVersion to be used - VS2015, VS2017, or VS2019"
EXIT /B 1

:DONE
Expand Down
16 changes: 12 additions & 4 deletions tests/runtest.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ if /I "%PROCESSOR_ARCHITEW6432%"=="arm64" goto :skip_vs_setup
call "%__ThisScriptDir%"\..\setup_vs_tools.cmd
if NOT '%ERRORLEVEL%' == '0' exit /b 1

if defined VS150COMNTOOLS (
if defined VS160COMNTOOLS (
set __VSVersion=vs2019
) else if defined VS150COMNTOOLS (
set __VSVersion=vs2017
) else (
set __VSVersion=vs2015
Expand Down Expand Up @@ -75,6 +77,7 @@ if /i "%1" == "checked" (set __BuildType=Checked

if /i "%1" == "vs2015" (set __VSVersion=%1&shift&goto Arg_Loop)
if /i "%1" == "vs2017" (set __VSVersion=%1&shift&goto Arg_Loop)
if /i "%1" == "vs2019" (set __VSVersion=%1&shift&goto Arg_Loop)

if /i "%1" == "TestEnv" (set __TestEnv=%2&shift&shift&goto Arg_Loop)
if /i "%1" == "AgainstPackages" (set __AgainstPackages=1&shift&goto Arg_Loop)
Expand Down Expand Up @@ -242,7 +245,12 @@ exit /b %ERRORLEVEL%
:: Set up msbuild and tools environment. Check if msbuild and VS exist.

set _msbuildexe=
if /i "%__VSVersion%" == "vs2017" (
if /i "%__VSVersion%" == "vs2019" (
set "__VSToolsRoot=%VS160COMNTOOLS%"
set "__VCToolsRoot=%VS160COMNTOOLS%\..\..\VC\Auxiliary\Build"

set _msbuildexe="%VS160COMNTOOLS%\..\..\MSBuild\Current\Bin\MSBuild.exe"
) else if /i "%__VSVersion%" == "vs2017" (
set "__VSToolsRoot=%VS150COMNTOOLS%"
set "__VCToolsRoot=%VS150COMNTOOLS%\..\..\VC\Auxiliary\Build"

Expand Down Expand Up @@ -723,7 +731,7 @@ echo.
echo./? -? /h -h /help -help - View this message.
echo ^<build_architecture^> - Specifies build architecture: x64, x86, arm, or arm64 ^(default: x64^).
echo ^<build_type^> - Specifies build type: Debug, Release, or Checked ^(default: Debug^).
echo VSVersion ^<vs_version^> - VS2015 or VS2017 ^(default: VS2017^).
echo VSVersion ^<vs_version^> - VS2015, VS2017, or VS2019 ^(default: VS2019^).
echo TestEnv ^<test_env_script^> - Run a custom script before every test to set custom test environment settings.
echo AgainstPackages - This indicates that we are running tests that were built against packages.
echo GenerateLayoutOnly - If specified will not run the tests and will only create the Runtime Dependency Layout
Expand Down Expand Up @@ -769,6 +777,6 @@ echo %0 x64 release
exit /b 1

:NoVS
echo Visual Studio 2015 or 2017 ^(Community is free^) is a prerequisite to build this repository.
echo Visual Studio 2015, 2017, or 2019 ^(Community is free^) is a prerequisite to build this repository.
echo See: https://github.com/dotnet/coreclr/blob/master/Documentation/project-docs/developer-guide.md#prerequisites
exit /b 1
Loading