From: Jan Kotas Date: Thu, 20 Aug 2015 04:12:40 +0000 (-0700) Subject: Auto-detect VS2015 X-Git-Tag: accepted/tizen/base/20180629.140029~6476^2~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9abdcfa31083750d09eb147811345b625575620e;p=platform%2Fupstream%2Fcoreclr.git Auto-detect VS2015 Change build and tests scripts to detect VS2015 and use that if available by default --- diff --git a/Documentation/building/windows-instructions.md b/Documentation/building/windows-instructions.md index e2c63c9..3d0a038 100644 --- a/Documentation/building/windows-instructions.md +++ b/Documentation/building/windows-instructions.md @@ -72,8 +72,6 @@ To build CoreCLR, run `build.cmd` from the root of the coreclr repository. This Product binaries are available at C:\git\coreclr\bin\Product\Windows_NT.x64.debug Test binaries are available at C:\git\coreclr\bin\tests\Windows_NT.x64.debug -**Note:** for building using Visual Studio 2015 the parameter `vs2015` should be added to the `build` command. - **Note:** To avoid building the tests, pass the 'skiptestbuild' option to build. **build /?** will list supported parameters. diff --git a/build.cmd b/build.cmd index edfedaf..a885f2e 100644 --- a/build.cmd +++ b/build.cmd @@ -6,9 +6,11 @@ set __BuildArch=x64 set __BuildType=Debug set __BuildOS=Windows_NT -:: Default to VS2013 -set __VSVersion=VS2013 -set __VSProductVersion=120 +:: Default to highest Visual Studio version available +set __VSVersion=vs2015 + +if defined VS120COMNTOOLS set __VSVersion=vs2013 +if defined VS140COMNTOOLS set __VSVersion=vs2015 :: Set the various build properties here so that CMake and MSBuild can pick them up set "__ProjectDir=%~dp0" @@ -39,8 +41,8 @@ if /i "%1" == "linuxmscorlib" (set __MscorlibOnly=1&set __BuildOS=Linux&shift&go if /i "%1" == "osxmscorlib" (set __MscorlibOnly=1&set __BuildOS=OSX&shift&goto Arg_Loop) if /i "%1" == "windowsmscorlib" (set __MscorlibOnly=1&set __BuildOS=Windows_NT&shift&goto Arg_Loop) -if /i "%1" == "vs2013" (set __VSVersion=%1&set __VSProductVersion=120&shift&goto Arg_Loop) -if /i "%1" == "vs2015" (set __VSVersion=%1&set __VSProductVersion=140&shift&goto Arg_Loop) +if /i "%1" == "vs2013" (set __VSVersion=%1&shift&goto Arg_Loop) +if /i "%1" == "vs2015" (set __VSVersion=%1&shift&goto Arg_Loop) if /i "%1" == "skiptestbuild" (set __SkipTestBuild=1&shift&goto Arg_Loop) echo Invalid commandline argument: %1 @@ -97,6 +99,11 @@ for /f "delims=" %%a in ('powershell -NoProfile -ExecutionPolicy RemoteSigned "& goto CheckVS :CheckVS + +set __VSProductVersion= +if /i "%__VSVersion%" == "vs2013" set __VSProductVersion=120 +if /i "%__VSVersion%" == "vs2015" set __VSProductVersion=140 + :: Check presence of VS if defined VS%__VSProductVersion%COMNTOOLS goto CheckVSExistence echo Visual Studio 2013+ (Community is free) is a pre-requisite to build this repository. @@ -240,7 +247,7 @@ echo. echo BuildArch can be: x64, x86 echo BuildType can be: Debug, Release echo Clean - optional argument to force a clean build. -echo VSVersion - optional argument to use VS2013 or VS2015 (default VS2013) +echo VSVersion - optional argument to use VS2013 or VS2015 (default VS2015) echo windowsmscorlib - Build mscorlib for Windows echo linuxmscorlib - Build mscorlib for Linux echo osxmscorlib - Build mscorlib for OS X diff --git a/tests/buildtest.cmd b/tests/buildtest.cmd index d7265a6..25fead4 100644 --- a/tests/buildtest.cmd +++ b/tests/buildtest.cmd @@ -11,6 +11,12 @@ set "__PackagesDir=%__ProjectDir%\packages" set "__RootBinDir=%__ProjectDir%\bin" set "__LogsDir=%__RootBinDir%\Logs" +:: Default to highest Visual Studio version available +set __VSVersion=vs2015 + +if defined VS120COMNTOOLS set __VSVersion=vs2013 +if defined VS140COMNTOOLS set __VSVersion=vs2015 + :Arg_Loop if "%1" == "" goto ArgsDone if /i "%1" == "x64" (set __BuildArch=x64&shift&goto Arg_Loop) @@ -20,8 +26,8 @@ if /i "%1" == "release" (set __BuildType=Release&shift&goto Arg_Loop) if /i "%1" == "clean" (set __CleanBuild=1&shift&goto Arg_Loop) -if /i "%1" == "vs2013" (set __VSVersion=%1&set __VSProductVersion=120&shift&goto Arg_Loop) -if /i "%1" == "vs2015" (set __VSVersion=%1&set __VSProductVersion=140&shift&goto Arg_Loop) +if /i "%1" == "vs2013" (set __VSVersion=%1&shift&goto Arg_Loop) +if /i "%1" == "vs2015" (set __VSVersion=%1&shift&goto Arg_Loop) goto Usage @@ -32,9 +38,6 @@ goto Usage if not defined __BuildArch set __BuildArch=x64 if not defined __BuildType set __BuildType=Debug if not defined __BuildOS set __BuildOS=Windows_NT -:: Default to VS2013 -if not defined __VSVersion set __VSVersion=vs2013 -if not defined __VSProductVersion set __VSProductVersion=120 set "__TestBinDir=%__RootBinDir%\tests\%__BuildOS%.%__BuildArch%.%__BuildType%" :: We have different managed and native intermediate dirs because the managed bits will include @@ -79,14 +82,12 @@ echo. :: Eval the output from probe-win1.ps1 for /f "delims=" %%a in ('powershell -NoProfile -ExecutionPolicy RemoteSigned "& ""%__SourceDir%\pal\tools\probe-win.ps1"""') do %%a -:: Check presence of VS -if defined VS%__VSProductVersion%COMNTOOLS goto CheckVSExistence -echo Visual Studio 2013+ (Community is free) is a pre-requisite to build this repository. -exit /b 1 +set __VSProductVersion= +if /i "%__VSVersion%" == "vs2013" set __VSProductVersion=120 +if /i "%__VSVersion%" == "vs2015" set __VSProductVersion=140 -:CheckVSExistence -:: Does VS 2013 or VS 2015 really exist? -if exist "!VS%__VSProductVersion%COMNTOOLS!\..\IDE\devenv.exe" goto CheckMSBuild +:: Check presence of VS +if defined VS%__VSProductVersion%COMNTOOLS goto CheckMSBuild echo Visual Studio 2013+ (Community is free) is a pre-requisite to build this repository. exit /b 1 @@ -94,8 +95,12 @@ exit /b 1 if /i "%__VSVersion%" =="vs2015" goto MSBuild14 set _msbuildexe="%ProgramFiles(x86)%\MSBuild\12.0\Bin\MSBuild.exe" if not exist %_msbuildexe% set _msbuildexe="%ProgramFiles%\MSBuild\12.0\Bin\MSBuild.exe" -:MSBuild14 if not exist %_msbuildexe% set _msbuildexe="%ProgramFiles(x86)%\MSBuild\14.0\Bin\MSBuild.exe" +goto :CheckMSBuild14 +:MSBuild14 +set _msbuildexe="%ProgramFiles(x86)%\MSBuild\14.0\Bin\MSBuild.exe" +set UseRoslynCompiler=true +:CheckMSBuild14 if not exist %_msbuildexe% set _msbuildexe="%ProgramFiles%\MSBuild\14.0\Bin\MSBuild.exe" if not exist %_msbuildexe% echo Error: Could not find MSBuild.exe. Please see https://github.com/dotnet/coreclr/blob/master/Documentation/project-docs/developer-guide.md for build instructions. && exit /b 1 @@ -177,5 +182,5 @@ echo. echo BuildArch can be: x64 echo BuildType can be: Debug, Release echo Clean - optional argument to force a clean build. -echo VSVersion - optional argument to use VS2013 or VS2015 (default VS2013) +echo VSVersion - optional argument to use VS2013 or VS2015 (default VS2015) exit /b 1 diff --git a/tests/runtest.cmd b/tests/runtest.cmd index e3e8308..6c225fb 100644 --- a/tests/runtest.cmd +++ b/tests/runtest.cmd @@ -2,9 +2,11 @@ setlocal EnableDelayedExpansion set __ProjectFilesDir=%~dp0 -:: Default to VS2013 -set __VSVersion=VS2013 -set __VSProductVersion=120 +:: Default to highest Visual Studio version available +set __VSVersion=vs2015 + +if defined VS120COMNTOOLS set __VSVersion=vs2013 +if defined VS140COMNTOOLS set __VSVersion=vs2015 :: Default __Exclude to issues.targets set __Exclude=%~dp0\issues.targets @@ -20,8 +22,8 @@ if /i "%1" == "SkipWrapperGeneration" (set __SkipWrapperGeneration=true&shift&go if /i "%1" == "Exclude" (set __Exclude=%2&shift&shift&goto Arg_Loop) if /i "%1" == "TestEnv" (set __TestEnv=%2&shift&shift&goto Arg_Loop) -if /i "%1" == "vs2013" (set __VSVersion=%1&set __VSProductVersion=120&shift&goto Arg_Loop) -if /i "%1" == "vs2015" (set __VSVersion=%1&set __VSProductVersion=140&shift&goto Arg_Loop) +if /i "%1" == "vs2013" (set __VSVersion=%1&shift&goto Arg_Loop) +if /i "%1" == "vs2015" (set __VSVersion=%1&shift&goto Arg_Loop) if /i "%1" == "/?" (goto Usage) @@ -30,6 +32,10 @@ shift :ArgsDone :: Check prerequisites +set __VSProductVersion= +if /i "%__VSVersion%" == "vs2013" set __VSProductVersion=120 +if /i "%__VSVersion%" == "vs2015" set __VSProductVersion=140 + :: Check presence of VS if defined VS%__VSProductVersion%COMNTOOLS goto CheckMSbuild echo InVisual Studio 2013+ (Community is free) is a pre-requisite to build this repository. @@ -150,7 +156,7 @@ echo BuildType can be: Debug, Release echo SkipWrapperGeneration- Optional parameter - this will run the same set of tests as the last time it was run echo Exclude- Optional parameter - this will exclude individual tests from running, specified by ExcludeList ItemGroup in an .targets file. echo TestEnv- Optional parameter - this will run a custom script to set custom test envirommnent settings. -echo VSVersion- optional argument to use VS2013 or VS2015 (default VS2013) +echo VSVersion- optional argument to use VS2013 or VS2015 (default VS2015) echo CORE_ROOT The path to the runtime exit /b 1