Update to build for Xbox
This commit is contained in:
@@ -211,7 +211,7 @@ namespace Flax.Build
|
||||
/// </summary>
|
||||
/// <param name="targetPlatform">The target platform.</param>
|
||||
/// <param name="nullIfMissing">True if return null platform if it's missing, otherwise will invoke an exception.</param>
|
||||
/// <returns>The toolchain.</returns>
|
||||
/// <returns>The platform.</returns>
|
||||
public static Platform GetPlatform(TargetPlatform targetPlatform, bool nullIfMissing = false)
|
||||
{
|
||||
if (_platforms == null)
|
||||
|
||||
@@ -30,6 +30,8 @@ namespace Flax.Deps.Dependencies
|
||||
TargetPlatform.PS4,
|
||||
TargetPlatform.PS5,
|
||||
TargetPlatform.Switch,
|
||||
TargetPlatform.XboxOne,
|
||||
TargetPlatform.XboxScarlett,
|
||||
};
|
||||
case TargetPlatform.Linux:
|
||||
return new[]
|
||||
@@ -85,6 +87,13 @@ namespace Flax.Deps.Dependencies
|
||||
os = "windows";
|
||||
runtimeFlavor = "CoreCLR";
|
||||
break;
|
||||
case TargetPlatform.XboxOne:
|
||||
case TargetPlatform.XboxScarlett:
|
||||
os = "windows";
|
||||
runtimeFlavor = "Mono";
|
||||
buildMonoAotCross = true;
|
||||
buildArgs = $" -subset mono+libs -cmakeargs \"-DDISABLE_JIT=1-DENABLE_PERFTRACING=0-DDISABLE_REFLECTION_EMIT=1-DDISABLE_EVENTPIPE=1-DDISABLE_COM=1-DDISABLE_PROFILER=1-DDISABLE_COMPONENTS=1\" /p:FeaturePerfTracing=false /p:FeatureManagedEtw=false /p:FeatureManagedEtwChannels=false /p:FeatureEtw=false /p:ApiCompatValidateAssemblies=false";
|
||||
break;
|
||||
case TargetPlatform.Linux:
|
||||
os = "linux";
|
||||
runtimeFlavor = "CoreCLR";
|
||||
@@ -225,22 +234,42 @@ namespace Flax.Deps.Dependencies
|
||||
if (!Directory.Exists(src1))
|
||||
throw new DirectoryNotFoundException(src1);
|
||||
var src2 = Path.Combine(artifacts, "bin", "native", $"{framework}-{os}-{configuration}-{arch}");
|
||||
if (!Directory.Exists(src1))
|
||||
if (!Directory.Exists(src2))
|
||||
throw new DirectoryNotFoundException(src2);
|
||||
foreach (var file in new[]
|
||||
{
|
||||
"libmonosgen-2.0.a",
|
||||
"libmono-profiler-aot.a",
|
||||
})
|
||||
Utilities.FileCopy(Path.Combine(src1, "lib", file), Path.Combine(dstBinaries, file));
|
||||
foreach (var file in new[]
|
||||
{
|
||||
"libSystem.Globalization.Native.a",
|
||||
"libSystem.IO.Compression.Native.a",
|
||||
"libSystem.IO.Ports.Native.a",
|
||||
"libSystem.Native.a",
|
||||
})
|
||||
Utilities.FileCopy(Path.Combine(src2, "lib", file), Path.Combine(dstBinaries, file));
|
||||
string[] libs1, libs2;
|
||||
switch (targetPlatform)
|
||||
{
|
||||
case TargetPlatform.Windows:
|
||||
case TargetPlatform.XboxOne:
|
||||
case TargetPlatform.XboxScarlett:
|
||||
libs1 = new[]
|
||||
{
|
||||
"lib/coreclr.dll",
|
||||
"lib/coreclr.import.lib",
|
||||
};
|
||||
libs2 = new string[]
|
||||
{
|
||||
};
|
||||
break;
|
||||
default:
|
||||
libs1 = new[]
|
||||
{
|
||||
"lib/libmonosgen-2.0.a",
|
||||
"lib/libmono-profiler-aot.a",
|
||||
};
|
||||
libs2 = new[]
|
||||
{
|
||||
"lib/libSystem.Globalization.Native.a",
|
||||
"lib/libSystem.IO.Compression.Native.a",
|
||||
"lib/libSystem.IO.Ports.Native.a",
|
||||
"lib/libSystem.Native.a",
|
||||
};
|
||||
break;
|
||||
}
|
||||
foreach (var file in libs1)
|
||||
Utilities.FileCopy(Path.Combine(src1, file), Path.Combine(dstBinaries, Path.GetFileName(file)));
|
||||
foreach (var file in libs2)
|
||||
Utilities.FileCopy(Path.Combine(src2, file), Path.Combine(dstBinaries, Path.GetFileName(file)));
|
||||
|
||||
// Include headers
|
||||
Utilities.DirectoryDelete(Path.Combine(dstBinaries, "include"));
|
||||
@@ -249,11 +278,13 @@ namespace Flax.Deps.Dependencies
|
||||
if (buildMonoAotCross)
|
||||
{
|
||||
// AOT compiler
|
||||
Utilities.FileCopy(Path.Combine(artifacts, "bin", "mono", $"{os}.x64.{configuration}", "cross", $"{os}-x64", "mono-aot-cross.exe"), Path.Combine(dstPlatform, "Binaries", "Tools", "mono-aot-cross.exe"));
|
||||
Utilities.FileCopy(Path.Combine(artifacts, "bin", "mono", $"{os}.x64.{configuration}", "cross", $"{(os == "windows" ? "win" : os)}-x64", "mono-aot-cross.exe"), Path.Combine(dstPlatform, "Binaries", "Tools", "mono-aot-cross.exe"));
|
||||
}
|
||||
|
||||
// Class library
|
||||
var dstDotnetLib = Path.Combine(dstPlatform, "Dotnet", "lib", framework);
|
||||
foreach (var subDir in Directory.GetDirectories(Path.Combine(dstPlatform, "Dotnet", "lib")))
|
||||
Utilities.DirectoryDelete(subDir);
|
||||
SetupDirectory(dstDotnetLib, true);
|
||||
Utilities.FileCopy(Path.Combine(artifacts, "bin", "mono", $"{os}.{arch}.{configuration}", privateCoreLib), Path.Combine(dstDotnetLib, privateCoreLib));
|
||||
Utilities.DirectoryCopy(Path.Combine(artifacts, "bin", "runtime", $"{framework}-{os}-{configuration}-{arch}"), dstDotnetLib, false, true, "*.dll");
|
||||
@@ -300,6 +331,8 @@ namespace Flax.Deps.Dependencies
|
||||
{
|
||||
case TargetPlatform.PS4:
|
||||
case TargetPlatform.PS5:
|
||||
case TargetPlatform.XboxOne:
|
||||
case TargetPlatform.XboxScarlett:
|
||||
Build(options, platform, TargetArchitecture.x64);
|
||||
break;
|
||||
case TargetPlatform.Android:
|
||||
|
||||
@@ -18,13 +18,13 @@ namespace Flax.Build.Platforms
|
||||
protected GDKPlatform()
|
||||
{
|
||||
// Visual Studio 2017 or newer required
|
||||
var visualStudio = VisualStudioInstance.GetInstances().FirstOrDefault(x => x.Version == VisualStudioVersion.VisualStudio2017 || x.Version == VisualStudioVersion.VisualStudio2019);
|
||||
var visualStudio = VisualStudioInstance.GetInstances().FirstOrDefault(x => x.Version >= VisualStudioVersion.VisualStudio2017);
|
||||
if (visualStudio == null)
|
||||
_hasRequiredSDKsInstalled = false;
|
||||
|
||||
// Windows 10.0.19041.0 SDK or newer required
|
||||
var sdks = GetSDKs();
|
||||
if (!sdks.ContainsKey(WindowsPlatformSDK.v10_0_19041_0))
|
||||
if (sdks.All(x => x.Key < WindowsPlatformSDK.v10_0_19041_0))
|
||||
_hasRequiredSDKsInstalled = false;
|
||||
|
||||
// v141 toolset or newer required
|
||||
@@ -33,9 +33,7 @@ namespace Flax.Build.Platforms
|
||||
!toolsets.ContainsKey(WindowsPlatformToolset.v142) &&
|
||||
!toolsets.ContainsKey(WindowsPlatformToolset.v143) &&
|
||||
!toolsets.ContainsKey(WindowsPlatformToolset.v144))
|
||||
{
|
||||
_hasRequiredSDKsInstalled = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Flax.Build.NativeCpp;
|
||||
|
||||
namespace Flax.Build.Platforms
|
||||
@@ -19,8 +18,9 @@ namespace Flax.Build.Platforms
|
||||
/// </summary>
|
||||
/// <param name="platform">The platform.</param>
|
||||
/// <param name="architecture">The architecture.</param>
|
||||
protected GDKToolchain(GDKPlatform platform, TargetArchitecture architecture)
|
||||
: base(platform, architecture, WindowsPlatformBase.GetToolsets().Keys.Where(x => x <= WindowsPlatformToolset.v142).Max(), WindowsPlatformSDK.v10_0_19041_0)
|
||||
/// <param name="toolset">The Windows toolset to use.</param>
|
||||
protected GDKToolchain(GDKPlatform platform, TargetArchitecture architecture, WindowsPlatformToolset toolset = WindowsPlatformToolset.Latest)
|
||||
: base(platform, architecture, toolset, WindowsPlatformSDK.Latest)
|
||||
{
|
||||
// Setup system paths
|
||||
SystemIncludePaths.Add(Path.Combine(GDK.Instance.RootPath, "GRDK\\GameKit\\Include"));
|
||||
@@ -42,7 +42,7 @@ namespace Flax.Build.Platforms
|
||||
|
||||
options.LinkEnv.InputLibraries.Add("xgameruntime.lib");
|
||||
options.LinkEnv.InputLibraries.Add("xgameplatform.lib");
|
||||
options.LinkEnv.InputLibraries.Add("Microsoft.Xbox.Services.142.GDK.C.lib");
|
||||
options.LinkEnv.InputLibraries.Add($"Microsoft.Xbox.Services.{(int)Toolset}.GDK.C.lib");
|
||||
|
||||
var toolsetPath = WindowsPlatformBase.GetToolsets()[Toolset];
|
||||
var toolsPath = WindowsPlatformBase.GetVCToolPath64(Toolset);
|
||||
|
||||
@@ -62,10 +62,10 @@ namespace Flax.Build.Platforms
|
||||
case TargetPlatform.UWP: return GetSDKs().FirstOrDefault(x => x.Key != WindowsPlatformSDK.v8_1).Value != null;
|
||||
case TargetPlatform.PS4: return Sdk.HasValid("PS4Sdk");
|
||||
case TargetPlatform.PS5: return Sdk.HasValid("PS5Sdk");
|
||||
case TargetPlatform.XboxOne:
|
||||
case TargetPlatform.XboxScarlett: return GetSDKs().ContainsKey(WindowsPlatformSDK.v10_0_19041_0) && Sdk.HasValid("GDK");
|
||||
case TargetPlatform.Android: return AndroidSdk.Instance.IsValid && AndroidNdk.Instance.IsValid;
|
||||
case TargetPlatform.Switch: return Sdk.HasValid("SwitchSdk");
|
||||
case TargetPlatform.XboxOne:
|
||||
case TargetPlatform.XboxScarlett: return GetPlatform(platform, true)?.HasRequiredSDKsInstalled ?? false;
|
||||
default: return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user