From 947fd76b389e8d724c6b856bd15898b259747e70 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Mon, 8 Jun 2026 18:05:02 +0200 Subject: [PATCH] Fix build with GDK on the latest toolset versions --- .../Tools/Flax.Build/Platforms/GDK/GDKToolchain.cs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Source/Tools/Flax.Build/Platforms/GDK/GDKToolchain.cs b/Source/Tools/Flax.Build/Platforms/GDK/GDKToolchain.cs index 1ca2b4d08..341dee8d6 100644 --- a/Source/Tools/Flax.Build/Platforms/GDK/GDKToolchain.cs +++ b/Source/Tools/Flax.Build/Platforms/GDK/GDKToolchain.cs @@ -77,8 +77,14 @@ namespace Flax.Build.Platforms var paths = Directory.GetDirectories(redistToolsPath, name.Substring(0, 2) + "*"); if (paths.Length == 0) throw new Exception($"Failed to find MSVC redistribute binaries for toolset '{Toolset}' inside folder '{toolsPath}'"); - var crtToolset = Toolset > WindowsPlatformToolset.v143 ? WindowsPlatformToolset.v143 : Toolset; - redistToolsPath = Path.Combine(paths[0], "x64", "Microsoft.VC" + (int)crtToolset + ".CRT"); + int crtToolset; + for (crtToolset = (int)WindowsPlatformToolset.v145; crtToolset >= (int)Toolset; crtToolset--) + { + redistToolsPath = Path.Combine(paths[0], "x64", "Microsoft.VC" + (int)crtToolset + ".CRT"); + if (Directory.Exists(redistToolsPath)) + break; + } + Log.Verbose("GDK CRT toolset version: " + (WindowsPlatformToolset)crtToolset); redistToolsPath = Utilities.RemovePathRelativeParts(redistToolsPath); options.DependencyFiles.Add(Path.Combine(redistToolsPath, "concrt140.dll")); options.DependencyFiles.Add(Path.Combine(redistToolsPath, "msvcp140.dll")); @@ -90,7 +96,7 @@ namespace Flax.Build.Platforms options.DependencyFiles.Add(Path.Combine(redistToolsPath, "vcruntime140_1.dll")); if (OpenMP) { - redistToolsPath = Path.Combine(paths[0], "x64", "Microsoft.VC" + (int)crtToolset + ".OpenMP"); + redistToolsPath = Path.Combine(paths[0], "x64", "Microsoft.VC" + crtToolset + ".OpenMP"); redistToolsPath = Utilities.RemovePathRelativeParts(redistToolsPath); options.DependencyFiles.Add(Path.Combine(redistToolsPath, "vcomp140.dll")); }