Updates to engine for porting to blue platform

This commit is contained in:
Wojtek Figat
2025-11-26 06:28:54 -08:00
parent c8839b8587
commit 403d2cedc0
3 changed files with 19 additions and 33 deletions

View File

@@ -198,7 +198,7 @@ namespace FlaxEngine
private static void OnLocalizationChanged()
{
// Invariant-globalization only (see InitHostfxr with Mono)
#if !(PLATFORM_IOS || PLATFORM_SWITCH)
#if !(PLATFORM_IOS || PLATFORM_SWITCH || PLATFORM_PS4 || PLATFORM_PS5)
var currentThread = Thread.CurrentThread;
var language = Localization.CurrentLanguage;
if (language != null)
@@ -261,7 +261,7 @@ namespace FlaxEngine
internal static ManagedHandle CultureInfoToManaged(int lcid)
{
#if PLATFORM_IOS || PLATFORM_SWITCH
#if PLATFORM_IOS || PLATFORM_SWITCH || PLATFORM_PS4 || PLATFORM_PS5
// Invariant-globalization only (see InitHostfxr with Mono)
lcid = 0;
#endif

View File

@@ -142,7 +142,7 @@ namespace Flax.Build
}
/// <summary>
/// Returns true if this build target should use separate (aka main-only) executable file and separate runtime (in shared library). Used on platforms that don't support linking again executable file but only shared library (see HasExecutableFileReferenceSupport).
/// Returns true if this build target should use separate (aka main-only) executable file and separate runtime (in shared library). Used on platforms that don't support linking (or symbol lookup) against executable file but only shared library (see HasExecutableFileReferenceSupport).
/// </summary>
public virtual bool UseSeparateMainExecutable(BuildOptions buildOptions)
{

View File

@@ -320,6 +320,17 @@ namespace Flax.Build.Platforms
{
}
/// <summary>
/// Gets linker argument to reference a specific shared library file.
/// </summary>
/// <param name="graph">The graph.</param>
/// <param name="options">The options.</param>
/// <param name="library">The shared library file path.</param>
protected virtual string GetSharedLibraryLinkArg(TaskGraph graph, BuildOptions options, string library)
{
return string.Format("\"-l{0}\"", GetLibName(library));
}
/// <inheritdoc />
public override CompileOutput CompileCppFiles(TaskGraph graph, BuildOptions options, List<string> sourceFiles, string outputPath)
{
@@ -527,7 +538,8 @@ namespace Flax.Build.Platforms
// Input libraries
var libraryPaths = new HashSet<string>();
foreach (var library in linkEnvironment.InputLibraries)
var dynamicLibExt = Platform.SharedLibraryFileExtension;
foreach (var library in linkEnvironment.InputLibraries.Concat(options.Libraries))
{
var dir = Path.GetDirectoryName(library);
var ext = Path.GetExtension(library);
@@ -539,37 +551,12 @@ namespace Flax.Build.Platforms
{
// Skip executable
}
else if (ext == ".so")
else if (ext == dynamicLibExt)
{
// Link against dynamic library
task.PrerequisiteFiles.Add(library);
libraryPaths.Add(dir);
args.Add(string.Format("\"-l{0}\"", GetLibName(library)));
}
else
{
task.PrerequisiteFiles.Add(library);
args.Add(string.Format("\"{0}\"", GetLibName(library)));
}
}
foreach (var library in options.Libraries)
{
var dir = Path.GetDirectoryName(library);
var ext = Path.GetExtension(library);
if (string.IsNullOrEmpty(dir))
{
args.Add(string.Format("\"-l{0}\"", library));
}
else if (string.IsNullOrEmpty(ext))
{
// Skip executable
}
else if (ext == ".so")
{
// Link against dynamic library
task.PrerequisiteFiles.Add(library);
libraryPaths.Add(dir);
args.Add(string.Format("\"-l{0}\"", GetLibName(library)));
args.Add(GetSharedLibraryLinkArg(graph, options, library));
}
else
{
@@ -580,8 +567,7 @@ namespace Flax.Build.Platforms
// Input files (link static libraries last)
task.PrerequisiteFiles.AddRange(linkEnvironment.InputFiles);
foreach (var file in linkEnvironment.InputFiles.Where(x => !x.EndsWith(".a"))
.Concat(linkEnvironment.InputFiles.Where(x => x.EndsWith(".a"))))
foreach (var file in linkEnvironment.InputFiles.Where(x => !x.EndsWith(".a")).Concat(linkEnvironment.InputFiles.Where(x => x.EndsWith(".a"))))
{
args.Add(string.Format("\"{0}\"", file.Replace('\\', '/')));
}