diff options
author | William Kent <wjk@users.noreply.github.com> | 2016-12-23 05:38:23 +0300 |
---|---|---|
committer | Jan Kotas <jkotas@microsoft.com> | 2016-12-23 05:38:23 +0300 |
commit | 13f91678f78be4f391338e55851f7d3afc51562e (patch) | |
tree | 16863c078e59b9a8cf4f965d143e72a758c01add /src | |
parent | d2635386da1d4e3fff1bdfdd16b24523328afe05 (diff) |
Enable build with Visual Studio 2017 (#2390)
* Add support for VS2017 in buildvars-setup.cmd
* Add support for VS2017 in gen-buildsys-win.cmd
* VS2017 rearranges some files, update build-native.cmd to match
* Update minimum CMake version to 3.7.0
This version is the first version that supports generating a project
using the Visual Studio 2017 toolchain.
* Fix bug in gen-buildsys-win.bat
The code previously assumed that the probe-win.ps1 script is located in the
current working directory. During my testing, I found that this is not robust
enough for all use-cases. Using %~dp0 to identify the directory containing the
batch file is more robust against this issue.
* Use the correct copy of MSBuild to build the C++ projects
Only the copy of MSBuild shipped with VS2017 can successfully
build VS2017 vcxproj files. Using any other copy will cause
strange errors.
* Update documentation
* Use "rem" for comments instead of "::"
The Windows batch file interpreter treats these two
symbols differently. When "::" is used within an if
block, it can create spurious drive-not-found errors.
Using "rem" avoids this problem.
Diffstat (limited to 'src')
-rw-r--r-- | src/Native/CMakeLists.txt | 5 | ||||
-rw-r--r-- | src/Native/gen-buildsys-win.bat | 3 |
2 files changed, 7 insertions, 1 deletions
diff --git a/src/Native/CMakeLists.txt b/src/Native/CMakeLists.txt index 401318c8f..0ed106efb 100644 --- a/src/Native/CMakeLists.txt +++ b/src/Native/CMakeLists.txt @@ -4,6 +4,11 @@ project(CoreRT) # Include cmake functions include(functions.cmake) +string(FIND ${CMAKE_GENERATOR} "Visual Studio 15 2017" VS2017_POS) +if(VS2017_POS EQUAL 0 AND (CMAKE_VERSION VERSION_LESS 3.6.0)) + message(FATAL_ERROR "CMake version 3.6.0 or higher is required to compile targeting VS 2017") +endif() + set(CMAKE_MACOSX_RPATH ON) set(CMAKE_INSTALL_PREFIX $ENV{__CMakeBinDir}) set(CMAKE_INCLUDE_CURRENT_DIR ON) diff --git a/src/Native/gen-buildsys-win.bat b/src/Native/gen-buildsys-win.bat index 209174f9d..b7fdcb4fd 100644 --- a/src/Native/gen-buildsys-win.bat +++ b/src/Native/gen-buildsys-win.bat @@ -17,12 +17,13 @@ if %basePath:~-1%==\ set "basePath=%basePath:~0,-1%" set __VSString=12 2013 if /i "%2" == "vs2015" (set __VSString=14 2015) +if /i "%2" == "vs2017" (set __VSString=15 2017) if /i "%3" == "x64" (set __VSString=%__VSString% Win64) if defined CMakePath goto DoGen :: Eval the output from probe-win1.ps1 -for /f "delims=" %%a in ('powershell -NoProfile -ExecutionPolicy ByPass "& .\probe-win.ps1"') do %%a +for /f "delims=" %%a in ('powershell -NoProfile -ExecutionPolicy ByPass "& %~dp0\probe-win.ps1"') do %%a :DoGen "%CMakePath%" "-DCLR_CMAKE_TARGET_ARCH=%3" -G "Visual Studio %__VSString%" %1 |