Add OutputName to Build Settings for game output exe/package renaming
#1174
This commit is contained in:
@@ -76,10 +76,10 @@ namespace Flax.Build
|
||||
/// <inheritdoc />
|
||||
public override string GetOutputFilePath(BuildOptions options, TargetOutputType? outputType)
|
||||
{
|
||||
var useSeparateMainExe = UseSeparateMainExecutable(options);
|
||||
var asLib = UseSeparateMainExecutable(options) || BuildAsLibrary(options);
|
||||
|
||||
// If building engine executable for platform doesn't support referencing it when linking game shared libraries
|
||||
if (outputType == null && useSeparateMainExe)
|
||||
if (outputType == null && asLib)
|
||||
{
|
||||
// Build into shared library
|
||||
outputType = TargetOutputType.Library;
|
||||
@@ -87,7 +87,7 @@ namespace Flax.Build
|
||||
|
||||
// Override output name to shared library name when building library for the separate main executable
|
||||
var outputName = OutputName;
|
||||
if (useSeparateMainExe && (outputType ?? OutputType) == TargetOutputType.Library)
|
||||
if (asLib && (outputType ?? OutputType) == TargetOutputType.Library)
|
||||
OutputName = LibraryName;
|
||||
|
||||
var result = base.GetOutputFilePath(options, outputType);
|
||||
@@ -101,7 +101,7 @@ namespace Flax.Build
|
||||
base.SetupTargetEnvironment(options);
|
||||
|
||||
// If building engine executable for platform doesn't support referencing it when linking game shared libraries
|
||||
if (UseSeparateMainExecutable(options))
|
||||
if (UseSeparateMainExecutable(options) || BuildAsLibrary(options))
|
||||
{
|
||||
// Build into shared library
|
||||
options.LinkEnv.Output = LinkerOutput.SharedLibrary;
|
||||
@@ -127,7 +127,7 @@ namespace Flax.Build
|
||||
base.PostBuild(graph, buildOptions);
|
||||
|
||||
// If building engine executable for platform doesn't support referencing it when linking game shared libraries
|
||||
if (UseSeparateMainExecutable(buildOptions))
|
||||
if (UseSeparateMainExecutable(buildOptions) && !BuildAsLibrary(buildOptions))
|
||||
{
|
||||
// Build additional executable with Main module only that uses shared library
|
||||
using (new ProfileEventScope("BuildExecutable"))
|
||||
@@ -152,6 +152,16 @@ namespace Flax.Build
|
||||
return false;
|
||||
}
|
||||
|
||||
private bool BuildAsLibrary(BuildOptions buildOptions)
|
||||
{
|
||||
switch (buildOptions.Platform.Target)
|
||||
{
|
||||
case TargetPlatform.UWP:
|
||||
case TargetPlatform.Android: return true;
|
||||
default: return false;
|
||||
}
|
||||
}
|
||||
|
||||
private void BuildMainExecutable(TaskGraph graph, BuildOptions buildOptions)
|
||||
{
|
||||
if (IsPreBuilt)
|
||||
|
||||
@@ -35,9 +35,12 @@ namespace Flax.Deploy
|
||||
// For Linux don't deploy engine libs used by C++ scripting linking (engine source required)
|
||||
if (platform == TargetPlatform.Linux)
|
||||
{
|
||||
File.Delete(Path.Combine(dst, "Binaries", "Game", "x64", "Debug", "FlaxGame.a"));
|
||||
File.Delete(Path.Combine(dst, "Binaries", "Game", "x64", "Development", "FlaxGame.a"));
|
||||
File.Delete(Path.Combine(dst, "Binaries", "Game", "x64", "Release", "FlaxGame.a"));
|
||||
Utilities.FileDelete(Path.Combine(dst, "Binaries", "Game", "x64", "Debug", "FlaxGame.a"));
|
||||
Utilities.FileDelete(Path.Combine(dst, "Binaries", "Game", "x64", "Development", "FlaxGame.a"));
|
||||
Utilities.FileDelete(Path.Combine(dst, "Binaries", "Game", "x64", "Release", "FlaxGame.a"));
|
||||
Utilities.FileDelete(Path.Combine(dst, "Binaries", "Game", "x64", "Debug", "FlaxEngine.a"));
|
||||
Utilities.FileDelete(Path.Combine(dst, "Binaries", "Game", "x64", "Development", "FlaxEngine.a"));
|
||||
Utilities.FileDelete(Path.Combine(dst, "Binaries", "Game", "x64", "Release", "FlaxEngine.a"));
|
||||
}
|
||||
|
||||
// Sign binaries
|
||||
@@ -62,15 +65,15 @@ namespace Flax.Deploy
|
||||
{
|
||||
var binaries = Path.Combine(dst, "Binaries", "Game", "arm64", "Debug");
|
||||
CodeSign(Path.Combine(binaries, "FlaxGame"));
|
||||
CodeSign(Path.Combine(binaries, "FlaxGame.dylib"));
|
||||
CodeSign(Path.Combine(binaries, "FlaxEngine.dylib"));
|
||||
|
||||
binaries = Path.Combine(dst, "Binaries", "Game", "arm64", "Development");
|
||||
CodeSign(Path.Combine(binaries, "FlaxGame"));
|
||||
CodeSign(Path.Combine(binaries, "FlaxGame.dylib"));
|
||||
CodeSign(Path.Combine(binaries, "FlaxEngine.dylib"));
|
||||
|
||||
binaries = Path.Combine(dst, "Binaries", "Game", "arm64", "Release");
|
||||
CodeSign(Path.Combine(binaries, "FlaxGame"));
|
||||
CodeSign(Path.Combine(binaries, "FlaxGame.dylib"));
|
||||
CodeSign(Path.Combine(binaries, "FlaxEngine.dylib"));
|
||||
}
|
||||
|
||||
// Don't distribute engine deps
|
||||
|
||||
@@ -396,7 +396,7 @@ namespace Flax.Build.Platforms
|
||||
rpathTask.DependentTasks.Add(lastTask);
|
||||
lastTask = rpathTask;
|
||||
}
|
||||
// TODO: fix dylib ID: 'install_name_tool -id @rpath/FlaxGame.dylib FlaxGame.dylib'
|
||||
// TODO: fix dylib ID: 'install_name_tool -id @rpath/FlaxEngine.dylib FlaxEngine.dylib'
|
||||
if (!options.LinkEnv.DebugInformation)
|
||||
{
|
||||
// Strip debug symbols
|
||||
|
||||
Reference in New Issue
Block a user