From 0a8752ec0af77f01065a4dc56f464f22e2906edd Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Wed, 10 Dec 2025 09:48:27 +0100 Subject: [PATCH] Fix cross-building building engine with separate executable and library for Unix platforms on Windows --- Source/Tools/Flax.Build/Build/EngineTarget.cs | 3 ++- Source/Tools/Flax.Build/Build/Graph/TaskGraph.cs | 9 ++------- Source/Tools/Flax.Build/Platforms/Unix/UnixToolchain.cs | 3 ++- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/Source/Tools/Flax.Build/Build/EngineTarget.cs b/Source/Tools/Flax.Build/Build/EngineTarget.cs index 039f9fb16..e22a924d9 100644 --- a/Source/Tools/Flax.Build/Build/EngineTarget.cs +++ b/Source/Tools/Flax.Build/Build/EngineTarget.cs @@ -217,7 +217,8 @@ namespace Flax.Build var engineLibraryType = LinkerOutput.SharedLibrary; if (buildOptions.Toolchain?.Compiler == TargetCompiler.MSVC) engineLibraryType = LinkerOutput.ImportLibrary; // MSVC links DLL against import library - exeBuildOptions.LinkEnv.InputLibraries.Add(Path.Combine(buildOptions.OutputFolder, buildOptions.Platform.GetLinkOutputFileName(LibraryName, engineLibraryType))); + var engineLibraryPath = Utilities.NormalizePath(Path.Combine(buildOptions.OutputFolder, buildOptions.Platform.GetLinkOutputFileName(LibraryName, engineLibraryType))); + exeBuildOptions.LinkEnv.InputLibraries.Add(engineLibraryPath); exeBuildOptions.LinkEnv.InputFiles.AddRange(mainModuleOptions.OutputFiles); exeBuildOptions.DependencyFiles.AddRange(mainModuleOptions.DependencyFiles); exeBuildOptions.NugetPackageReferences.AddRange(mainModuleOptions.NugetPackageReferences); diff --git a/Source/Tools/Flax.Build/Build/Graph/TaskGraph.cs b/Source/Tools/Flax.Build/Build/Graph/TaskGraph.cs index bd0ef2ad5..6c459b33e 100644 --- a/Source/Tools/Flax.Build/Build/Graph/TaskGraph.cs +++ b/Source/Tools/Flax.Build/Build/Graph/TaskGraph.cs @@ -134,7 +134,7 @@ namespace Flax.Build.Graph } /// - /// Performs tasks list sorting based on task dependencies and cost heuristics to to improve parallelism of the graph execution. + /// Performs tasks list sorting based on task dependencies and cost heuristics to improve parallelism of the graph execution. /// public void SortTasks() { @@ -149,12 +149,7 @@ namespace Flax.Build.Graph { if (FileToProducingTaskMap.TryGetValue(prerequisiteFile, out var prerequisiteTask)) { - HashSet dependentTasks; - if (taskToDependentActionsMap.ContainsKey(prerequisiteTask)) - { - dependentTasks = taskToDependentActionsMap[prerequisiteTask]; - } - else + if (!taskToDependentActionsMap.TryGetValue(prerequisiteTask, out var dependentTasks)) { dependentTasks = new HashSet(); taskToDependentActionsMap[prerequisiteTask] = dependentTasks; diff --git a/Source/Tools/Flax.Build/Platforms/Unix/UnixToolchain.cs b/Source/Tools/Flax.Build/Platforms/Unix/UnixToolchain.cs index fcb4397a1..1d623c568 100644 --- a/Source/Tools/Flax.Build/Platforms/Unix/UnixToolchain.cs +++ b/Source/Tools/Flax.Build/Platforms/Unix/UnixToolchain.cs @@ -605,7 +605,8 @@ namespace Flax.Build.Platforms /// public override void LinkFiles(TaskGraph graph, BuildOptions options, string outputFilePath) { - outputFilePath = outputFilePath.Replace('\\', '/'); + //outputFilePath = outputFilePath.Replace('\\', '/'); + outputFilePath = Utilities.NormalizePath(outputFilePath.Replace('\\', '/')); Task linkTask; switch (options.LinkEnv.Output)