Fix iOS build with dotnet8 on arm64 macOS
This commit is contained in:
@@ -243,19 +243,12 @@ namespace Flax.Build
|
||||
dotnetPath = string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
bool isRunningOnArm64Targetx64 = architecture == TargetArchitecture.ARM64 && (Configuration.BuildArchitectures != null && Configuration.BuildArchitectures[0] == TargetArchitecture.x64);
|
||||
|
||||
// We need to support two paths here:
|
||||
// 1. We are running an x64 binary and we are running on an arm64 host machine
|
||||
// 2. We are running an Arm64 binary and we are targeting an x64 host machine
|
||||
if (Flax.Build.Platforms.MacPlatform.GetProcessIsTranslated() || isRunningOnArm64Targetx64)
|
||||
if (Flax.Build.Platforms.MacPlatform.BuildingForx64)
|
||||
{
|
||||
rid = "osx-x64";
|
||||
dotnetPath = Path.Combine(dotnetPath, "x64");
|
||||
architecture = TargetArchitecture.x64;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
default: throw new InvalidPlatformException(platform);
|
||||
@@ -472,6 +465,8 @@ namespace Flax.Build
|
||||
{
|
||||
var versions = GetVersions(root);
|
||||
var version = GetVersion(versions);
|
||||
if (version == null)
|
||||
throw new Exception($"Failed to select dotnet version from '{root}' ({string.Join(", ", versions)})");
|
||||
return Path.Combine(root, version);
|
||||
}
|
||||
|
||||
|
||||
@@ -73,6 +73,19 @@ namespace Flax.Build.Platforms
|
||||
Utilities.Run("codesign", cmdLine, null, null, Utilities.RunOptions.Default | Utilities.RunOptions.ThrowExceptionOnError);
|
||||
}
|
||||
|
||||
internal static bool BuildingForx64
|
||||
{
|
||||
get
|
||||
{
|
||||
// We need to support two paths here:
|
||||
// 1. We are running an x64 binary and we are running on an arm64 host machine
|
||||
// 2. We are running an Arm64 binary and we are targeting an x64 host machine
|
||||
var architecture = Platform.BuildTargetArchitecture;
|
||||
bool isRunningOnArm64Targetx64 = architecture == TargetArchitecture.ARM64 && (Configuration.BuildArchitectures != null && Configuration.BuildArchitectures[0] == TargetArchitecture.x64);
|
||||
return GetProcessIsTranslated() || isRunningOnArm64Targetx64;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if running an x64 binary an arm64 host machine.
|
||||
/// </summary>
|
||||
|
||||
@@ -65,8 +65,11 @@ namespace Flax.Build.Platforms
|
||||
switch (options.Action)
|
||||
{
|
||||
case CSharpOptions.ActionTypes.GetPlatformTools:
|
||||
options.PlatformToolsPath = Path.Combine(DotNetSdk.SelectVersionFolder(Path.Combine(DotNetSdk.Instance.RootPath, "packs/Microsoft.NETCore.App.Runtime.AOT.osx-x64.Cross.ios-arm64")), "tools");
|
||||
{
|
||||
var arch = Flax.Build.Platforms.MacPlatform.BuildingForx64 ? "x64" : "arm64";
|
||||
options.PlatformToolsPath = Path.Combine(DotNetSdk.SelectVersionFolder(Path.Combine(DotNetSdk.Instance.RootPath, $"packs/Microsoft.NETCore.App.Runtime.AOT.osx-{arch}.Cross.ios-arm64")), "tools");
|
||||
return false;
|
||||
}
|
||||
case CSharpOptions.ActionTypes.MonoCompile:
|
||||
{
|
||||
var aotCompilerPath = Path.Combine(options.PlatformToolsPath, "mono-aot-cross");
|
||||
|
||||
Reference in New Issue
Block a user