This commit is contained in:
Wojtek Figat
2021-10-05 15:58:45 +02:00
parent 590c75f4cb
commit 77f2bd5115
4 changed files with 28 additions and 6 deletions

View File

@@ -181,7 +181,7 @@ namespace Flax.Build.Platforms
case TargetArchitecture.ARM64: return "aarch64-unknown-linux-gnueabi";
default: throw new InvalidArchitectureException(architecture);
}
case TargetPlatform.PS4: return "orbis";
case TargetPlatform.PS4: return (string)Utilities.GetStaticValue("Flax.Build.Platforms.PS4Toolchain", "ToolchainName");
case TargetPlatform.Android:
switch (architecture)
{

View File

@@ -5,6 +5,7 @@ using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
namespace Flax.Build
@@ -43,6 +44,23 @@ namespace Flax.Build
return Enumerable.Empty<T>() as T[];
}
/// <summary>
/// Gets the static field value from a given type.
/// </summary>
/// <param name="typeName">Name of the type.</param>
/// <param name="fieldName">Name of the field.</param>
/// <returns>The field value.</returns>
public static object GetStaticValue(string typeName, string fieldName)
{
var type = Type.GetType(typeName);
if (type == null)
throw new Exception($"Cannot find type \'{typeName}\'.");
var field = type.GetField(fieldName, BindingFlags.Public | BindingFlags.Static);
if (field == null)
throw new Exception($"Cannot find static public field \'{fieldName}\' in \'{typeName}\'.");
return field.GetValue(null);
}
/// <summary>
/// Gets the size of the file as a readable string.
/// </summary>