Merge remote-tracking branch 'origin/master' into 1.7

This commit is contained in:
Wojtek Figat
2023-09-19 21:42:53 +02:00
49 changed files with 1684 additions and 1336 deletions

View File

@@ -1355,6 +1355,7 @@ namespace Flax.Build.Bindings
public static class NativeToManaged
{
public static {{classInfo.Name}} ConvertToManaged(IntPtr unmanaged) => Unsafe.As<{{classInfo.Name}}>(ManagedHandleMarshaller.NativeToManaged.ConvertToManaged(unmanaged));
public static IntPtr ConvertToUnmanaged({{classInfo.Name}} managed) => ManagedHandleMarshaller.ManagedToNative.ConvertToUnmanaged(managed);
public static void Free(IntPtr unmanaged) => ManagedHandleMarshaller.NativeToManaged.Free(unmanaged);
}
#if FLAX_EDITOR
@@ -1362,6 +1363,7 @@ namespace Flax.Build.Bindings
#endif
public static class ManagedToNative
{
public static {{classInfo.Name}} ConvertToManaged(IntPtr unmanaged) => Unsafe.As<{{classInfo.Name}}>(ManagedHandleMarshaller.NativeToManaged.ConvertToManaged(unmanaged));
public static IntPtr ConvertToUnmanaged({{classInfo.Name}} managed) => ManagedHandleMarshaller.ManagedToNative.ConvertToUnmanaged(managed);
public static void Free(IntPtr unmanaged) => ManagedHandleMarshaller.ManagedToNative.Free(unmanaged);
}
@@ -1671,6 +1673,7 @@ namespace Flax.Build.Bindings
contents.Append(indent).AppendLine("[HideInEditor]");
contents.Append(indent).AppendLine("public static class NativeToManaged").Append(indent).AppendLine("{");
contents.Append(indent2).AppendLine($"public static {structureInfo.Name} ConvertToManaged({structureInfo.Name}Internal unmanaged) => {marshallerName}.ToManaged(unmanaged);");
contents.Append(indent2).AppendLine($"public static {structureInfo.Name}Internal ConvertToUnmanaged({structureInfo.Name} managed) => {marshallerName}.ToNative(managed);");
contents.Append(indent2).AppendLine($"public static void Free({structureInfo.Name}Internal unmanaged)");
contents.Append(indent2).AppendLine("{").Append(indent3).AppendLine(freeContents2.Replace("\n", "\n" + indent3).ToString().TrimEnd()).Append(indent2).AppendLine("}");
contents.Append(indent).AppendLine("}");
@@ -1679,6 +1682,7 @@ namespace Flax.Build.Bindings
if (buildData.Target != null && buildData.Target.IsEditor)
contents.Append(indent).AppendLine("[HideInEditor]");
contents.Append(indent).AppendLine($"public static class ManagedToNative").Append(indent).AppendLine("{");
contents.Append(indent2).AppendLine($"public static {structureInfo.Name} ConvertToManaged({structureInfo.Name}Internal unmanaged) => {marshallerName}.ToManaged(unmanaged);");
contents.Append(indent2).AppendLine($"public static {structureInfo.Name}Internal ConvertToUnmanaged({structureInfo.Name} managed) => {marshallerName}.ToNative(managed);");
contents.Append(indent2).AppendLine($"public static void Free({structureInfo.Name}Internal unmanaged) => {marshallerName}.Free(unmanaged);");
contents.Append(indent).AppendLine("}");

View File

@@ -207,6 +207,7 @@ namespace Flax.Build
case TargetPlatform.Mac:
{
#if USE_NETCORE
dotnetPath = Path.Combine(dotnetSdk.RootPath, "dotnet");
cscPath = Path.Combine(dotnetSdk.RootPath, $"sdk/{dotnetSdk.VersionName}/Roslyn/bincore/csc.dll");
referenceAssemblies = Path.Combine(dotnetSdk.RootPath, $"packs/Microsoft.NETCore.App.Ref/{dotnetSdk.RuntimeVersionName}/ref/net{runtimeVersionShort}/");
referenceAnalyzers = Path.Combine(dotnetSdk.RootPath, $"packs/Microsoft.NETCore.App.Ref/{dotnetSdk.RuntimeVersionName}/analyzers/dotnet/cs/");

View File

@@ -212,6 +212,15 @@ namespace Flax.Build
ridFallback = "";
if (string.IsNullOrEmpty(dotnetPath))
dotnetPath = "/usr/local/share/dotnet/";
// Use x64 when cross-compiling from ARM64
if (architecture == TargetArchitecture.ARM64 && (Configuration.BuildArchitectures != null && Configuration.BuildArchitectures[0] == TargetArchitecture.x64))
{
rid = "osx-x64";
dotnetPath = Path.Combine(dotnetPath, "x64");
architecture = TargetArchitecture.x64;
}
break;
}
default: throw new InvalidPlatformException(platform);
@@ -271,7 +280,7 @@ namespace Flax.Build
// Found
IsValid = true;
Log.Verbose($"Found .NET SDK {VersionName} (runtime {RuntimeVersionName}) at {RootPath}");
Log.Info($"Using .NET SDK {VersionName}, runtime {RuntimeVersionName} ({RootPath})");
foreach (var e in _hostRuntimes)
Log.Verbose($" - Host Runtime for {e.Key.Key} {e.Key.Value}");
}

View File

@@ -1,5 +1,7 @@
// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved.
using System.IO;
namespace Flax.Build.Platforms
{
/// <summary>
@@ -11,6 +13,9 @@ namespace Flax.Build.Platforms
/// <inheritdoc />
public override TargetPlatform Target => TargetPlatform.iOS;
/// <inheritdoc />
public override bool HasRequiredSDKsInstalled { get; }
/// <inheritdoc />
public override bool HasDynamicCodeExecutionSupport => false;
@@ -21,11 +26,21 @@ namespace Flax.Build.Platforms
{
if (Platform.BuildTargetPlatform != TargetPlatform.Mac)
return;
if (!HasRequiredSDKsInstalled)
if (!XCode.Instance.IsValid)
{
Log.Warning("Missing XCode. Cannot build for iOS platform.");
return;
}
// We should check and see if the actual iphoneSDK is installed
string iphoneSDKPath = Utilities.ReadProcessOutput("/usr/bin/xcrun", "--sdk iphoneos --show-sdk-path");
if (string.IsNullOrEmpty(iphoneSDKPath) || !Directory.Exists(iphoneSDKPath))
{
Log.Warning("Missing iPhoneSDK. Cannot build for iOS platform.");
HasRequiredSDKsInstalled = false;
}
else
HasRequiredSDKsInstalled = true;
}
/// <inheritdoc />