From 882475d33d0f0f9bb14f2bee65bb24c63e18e666 Mon Sep 17 00:00:00 2001 From: Ryland <41491307+ryalanms@users.noreply.github.com> Date: Wed, 20 Jan 2021 13:35:03 -0800 Subject: [PATCH 1/3] Update WPF Arcade SDK to support ARM64 Co-authored-by: Alexandre Zollinger Chohfi Co-authored-by: Marcpems Co-authored-by: Juan Sebastian Hoyos Ayala Co-authored-by: Ryland <41491307+ryalanms@users.noreply.github.com> --- eng/WpfArcadeSdk/Sdk/Sdk.props | 3 +- .../tools/AddDrtsToPayload.targets | 2 +- .../tools/InjectModuleInitializer.targets | 5 + eng/WpfArcadeSdk/tools/Packaging.props | 4 +- eng/WpfArcadeSdk/tools/Packaging.targets | 238 +++++++++--------- eng/WpfArcadeSdk/tools/Redist.targets | 2 +- eng/WpfArcadeSdk/tools/SdkReferences.targets | 49 ++-- eng/WpfArcadeSdk/tools/Wpf.Cpp.props | 5 +- eng/WpfArcadeSdk/tools/Wpf.Cpp.targets | 146 +++++------ 9 files changed, 241 insertions(+), 213 deletions(-) diff --git a/eng/WpfArcadeSdk/Sdk/Sdk.props b/eng/WpfArcadeSdk/Sdk/Sdk.props index a4fa29e585b..e500f12e20f 100644 --- a/eng/WpfArcadeSdk/Sdk/Sdk.props +++ b/eng/WpfArcadeSdk/Sdk/Sdk.props @@ -22,8 +22,9 @@ Properly calculates the RuntimeIdentifier based on the Platform type. We don't want to affect the build by actually setting RuntimeIdentifier. Those that are interested in setting the RuntimeIdentifier or having a property that mirrors it can use this one here. --> - win-$(Platform) + win-$(Platform) win-x86 + win-arm64 diff --git a/eng/WpfArcadeSdk/tools/AddDrtsToPayload.targets b/eng/WpfArcadeSdk/tools/AddDrtsToPayload.targets index 60c1044a63f..3ddd3d66669 100644 --- a/eng/WpfArcadeSdk/tools/AddDrtsToPayload.targets +++ b/eng/WpfArcadeSdk/tools/AddDrtsToPayload.targets @@ -8,7 +8,7 @@ --> - x64 + $(Platform) $(RepoRoot)artifacts\test\$(Configuration)\$(Platform)\ diff --git a/eng/WpfArcadeSdk/tools/InjectModuleInitializer.targets b/eng/WpfArcadeSdk/tools/InjectModuleInitializer.targets index 3cd0b5ecc4c..c80e2749bd0 100644 --- a/eng/WpfArcadeSdk/tools/InjectModuleInitializer.targets +++ b/eng/WpfArcadeSdk/tools/InjectModuleInitializer.targets @@ -22,7 +22,12 @@ $(Pkgruntime_win-x64_Microsoft_NETCore_ILDAsm)\runtimes\$(WpfRuntimeIdentifier)\native\ $(Pkgruntime_win-x64_Microsoft_NETCore_ILAsm)\runtimes\$(WpfRuntimeIdentifier)\native\ $(Pkgruntime_win-x64_Microsoft_NETCore_Runtime_CoreCLR)\runtimes\$(WpfRuntimeIdentifier)\native\ + + + $(Pkgruntime_win-arm64_Microsoft_NETCore_ILDAsm)\runtimes\$(WpfRuntimeIdentifier)\native\ + $(Pkgruntime_win-arm64_Microsoft_NETCore_ILAsm)\runtimes\$(WpfRuntimeIdentifier)\native\ + $(Pkgruntime_win-arm64_Microsoft_NETCore_Runtime_CoreCLR)\runtimes\$(WpfRuntimeIdentifier)\native\ diff --git a/eng/WpfArcadeSdk/tools/Packaging.props b/eng/WpfArcadeSdk/tools/Packaging.props index 329eda0c4c5..ad1383c18db 100644 --- a/eng/WpfArcadeSdk/tools/Packaging.props +++ b/eng/WpfArcadeSdk/tools/Packaging.props @@ -1,7 +1,7 @@ - $(ArtifactsDir)packaging\$(Configuration)\$(Platform)\ - $(ArtifactsDir)packaging\$(Configuration)\ + $(ArtifactsDir)packaging\$(Configuration)\$(Platform)\ + $(ArtifactsDir)packaging\$(Configuration)\ runtime.win-$(Platform) diff --git a/eng/WpfArcadeSdk/tools/Packaging.targets b/eng/WpfArcadeSdk/tools/Packaging.targets index e1ca54cb289..e52e94640f8 100644 --- a/eng/WpfArcadeSdk/tools/Packaging.targets +++ b/eng/WpfArcadeSdk/tools/Packaging.targets @@ -5,9 +5,9 @@ lib - - @@ -19,45 +19,45 @@ true MSBuildSdk - - @@ -86,6 +86,7 @@ $(PreparePackageAssetsDependsOn): runtimes\win-x86\native\ runtimes\win-x64\native\ + runtimes\win-arm64\native\ - + - + - - @@ -203,26 +204,26 @@ $(PreparePackageAssetsDependsOn): Include="%(PackagingContent.Identity)" RelativePath="$(ArtifactsPackagingDir)$(NormalizedPackageName)\content"/> - + + runtimes\win-x86\native\ + runtimes\win-x64\native\ + runtimes\win-arm64\native\ + + true $(LibFolder) - + true @@ -320,28 +327,28 @@ $(PreparePackageAssetsDependsOn): $(LibFolder) - + true - runtimes + $(DestinationRuntimeSubFolder) - + true - runtimes + $(DestinationRuntimeSubFolder) - + true - runtimes + $(DestinationRuntimeSubFolder) - + true - runtimes + $(DestinationRuntimeSubFolder) %(PackagingRootFolderSubFolders.Identity) - + - - @@ -400,15 +407,15 @@ $(PreparePackageAssetsDependsOn): - - + --> @@ -447,6 +454,11 @@ $(PreparePackageAssetsDependsOn): "$(NormalizedPackageName)": { "runtime.win-x86.$(PackageName)": "$(PackageVersion)" } + }, + "win-arm64": { + "$(NormalizedPackageName)": { + "runtime.win-arm64.$(PackageName)": "$(PackageVersion)" + } } } } @@ -468,5 +480,5 @@ $(PreparePackageAssetsDependsOn): - + diff --git a/eng/WpfArcadeSdk/tools/Redist.targets b/eng/WpfArcadeSdk/tools/Redist.targets index 4a6424ad8a8..a906ff97e27 100644 --- a/eng/WpfArcadeSdk/tools/Redist.targets +++ b/eng/WpfArcadeSdk/tools/Redist.targets @@ -25,4 +25,4 @@ - \ No newline at end of file + diff --git a/eng/WpfArcadeSdk/tools/SdkReferences.targets b/eng/WpfArcadeSdk/tools/SdkReferences.targets index 7df00da9fde..fbc3b63f8e6 100644 --- a/eng/WpfArcadeSdk/tools/SdkReferences.targets +++ b/eng/WpfArcadeSdk/tools/SdkReferences.targets @@ -4,13 +4,13 @@ Version="$(MicrosoftPrivateWinformsVersion)" ExcludeAssets="All" GeneratePathProperty="True" - Condition="'$(MSBuildProjectExtension)'!='.vcxproj' - And '$(TargetFrameworkIdentifier)' == '.NETCoreApp' - And ('$(TargetFrameworkVersion)' == 'v3.0' Or '$(TargetFrameworkVersion)' == 'v3.1' Or '$(TargetFrameworkVersion)' == 'v5.0') + Condition="'$(MSBuildProjectExtension)'!='.vcxproj' + And '$(TargetFrameworkIdentifier)' == '.NETCoreApp' + And ('$(TargetFrameworkVersion)' == 'v3.0' Or '$(TargetFrameworkVersion)' == 'v3.1' Or '$(TargetFrameworkVersion)' == 'v5.0') And '$(NoAutoMicrosoftPrivateWinformsReference)'!='true'"/> - $(Pkgruntime_win-x86_Microsoft_DotNet_Wpf_GitHub) $(Pkgruntime_win-x86_Microsoft_DotNet_Wpf_GitHub_Debug) - + $(Pkgruntime_win-x64_Microsoft_DotNet_Wpf_GitHub) $(Pkgruntime_win-x64_Microsoft_DotNet_Wpf_GitHub_Debug) + + $(Pkgruntime_win-arm64_Microsoft_DotNet_Wpf_GitHub) + $(Pkgruntime_win-arm64_Microsoft_DotNet_Wpf_GitHub_Debug) - - - - + - + - x86 x64 - $(Windows10SdkPath)bin\$(WindowsTargetPlatformVersion)\$(Architecture)\tracewpp.exe + + x64 + $(Architecture) + $(Windows10SdkPath)bin\$(WindowsTargetPlatformVersion)\$(TraceWppArchitecture)\tracewpp.exe $(ManagedCxx) true diff --git a/eng/WpfArcadeSdk/tools/Wpf.Cpp.targets b/eng/WpfArcadeSdk/tools/Wpf.Cpp.targets index 45bf6476607..86bdeeba5d0 100644 --- a/eng/WpfArcadeSdk/tools/Wpf.Cpp.targets +++ b/eng/WpfArcadeSdk/tools/Wpf.Cpp.targets @@ -4,10 +4,10 @@ $([System.IO.Path]::GetDirectoryName($(NativeVersionFile))) $(IntermediateOutputPath)ExtendedNativeVersion.rc - + - $(VCToolsInstallDir)lib\$(Architecture)\ @@ -15,7 +15,7 @@ - + %(AdditionalIncludeDirectories);$(WpfSharedDir)inc\ @@ -27,12 +27,12 @@ %(AdditionalIncludeDirectories);$(NativeVersionFileDirectory);$(WpfTracingDir)native\ $(WpfSharedDir)inc\ddbanned.h - - oldStyle @@ -43,10 +43,10 @@ %(AdditionalIncludeDirectories);$(NativeVersionFileDirectory) - - - @@ -82,9 +82,9 @@ - @@ -103,7 +103,7 @@ - + <_WindowsFileVersion>$(FileVersion.Replace('.', ',')) <_SourceBuildInfo> %40Commit: $(SourceRevisionId) @@ -112,15 +112,15 @@ <_VFT_APP>0x00000001 <_VFT_DLL>0x00000002 <_VFT_UNKNOWN>0x00000000 - + <_VOS_NT_WINDOWS32>0x00040004 - + <_VS_FF_DEBUG>0x00000001 - + <_VerFileTypeValue>$(_VFT_UNKNOWN) <_VerFileTypeValue Condition="'$(ConfigurationType)' =='Application'">$(_VFT_APP) <_VerFileTypeValue Condition="'$(ConfigurationType)' =='DynamicLibrary'">$(_VFT_DLL) - + <_ExtendedNativeVersionFileContents> <_ExtendenNativeVersionFileLines Include="$(_ExtendedNativeVersionFileContents)" /> - + @@ -200,7 +200,7 @@ END We needed to ensure a few preconditions for this target, which necessitated a custom version to be written - this target has to execute prior to ResolveAssemblyReferences InitializeAssemblyAttributeInformation (defined in ExtendedAssemblyInfo.targets) must run prior to this target, to ensure that $(FileVersion) is populated - Additional assembly scope attributes besides TargetFrameworkAttribute are added here + Additional assembly scope attributes besides TargetFrameworkAttribute are added here --> @@ -288,21 +288,21 @@ using namespace System::Runtime::Versioning; - - @@ -327,7 +327,7 @@ using namespace System::Runtime::Versioning; net5.0 - AnyCPU%3Bx64 + AnyCPU%3Bx64%3Barm64 ]]> @@ -338,7 +338,7 @@ using namespace System::Runtime::Versioning; <_AdditionalPackages Remove="%40(_AdditionalPackages)" /> <_AdditionalPackages Include="%24(AdditionalPackages)" /> - - - + - + - + - @@ -401,11 +401,11 @@ using namespace System::Runtime::Versioning; + Properties="TargetFramework=$(TargetFramework);Platform=$(Architecture);RuntimeIdentifier=win10-$(Architecture)"> - @@ -431,24 +431,24 @@ using namespace System::Runtime::Versioning; - - @@ -473,14 +473,16 @@ using namespace System::Runtime::Versioning; net5.0 - AnyCPU%3Bx64 + AnyCPU%3Bx64%3Barm64 ]]> - - @@ -488,21 +490,21 @@ using namespace System::Runtime::Versioning; ]]> - + + true - + %24(Pkgruntime_win-x86_Microsoft_DotNet_Wpf_DncEng)\runtimes\win-x86\native\ %24(Pkgruntime_win-x64_Microsoft_DotNet_Wpf_DncEng)\runtimes\win-x64\native\ + %24(Pkgruntime_win-arm64_Microsoft_DotNet_Wpf_DncEng)\runtimes\win-arm64\native\ - + %24(Pkgruntime_win-x86_Microsoft_DotNet_Wpf_DncEng_Debug)\runtimes\win-x86\native\ %24(Pkgruntime_win-x64_Microsoft_DotNet_Wpf_DncEng_Debug)\runtimes\win-x64\native\ + %24(Pkgruntime_win-arm64_Microsoft_DotNet_Wpf_DncEng_Debug)\runtimes\win-arm64\native\ - + @@ -539,9 +543,9 @@ using namespace System::Runtime::Versioning; File="$(CppHelperProject)" Overwrite="false"/> - @@ -554,11 +558,11 @@ using namespace System::Runtime::Versioning; - + Properties="TargetFramework=$(TfmForBuild);Platform=$(Architecture);RuntimeIdentifier=win10-$(Architecture);IsRestoring=true" /> + + Properties="TargetFramework=$(TfmForBuild);Platform=$(Architecture);RuntimeIdentifier=win10-$(Architecture)"> @@ -588,7 +592,7 @@ using namespace System::Runtime::Versioning; $(BeforeClCompileTargets) - + + + Debug + ARM64 + Debug Win32 + + Release + ARM64 + Release Win32 @@ -18,12 +26,10 @@ x64 - - 15.0 {3801B5AE-6871-4A72-B400-1F6ABCBF9045} @@ -31,12 +37,9 @@ OSVersionHelper StaticLibrary - - - NotUsing diff --git a/src/Microsoft.DotNet.Wpf/src/WpfGfx/common/shared/MILInterlocked.h b/src/Microsoft.DotNet.Wpf/src/WpfGfx/common/shared/MILInterlocked.h index 05c4bb70b3e..70e0fbdccf2 100644 --- a/src/Microsoft.DotNet.Wpf/src/WpfGfx/common/shared/MILInterlocked.h +++ b/src/Microsoft.DotNet.Wpf/src/WpfGfx/common/shared/MILInterlocked.h @@ -107,7 +107,7 @@ MILInterlockedCompareExchange64( #pragma warning( pop ) -#elif defined(_IA64_) || defined(_AMD64_) || defined(_AXP64_) +#elif defined(_IA64_) || defined(_AMD64_) || defined(_AXP64_) // // 64 bit Implementation- uses InterlockedCompareExchangePointer @@ -157,7 +157,7 @@ MILInterlockedCompareExchange64( )); } -#elif defined(_ARM_) +#elif defined(_ARM_) || defined(_ARM64_) //+---------------------------------------------------------------------------- // diff --git a/src/Microsoft.DotNet.Wpf/src/WpfGfx/common/shared/shared.h b/src/Microsoft.DotNet.Wpf/src/WpfGfx/common/shared/shared.h index dae62f58baa..00a0e0808cc 100644 --- a/src/Microsoft.DotNet.Wpf/src/WpfGfx/common/shared/shared.h +++ b/src/Microsoft.DotNet.Wpf/src/WpfGfx/common/shared/shared.h @@ -10,7 +10,7 @@ #include // winnt.h and the VC8 emmintrin.h define this function differently, and compilation fails. #define _mm_clflush _mm_clflush__dupe_renamed -#if !defined(_ARM_) +#if !defined(_ARM_) && !defined(_ARM64_) #include #endif #pragma warning (pop) From 19af1cfb530c115d206b9b1ee92f8a8cc31c0b72 Mon Sep 17 00:00:00 2001 From: Ryland <41491307+ryalanms@users.noreply.github.com> Date: Wed, 20 Jan 2021 15:34:22 -0800 Subject: [PATCH 3/3] Use correct TFM. TFM should be win-arm64, not win10-arm64. Co-authored-by: Alexandre Zollinger Chohfi Co-authored-by: Marcpems Co-authored-by: Juan Sebastian Hoyos Ayala Co-authored-by: Ryland <41491307+ryalanms@users.noreply.github.com> --- eng/WpfArcadeSdk/tools/Wpf.Cpp.targets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/WpfArcadeSdk/tools/Wpf.Cpp.targets b/eng/WpfArcadeSdk/tools/Wpf.Cpp.targets index 86bdeeba5d0..82cf6eb24bb 100644 --- a/eng/WpfArcadeSdk/tools/Wpf.Cpp.targets +++ b/eng/WpfArcadeSdk/tools/Wpf.Cpp.targets @@ -401,7 +401,7 @@ using namespace System::Runtime::Versioning; + Properties="TargetFramework=$(TargetFramework);Platform=$(Architecture);RuntimeIdentifier=win-$(Architecture)">