Merge branch 'dotnet10_fixes' of https://github.com/GoaLitiuM/FlaxEngine into GoaLitiuM-dotnet10_fixes
This commit is contained in:
@@ -4,6 +4,7 @@ using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
using Microsoft.Win32;
|
||||
|
||||
namespace Flax.Build
|
||||
@@ -166,6 +167,7 @@ namespace Flax.Build
|
||||
/// </summary>
|
||||
public string CSharpLanguageVersion => Version.Major switch
|
||||
{
|
||||
_ when Version.Major >= 10 => "14.0",
|
||||
_ when Version.Major >= 9 => "13.0",
|
||||
_ when Version.Major >= 8 => "12.0",
|
||||
_ when Version.Major >= 7 => "11.0",
|
||||
@@ -186,7 +188,7 @@ namespace Flax.Build
|
||||
|
||||
// Find system-installed SDK
|
||||
string dotnetPath = Environment.GetEnvironmentVariable("DOTNET_ROOT");
|
||||
string rid, ridFallback, arch;
|
||||
string arch;
|
||||
IEnumerable<string> dotnetSdkVersions = null, dotnetRuntimeVersions = null;
|
||||
switch (architecture)
|
||||
{
|
||||
@@ -208,8 +210,6 @@ namespace Flax.Build
|
||||
{
|
||||
case TargetPlatform.Windows:
|
||||
{
|
||||
rid = $"win-{arch}";
|
||||
ridFallback = "";
|
||||
#pragma warning disable CA1416
|
||||
if (string.IsNullOrEmpty(dotnetPath))
|
||||
{
|
||||
@@ -234,16 +234,12 @@ namespace Flax.Build
|
||||
}
|
||||
case TargetPlatform.Linux:
|
||||
{
|
||||
rid = $"linux-{arch}";
|
||||
ridFallback = Utilities.ReadProcessOutput("dotnet", "--info").Split('\n').FirstOrDefault(x => x.StartsWith(" RID:"), "").Replace("RID:", "").Trim();
|
||||
if (string.IsNullOrEmpty(dotnetPath))
|
||||
dotnetPath ??= SearchForDotnetLocationLinux();
|
||||
break;
|
||||
}
|
||||
case TargetPlatform.Mac:
|
||||
{
|
||||
rid = $"osx-{arch}";
|
||||
ridFallback = "";
|
||||
if (string.IsNullOrEmpty(dotnetPath))
|
||||
{
|
||||
dotnetPath = "/usr/local/share/dotnet/"; // Officially recommended dotnet location
|
||||
@@ -257,7 +253,6 @@ namespace Flax.Build
|
||||
}
|
||||
if (Flax.Build.Platforms.MacPlatform.BuildingForx64)
|
||||
{
|
||||
rid = "osx-x64";
|
||||
dotnetPath = Path.Combine(dotnetPath, "x64");
|
||||
architecture = TargetArchitecture.x64;
|
||||
}
|
||||
@@ -282,7 +277,7 @@ namespace Flax.Build
|
||||
dotnetRuntimeVersions = MergeVersions(dotnetRuntimeVersions, GetVersions(Path.Combine(dotnetPath, "shared", "Microsoft.NETCore.App")));
|
||||
|
||||
dotnetSdkVersions = dotnetSdkVersions.Where(x => File.Exists(Path.Combine(dotnetPath, "sdk", x, ".version")));
|
||||
dotnetRuntimeVersions = dotnetRuntimeVersions.Where(x => File.Exists(Path.Combine(dotnetPath, "shared", "Microsoft.NETCore.App", x, ".version")));
|
||||
dotnetRuntimeVersions = dotnetRuntimeVersions.Where(x => File.Exists(Path.Combine(dotnetPath, "shared", "Microsoft.NETCore.App", x, "System.dll")));
|
||||
dotnetRuntimeVersions = dotnetRuntimeVersions.Where(x => Directory.Exists(Path.Combine(dotnetPath, "packs", "Microsoft.NETCore.App.Ref", x)));
|
||||
|
||||
dotnetSdkVersions = dotnetSdkVersions.OrderByDescending(ParseVersion);
|
||||
@@ -331,6 +326,20 @@ namespace Flax.Build
|
||||
VersionName = dotnetSdkVersion;
|
||||
RuntimeVersionName = dotnetRuntimeVersion;
|
||||
|
||||
string rid, ridFallback = "";
|
||||
switch (platform)
|
||||
{
|
||||
case TargetPlatform.Windows: rid = $"win-{arch}"; break;
|
||||
case TargetPlatform.Linux:
|
||||
{
|
||||
rid = RuntimeInformation.RuntimeIdentifier;
|
||||
ridFallback = $"linux-{arch}";
|
||||
break;
|
||||
}
|
||||
case TargetPlatform.Mac: rid = Flax.Build.Platforms.MacPlatform.BuildingForx64 ? "osx-x64" : $"osx-{arch}"; break;
|
||||
default: throw new InvalidPlatformException(platform);
|
||||
}
|
||||
|
||||
// Pick SDK runtime
|
||||
if (!TryAddHostRuntime(platform, architecture, rid) && !TryAddHostRuntime(platform, architecture, ridFallback))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user