Add support for using other VC++ toolset for Window and add cmd arg for selecting compiler manually

This commit is contained in:
Wojtek Figat
2021-02-17 10:58:58 +01:00
parent 1530f91944
commit 25f61e931e
3 changed files with 14 additions and 1 deletions

View File

@@ -201,6 +201,12 @@ namespace Flax.Build
[CommandLine("customProjectFormat", "<type>", "Generates code project files for a custom project format type. Valid only with -genproject option.")]
public static string ProjectFormatCustom = null;
/// <summary>
/// Overrides the compiler to use for building. Eg. v140 overrides the toolset when building for Windows.
/// </summary>
[CommandLine("compiler", "<name>", "Overrides the compiler to use for building. Eg. v140 overrides the toolset when building for Windows.")]
public static string Compiler = null;
/// <summary>
/// Custom configuration defines provided via command line for the build tool.
/// </summary>

View File

@@ -20,7 +20,7 @@ namespace Flax.Build.Platforms
/// <param name="platform">The platform.</param>
/// <param name="architecture">The target architecture.</param>
public WindowsToolchain(WindowsPlatform platform, TargetArchitecture architecture)
: base(platform, architecture, WindowsPlatformToolset.v140, WindowsPlatformSDK.Latest)
: base(platform, architecture, WindowsPlatformToolset.Latest, WindowsPlatformSDK.Latest)
{
}

View File

@@ -78,6 +78,13 @@ namespace Flax.Build.Platforms
var toolsets = WindowsPlatformBase.GetToolsets();
var sdks = WindowsPlatformBase.GetSDKs();
// Pick the overriden toolset
if (Configuration.Compiler != null)
{
if (Enum.TryParse(Configuration.Compiler, out WindowsPlatformToolset compiler))
toolsetVer = compiler;
}
// Pick the newest installed Visual Studio version if using the default toolset
if (toolsetVer == WindowsPlatformToolset.Default)
{