diff options
author | Anton Lapounov <antonl@microsoft.com> | 2021-03-15 00:48:27 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-15 00:48:27 +0300 |
commit | c156959c33e48651b4ebfb51c64de510aadfefb3 (patch) | |
tree | 9b0627726823d68a72a411844c4ab96d26aae572 /src/coreclr/build-runtime.cmd | |
parent | f7a3190905377d4c4f7b1b8f94a72d040850df9a (diff) |
Consolidate VS detection logic (#49593)
Diffstat (limited to 'src/coreclr/build-runtime.cmd')
-rw-r--r-- | src/coreclr/build-runtime.cmd | 38 |
1 files changed, 9 insertions, 29 deletions
diff --git a/src/coreclr/build-runtime.cmd b/src/coreclr/build-runtime.cmd index 7373015d111..18a7f392354 100644 --- a/src/coreclr/build-runtime.cmd +++ b/src/coreclr/build-runtime.cmd @@ -8,25 +8,11 @@ set "__MsgPrefix=BUILD: " echo %__MsgPrefix%Starting Build at %TIME% set __ThisScriptFull="%~f0" -set __ThisScriptDir="%~dp0" - -call %__ThisScriptDir%\setup_vs_tools.cmd -if NOT '%ERRORLEVEL%' == '0' goto ExitWithError - -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 -) :: Note that the msbuild project files (specifically, dir.proj) will use the following variables, if set: :: __BuildArch -- default: x64 :: __BuildType -- default: Debug -:: __TargetOS -- default: windows +:: __TargetOS -- default: windows :: __ProjectDir -- default: directory of the dir.props file :: __RepoRootDir -- default: directory two levels above the dir.props file :: __RootBinDir -- default: %__RepoRootDir%\artifacts\ @@ -207,6 +193,14 @@ if defined __Priority ( ) ) +:: Initialize VS environment +call %__RepoRootDir%\eng\native\init-vs-env.cmd +if NOT '%ERRORLEVEL%' == '0' goto ExitWithError + +if defined VCINSTALLDIR ( + set "__VCToolsRoot=%VCINSTALLDIR%Auxiliary\Build" +) + if defined __BuildAll goto BuildAll set /A __TotalSpecifiedBuildArch=__BuildArchX64 + __BuildArchX86 + __BuildArchArm + __BuildArchArm64 @@ -610,12 +604,6 @@ if %__BuildNative% EQU 1 ( call "%__VCToolsRoot%\vcvarsall.bat" !__VCBuildArch! @if defined _echo @echo on - if not defined VSINSTALLDIR ( - echo %__ErrMsgPrefix%%__MsgPrefix%Error: VSINSTALLDIR variable not defined. - goto ExitWithError - ) - if not exist "!VSINSTALLDIR!DIA SDK" goto NoDIA - if defined __SkipConfigure goto SkipConfigure echo %__MsgPrefix%Regenerating the Visual Studio solution @@ -845,11 +833,3 @@ echo -- builds all build types for x86 echo build -all -x64 -x86 -Checked -Release echo -- builds x64 and x86 architectures, Checked and Release build types for each exit /b 1 - -:NoDIA -echo Error: DIA SDK is missing at "%VSINSTALLDIR%DIA SDK". ^ -Did you install all the requirements for building on Windows, including the "Desktop Development with C++" workload? ^ -Please see https://github.com/dotnet/runtime/blob/main/docs/workflow/requirements/windows-requirements.md ^ -Another possibility is that you have a parallel installation of Visual Studio and the DIA SDK is there. In this case it ^ -may help to copy its "DIA SDK" folder into "%VSINSTALLDIR%" manually, then try again. -exit /b 1 |