diff --git a/Source/Tools/Flax.Build/Build/Builder.Projects.cs b/Source/Tools/Flax.Build/Build/Builder.Projects.cs index 21aa25788..42bda3ea5 100644 --- a/Source/Tools/Flax.Build/Build/Builder.Projects.cs +++ b/Source/Tools/Flax.Build/Build/Builder.Projects.cs @@ -433,7 +433,7 @@ namespace Flax.Build else if (dependencyModule.BinaryModuleName == "FlaxEngine") { // TODO: instead of this hack find a way to reference the prebuilt target bindings binary (example: game C# project references FlaxEngine C# prebuilt dll) - project.CSharp.FileReferences.Add(Path.Combine(Globals.EngineRoot, "Binaries/Editor/Win64/Development/FlaxEngine.CSharp.dll")); + project.CSharp.FileReferences.Add(Path.Combine(Globals.EngineRoot, Platform.GetEditorBinaryDirectory(), "Development/FlaxEngine.CSharp.dll")); } } } diff --git a/Source/Tools/Flax.Build/Build/Platform.cs b/Source/Tools/Flax.Build/Build/Platform.cs index 72e6454a4..99edc7889 100644 --- a/Source/Tools/Flax.Build/Build/Platform.cs +++ b/Source/Tools/Flax.Build/Build/Platform.cs @@ -245,6 +245,24 @@ namespace Flax.Build return toolchain; } + /// + /// Gets path to the current platform binary directory + /// + public static string GetEditorBinaryDirectory() + { + var subdir = "Binaries/Editor/"; + switch (Platform.BuildTargetPlatform) + { + case TargetPlatform.Windows: + return subdir + "Win64"; + case TargetPlatform.Linux: + return subdir + "Linux"; + case TargetPlatform.Mac: + return subdir + "Mac"; + } + throw new NotImplementedException(); + } + /// /// Creates the project files generator for the specified project format. /// diff --git a/Source/Tools/Flax.Build/Deploy/Deployment.Editor.cs b/Source/Tools/Flax.Build/Deploy/Deployment.Editor.cs index 885282745..c4ca880f7 100644 --- a/Source/Tools/Flax.Build/Deploy/Deployment.Editor.cs +++ b/Source/Tools/Flax.Build/Deploy/Deployment.Editor.cs @@ -193,13 +193,14 @@ namespace Flax.Deploy private static void DeployEditorBinaries(TargetConfiguration configuration) { + var binariesSubDir = Path.Combine(Platform.GetEditorBinaryDirectory(), configuration.ToString()); + var src = Path.Combine(RootPath, binariesSubDir); + var dst = Path.Combine(OutputPath, binariesSubDir); + Directory.CreateDirectory(dst); + if (Platform.BuildTargetPlatform == TargetPlatform.Windows) { - var binariesSubDir = "Binaries/Editor/Win64/" + configuration; - var src = Path.Combine(RootPath, binariesSubDir); - var dst = Path.Combine(OutputPath, binariesSubDir); var dstDebug = Path.Combine(Deployer.PackageOutputPath, "EditorDebugSymbols/Win64/" + configuration); - Directory.CreateDirectory(dst); Directory.CreateDirectory(dstDebug); // Validate that build editor app has a valid version number @@ -233,11 +234,6 @@ namespace Flax.Deploy } else if (Platform.BuildTargetPlatform == TargetPlatform.Linux) { - var binariesSubDir = "Binaries/Editor/Linux/" + configuration; - var src = Path.Combine(RootPath, binariesSubDir); - var dst = Path.Combine(OutputPath, binariesSubDir); - Directory.CreateDirectory(dst); - // Deploy binaries DeployFile(src, dst, "FlaxEditor"); DeployFile(src, dst, "FlaxEditor.Build.json"); @@ -257,11 +253,6 @@ namespace Flax.Deploy } else if (Platform.BuildTargetPlatform == TargetPlatform.Mac) { - var binariesSubDir = "Binaries/Editor/Mac/" + configuration; - var src = Path.Combine(RootPath, binariesSubDir); - var dst = Path.Combine(OutputPath, binariesSubDir); - Directory.CreateDirectory(dst); - // Deploy binaries DeployFile(src, dst, "FlaxEditor"); DeployFile(src, dst, "FlaxEditor.Build.json"); @@ -278,10 +269,6 @@ namespace Flax.Deploy Utilities.Run("strip", "libmonosgen-2.0.1.dylib", null, dst, Utilities.RunOptions.None); Utilities.Run("strip", "libMoltenVK.dylib", null, dst, Utilities.RunOptions.None); } - else - { - throw new NotImplementedException(); - } } } }