Migrate Xbox to using static linking with nethost lib

This commit is contained in:
Wojtek Figat
2025-11-14 14:56:10 +01:00
parent 2a36edf528
commit 2f670495ac
2 changed files with 16 additions and 6 deletions

View File

@@ -48,9 +48,6 @@ public class nethost : ThirdPartyModule
switch (options.Platform.Target)
{
case TargetPlatform.Windows:
case TargetPlatform.XboxOne:
case TargetPlatform.XboxScarlett:
case TargetPlatform.UWP:
if (hostRuntime.Type == DotNetSdk.HostType.CoreCLR)
{
options.OutputFiles.Add(Path.Combine(hostRuntime.Path, "nethost.lib"));
@@ -63,6 +60,11 @@ public class nethost : ThirdPartyModule
options.DependencyFiles.Add(Path.Combine(hostRuntime.Path, "coreclr.dll"));
}
break;
case TargetPlatform.XboxOne:
case TargetPlatform.XboxScarlett:
options.OutputFiles.Add(Path.Combine(hostRuntime.Path, "monosgen-2.0.lib"));
options.OutputFiles.Add(Path.Combine(hostRuntime.Path, "mono-profiler-aot.lib"));
break;
case TargetPlatform.Linux:
options.OutputFiles.Add(Path.Combine(hostRuntime.Path, "libnethost.a"));
options.DependencyFiles.Add(Path.Combine(hostRuntime.Path, "libnethost.so"));

View File

@@ -89,7 +89,10 @@ namespace Flax.Deps.Dependencies
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";
var defines = "-D_GAMING_XBOX=1-DDISABLE_JIT=1-DENABLE_PERFTRACING=0-DDISABLE_REFLECTION_EMIT=1-DDISABLE_EVENTPIPE=1-DDISABLE_COM=1-DDISABLE_PROFILER=1-DDISABLE_COMPONENTS=1";
defines += targetPlatform == TargetPlatform.XboxScarlett ? "-D_GAMING_XBOX_SCARLETT=1" : "-D_GAMING_XBOX_XBOXONE=1";
defines += "-DDISABLE_EXECUTABLES=1-DDISABLE_SHARED_LIBS=1";
buildArgs = $" -subset mono+libs -cmakeargs \"{defines}\" /p:FeaturePerfTracing=false /p:FeatureWin32Registry=false /p:FeatureCominteropApartmentSupport=false /p:FeatureManagedEtw=false /p:FeatureManagedEtwChannels=false /p:FeatureEtw=false /p:ApiCompatValidateAssemblies=false";
break;
case TargetPlatform.Linux:
os = "linux";
@@ -241,8 +244,13 @@ namespace Flax.Deps.Dependencies
case TargetPlatform.XboxScarlett:
libs1 = new[]
{
"lib/coreclr.dll",
"lib/coreclr.import.lib",
// When using shared library:
//"lib/coreclr.dll",
//"lib/coreclr.import.lib",
// When using static library:
"lib/monosgen-2.0.lib",
"lib/mono-profiler-aot.lib",
};
libs2 = new string[]
{