Fixing mac/linux csharp binaries referencing

This commit is contained in:
Crawcik
2022-09-24 17:52:59 +02:00
parent f154bfcfc1
commit 5b212bb8bc
3 changed files with 24 additions and 19 deletions

View File

@@ -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"));
}
}
}

View File

@@ -245,6 +245,24 @@ namespace Flax.Build
return toolchain;
}
/// <summary>
/// Gets path to the current platform binary directory
/// </summary>
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();
}
/// <summary>
/// Creates the project files generator for the specified project format.
/// </summary>

View File

@@ -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();
}
}
}
}