sdk: add net10.0-macos as a Stride runtime TFM (StrideExplicitMacOSRuntime opt-in)

This commit is contained in:
Virgile Bello
2026-06-11 15:04:57 +09:00
parent 9779aa5738
commit d54b8bfd43
6 changed files with 52 additions and 15 deletions
@@ -233,21 +233,28 @@
</ItemGroup>
</Target>
<!-- iOS: emit BundleResource items for the compiled assets right before the iOS SDK collects
bundle resources. Must run AFTER StrideCompileAsset (the files have to exist on disk; the
iOS SDK validates path existence) and BEFORE _CollectBundleResources (which captures the
@(BundleResource) item group into the build output). A top-level ItemGroup glob would race
on Rebuild: evaluation happens before Clean, so the items reference now-deleted files.
<!-- iOS/macOS: emit BundleResource items for the compiled assets right before the iOS/macOS SDK
collects bundle resources. Must run AFTER StrideCompileAsset (the files have to exist on
disk; the iOS SDK validates path existence) and BEFORE _CollectBundleResources (which
captures the @(BundleResource) item group into the build output). A top-level ItemGroup
glob would race on Rebuild: evaluation happens before Clean, so the items reference
now-deleted files.
ResolveProjectReferences in DependsOnTargets: Microsoft.iOS.Sdk fires _CollectBundleResources
BEFORE the standard RPR step, so without it the auto-attached CompilerApp PR hasn't been
built when StrideCompileAsset runs and the .dll-existence check errors out. -->
<Target Name="_StrideDeployAssetsAsBundleResource"
BeforeTargets="_CollectBundleResources"
DependsOnTargets="ResolveProjectReferences;StrideCompileAsset"
Condition="'$(StrideIsExecutable)' == 'true' And '$(StridePlatform)' == 'iOS'">
Condition="'$(StrideIsExecutable)' == 'true' And ('$(StridePlatform)' == 'iOS' Or '$(StridePlatform)' == 'macOS')">
<ItemGroup>
<BundleResource Include="$(StrideCompileAssetOutputPath)\**\*.*">
<LogicalName>data/%(RecursiveDir)%(Filename)%(Extension)</LogicalName>
<_StrideCompiledAsset Include="$(StrideCompileAssetOutputPath)/**/*.*" />
</ItemGroup>
<AssignTargetPath Files="@(_StrideCompiledAsset)" RootFolder="$(StrideCompileAssetOutputPath)">
<Output TaskParameter="AssignedFiles" ItemName="_StrideCompiledAssetTargeted" />
</AssignTargetPath>
<ItemGroup>
<BundleResource Include="@(_StrideCompiledAssetTargeted)">
<LogicalName>data/%(_StrideCompiledAssetTargeted.TargetPath)</LogicalName>
</BundleResource>
</ItemGroup>
</Target>
@@ -208,6 +208,13 @@ public static class PlatformFolders
#elif STRIDE_PLATFORM_UWP
return Windows.ApplicationModel.Package.Current.InstalledLocation.Path + @"\data";
#else
// macOS .app: assemblies live in Contents/MonoBundle, bundled assets in Contents/Resources.
if (OperatingSystem.IsMacOS())
{
var baseDir = AppContext.BaseDirectory.TrimEnd(Path.DirectorySeparatorChar);
if (Path.GetFileName(baseDir) == "MonoBundle")
return Path.GetFullPath(Path.Combine(baseDir, "..", "Resources", "data"));
}
return Path.Combine(GetApplicationBinaryDirectory(), "data");
#endif
}
@@ -187,10 +187,10 @@ namespace Stride.Graphics
if (indexOfLayerName >= 0)
enabledLayerNames.Add(validationLayerNames[indexOfLayerName]);
}
// Check if validation was really available
enableValidation = enabledLayerNames.Count > 0;
}
// Reset when the layer isn't actually installed; otherwise vkCreateInstance returns ErrorLayerNotPresent.
enableValidation = enabledLayerNames.Count > 0;
}
var supportedExtensionNames = stackalloc VkUtf8String[]
@@ -246,7 +246,9 @@ namespace Stride.Graphics
};
// Silence MoltenVK's per-instance info dump (153-line extension list, device banner).
// Override with MVK_CONFIG_LOG_LEVEL=3 to restore verbose output.
// Set via env var instead of VkLayerSettingsCreateInfoEXT — the layer-settings struct
// requires VK_EXT_layer_settings to be enabled, and MoltenVK acting as ICD without the
// LunarG loader doesn't always accept that pNext path.
int mvkLogLevel = 2; // 0=off 1=error 2=warning 3=info 4=debug
VkResult result;
fixed (byte* pMvkLayerName = "MoltenVK"u8)
@@ -28,12 +28,16 @@
<_StrideTestTargetFrameworks Condition="$(_StrideTestPlatforms.Contains(';Windows;')) And '$([MSBuild]::IsOSPlatform(Windows))' == 'true' And ($(_StrideTestPlatforms.Contains(';Android;')) Or $(_StrideTestPlatforms.Contains(';iOS;')))">$(_StrideTestTargetFrameworks)$(StrideFrameworkWindows);</_StrideTestTargetFrameworks>
<_StrideTestTargetFrameworks Condition="$(_StrideTestPlatforms.Contains(';Android;'))">$(_StrideTestTargetFrameworks)$(StrideFrameworkAndroid);</_StrideTestTargetFrameworks>
<_StrideTestTargetFrameworks Condition="$(_StrideTestPlatforms.Contains(';iOS;'))">$(_StrideTestTargetFrameworks)$(StrideFrameworkiOS);</_StrideTestTargetFrameworks>
<!-- macOS net10.0-macos when opted in (mirrors StrideExplicitMacOSRuntime in Stride.Frameworks.targets).
Needed for tests that consume Stride.Runtime libraries bound to Microsoft.macOS APIs
(AVFoundation, Metal, etc.) — without it the test only sees the shared $(StrideFramework). -->
<_StrideTestTargetFrameworks Condition="$(_StrideTestPlatforms.Contains(';macOS;')) And '$(StrideExplicitMacOSRuntime)' == 'true'">$(_StrideTestTargetFrameworks)$(StrideFrameworkmacOS);</_StrideTestTargetFrameworks>
<TargetFrameworks>$([MSBuild]::Unescape($(_StrideTestTargetFrameworks.TrimEnd(';'))))</TargetFrameworks>
</PropertyGroup>
<!-- Shadow host TFM exists only to dispatch ProjectReferences for the AssetCompiler.
Skip asset compile + APK packaging on it. -->
<PropertyGroup Condition="'$(TargetFramework)' == '$(StrideFramework)' And ($(_StrideTestPlatforms.Contains(';Android;')) Or $(_StrideTestPlatforms.Contains(';iOS;')))">
<PropertyGroup Condition="'$(TargetFramework)' == '$(StrideFramework)' And ($(_StrideTestPlatforms.Contains(';Android;')) Or $(_StrideTestPlatforms.Contains(';iOS;')) Or ($(_StrideTestPlatforms.Contains(';macOS;')) And '$(StrideExplicitMacOSRuntime)' == 'true'))">
<StrideCompilerSkipBuild>true</StrideCompilerSkipBuild>
</PropertyGroup>
@@ -180,6 +180,21 @@
</_SourceItemsToCopyToOutputDirectory>
</ItemGroup>
<!-- macOS: emit NativeReference Kind=Dynamic so dylibs land in Contents/MonoBundle alongside the NuGet runtime assets. -->
<ItemGroup Condition=" '$(StrideTargetFramework)' == '$(StrideFrameworkmacOS)' ">
<_StrideMacOSNativeRef Include="@(_StrideDependencyNativeLib)"
Condition="'%(_StrideDependencyNativeLib.Extension)' == '.dylib' And ('$(RuntimeIdentifier)' == '' Or $([System.String]::Copy('%(_StrideDependencyNativeLib.Link)').Contains('/$(RuntimeIdentifier)/')))" />
</ItemGroup>
<_StrideDistinctByFilename Items="@(_StrideMacOSNativeRef)" Condition=" '$(StrideTargetFramework)' == '$(StrideFrameworkmacOS)' And '@(_StrideMacOSNativeRef)' != '' ">
<Output TaskParameter="Distinct" ItemName="_StrideMacOSNativeRefUnique" />
</_StrideDistinctByFilename>
<ItemGroup Condition=" '$(StrideTargetFramework)' == '$(StrideFrameworkmacOS)' ">
<NativeReference Include="@(_StrideMacOSNativeRefUnique)">
<Kind>Dynamic</Kind>
<SmartLink>False</SmartLink>
</NativeReference>
</ItemGroup>
<!-- iOS (.NET iOS workload): static native libs (.a) must be declared via NativeReference;
the iOS linker doesn't auto-load arbitrary archives. ForceLoad=True is required because
our P/Invoke entry points are referenced only through DllImport("__Internal") and would
@@ -35,9 +35,11 @@
<!-- Add default framework no matter what (needed for references) -->
<StrideRuntimeTargetFrameworks>$(StrideFramework)</StrideRuntimeTargetFrameworks>
<!-- Desktop platforms: Add net10.0-windows only if explicitly requested -->
<!-- Most projects only need net10.0; net10.0-windows is for WPF/WinForms dependencies -->
<!-- Desktop platforms: Add net10.0-windows / net10.0-macos only if explicitly requested -->
<!-- Most projects only need net10.0; the OS-specific variants are for projects that bind
to native OS frameworks (Microsoft.Windows.* / Microsoft.macOS / AVFoundation / Metal). -->
<StrideRuntimeTargetFrameworks Condition="$(_StridePlatforms.Contains(';Windows;')) And '$(StrideExplicitWindowsRuntime)' == 'true'">$(StrideRuntimeTargetFrameworks);$(StrideFrameworkWindows)</StrideRuntimeTargetFrameworks>
<StrideRuntimeTargetFrameworks Condition="$(_StridePlatforms.Contains(';macOS;')) And '$(StrideExplicitMacOSRuntime)' == 'true'">$(StrideRuntimeTargetFrameworks);$(StrideFrameworkmacOS)</StrideRuntimeTargetFrameworks>
<!-- Mobile/UWP platforms -->
<StrideRuntimeTargetFrameworks Condition="$(_StridePlatforms.Contains(';Android;'))">$(StrideRuntimeTargetFrameworks);$(StrideFrameworkAndroid)</StrideRuntimeTargetFrameworks>