Merge pull request #1655 from nickclark2016/issues/1612

Compiler Version support for Visual Studion 2017+
This commit is contained in:
starkos 2021-06-25 08:47:41 -04:00 committed by GitHub
commit e0af9ba2b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 79 additions and 0 deletions

View File

@ -411,3 +411,35 @@ end
</PropertyGroup>
]]
end
function suite.setToolsVersion2015()
toolsversion "14.27.29110"
p.action.set("vs2015")
prepare()
test.capture [[
<PropertyGroup Label="Globals">
<ProjectGuid>{42B5DBC6-AE1F-903D-F75D-41E363076E92}</ProjectGuid>
<IgnoreWarnCompileDuplicatedFilename>true</IgnoreWarnCompileDuplicatedFilename>
<Keyword>Win32Proj</Keyword>
<RootNamespace>MyProject</RootNamespace>
</PropertyGroup>
]]
end
function suite.setToolsVersion2017()
toolsversion "14.27.29110"
p.action.set("vs2017")
prepare()
test.capture [[
<PropertyGroup Label="Globals">
<ProjectGuid>{42B5DBC6-AE1F-903D-F75D-41E363076E92}</ProjectGuid>
<IgnoreWarnCompileDuplicatedFilename>true</IgnoreWarnCompileDuplicatedFilename>
<Keyword>Win32Proj</Keyword>
<RootNamespace>MyProject</RootNamespace>
<LatestTargetPlatformVersion>$([Microsoft.Build.Utilities.ToolLocationHelper]::GetLatestSDKTargetPlatformVersion('Windows', '10.0'))</LatestTargetPlatformVersion>
<VCToolsVersion>14.27.29110</VCToolsVersion>
</PropertyGroup>
]]
end

View File

@ -134,6 +134,7 @@
m.latestTargetPlatformVersion,
m.windowsTargetPlatformVersion,
m.fastUpToDateCheck,
m.toolsVersion,
}
end
@ -183,6 +184,7 @@
return {
m.configurationType,
m.platformToolset,
m.toolsVersion,
}
else
return {
@ -193,6 +195,7 @@
m.clrSupport,
m.characterSet,
m.platformToolset,
m.toolsVersion,
m.wholeProgramOptimization,
m.nmakeOutDirs,
m.windowsSDKDesktopARMSupport,
@ -2383,6 +2386,14 @@
end
function m.toolsVersion(cfg)
local version = cfg.toolsversion
if _ACTION >= "vs2017" and version then
m.element("VCToolsVersion", nil, version)
end
end
function m.platformToolset(cfg)
local tool, version = p.config.toolset(cfg)

View File

@ -1253,6 +1253,13 @@
end,
}
api.register {
name = "toolsversion",
scope = "project",
kind = "string",
tokens = true,
}
api.register {
name = "customtoolnamespace",
scope = "config",

View File

@ -163,6 +163,7 @@
| [targetprefix](targetprefix.md) | |
| [targetsuffix](targetsuffix.md) | |
| [toolset](toolset.md) | |
| [toolsversion](toolsversion.md) | |
| [undefines](undefines.md) | |
| [usingdirs](usingdirs.md) | |
| [uuid](uuid.md) | Set project GUID (for VS projects/workspaces) |

View File

@ -116,6 +116,7 @@ title: What's New in 5.0
* [syslibdirs](syslibdirs.md) (new)
* [system](system.md) (new)
* [toolset](toolset.md) (new)
* [toolsversion](toolsversion.md) (new)
* [undefines](undefines.md) (new)
* [vectorextensions](vectorextensions.md) (new, replaces flags `EnableSSE` and `EnableSSE2`)
* [warnings](warnings.md) (new, replaces flags `ExtraWarnings` and `NoWarnings`)

View File

@ -0,0 +1,27 @@
Selects the tools version which is used to build a project.
```lua
toolsversion ("identifier")
```
If no version is specified for a configuration, the build tool will define the a default version.
### Parameters ###
`identifier` is a string identifier for the toolset version.
### Applies To ###
Project configurations.
### Availability ###
Premake 5.0 and later. Versions are currently only implemented for Visual Studio 2017+.
### Examples ###
Specify tool version 14.27.29110 of the toolset.
```lua
toolsversion "14.27.29110"
```