diff --git a/Source/Tools/Flax.Build/Configuration.cs b/Source/Tools/Flax.Build/Configuration.cs index 28970f289..bd9785d35 100644 --- a/Source/Tools/Flax.Build/Configuration.cs +++ b/Source/Tools/Flax.Build/Configuration.cs @@ -201,6 +201,12 @@ namespace Flax.Build [CommandLine("customProjectFormat", "", "Generates code project files for a custom project format type. Valid only with -genproject option.")] public static string ProjectFormatCustom = null; + /// + /// Overrides the compiler to use for building. Eg. v140 overrides the toolset when building for Windows. + /// + [CommandLine("compiler", "", "Overrides the compiler to use for building. Eg. v140 overrides the toolset when building for Windows.")] + public static string Compiler = null; + /// /// Custom configuration defines provided via command line for the build tool. /// diff --git a/Source/Tools/Flax.Build/Platforms/Windows/WindowsToolchain.cs b/Source/Tools/Flax.Build/Platforms/Windows/WindowsToolchain.cs index 8f247a189..40f338a65 100644 --- a/Source/Tools/Flax.Build/Platforms/Windows/WindowsToolchain.cs +++ b/Source/Tools/Flax.Build/Platforms/Windows/WindowsToolchain.cs @@ -20,7 +20,7 @@ namespace Flax.Build.Platforms /// The platform. /// The target architecture. public WindowsToolchain(WindowsPlatform platform, TargetArchitecture architecture) - : base(platform, architecture, WindowsPlatformToolset.v140, WindowsPlatformSDK.Latest) + : base(platform, architecture, WindowsPlatformToolset.Latest, WindowsPlatformSDK.Latest) { } diff --git a/Source/Tools/Flax.Build/Platforms/Windows/WindowsToolchainBase.cs b/Source/Tools/Flax.Build/Platforms/Windows/WindowsToolchainBase.cs index 4d3289a86..919971f68 100644 --- a/Source/Tools/Flax.Build/Platforms/Windows/WindowsToolchainBase.cs +++ b/Source/Tools/Flax.Build/Platforms/Windows/WindowsToolchainBase.cs @@ -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) {