Enable building on arm64 machines (#4102)
With this commit, I can build core-sdk on RHEL 8 on arm64 directly, without cross compilation. Bump the sourcelink version to pick up the ability to parse git info without depending on libgit2sharp. This allows sourcelink to work on arm64. The version is the same as the one recently added to core-setup: https://github.com/dotnet/core-setup/pull/7696 Introduce a new 'BuildArchitecture' msbuild property that contains the host architecture (arm64, x64, etc). This is the architecture of the currently running machine, and may be different from the architecture we are targetting in the case of cross compilation. There's a gotcha with BuildArchitecture: under Visual Studio (an x86) process, we generally want a x64 architecture. So try and restrict it to arm64 only. Use BuildArchitecture to determine whether _crossDir and LibCLRJitRid need to be special-cased for arm64 or or not.
This commit is contained in:
parent
7488dc6788
commit
17b5d95d8b
5 changed files with 12 additions and 7 deletions
|
@ -7,6 +7,12 @@
|
|||
<PackageLicenseExpression>MIT</PackageLicenseExpression>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<BuildArchitecture>$([System.Runtime.InteropServices.RuntimeInformation]::ProcessArchitecture.ToString().ToLowerInvariant())</BuildArchitecture>
|
||||
<Architecture Condition="'$(Architecture)' == '' AND '$(BuildArchitecture)' == 'arm64'">$(BuildArchitecture)</Architecture>
|
||||
<Architecture Condition="'$(Architecture)' == ''">x64</Architecture>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<TreatWarningsAsErrors>True</TreatWarningsAsErrors>
|
||||
<DebugType>embedded</DebugType>
|
||||
|
|
|
@ -122,7 +122,7 @@
|
|||
<VersionToolsVersion>$(BuildTasksFeedToolVersion)</VersionToolsVersion>
|
||||
<DotnetDebToolVersion>2.0.0</DotnetDebToolVersion>
|
||||
<MicrosoftNETTestSdkVersion>15.8.0</MicrosoftNETTestSdkVersion>
|
||||
<MicrosoftSourceLinkVersion>1.0.0-beta2-18618-05</MicrosoftSourceLinkVersion>
|
||||
<MicrosoftSourceLinkVersion>1.0.0-beta2-19367-01</MicrosoftSourceLinkVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<!-- pinned dependency. This package is not being produced outside of the 2.0 branch of corefx and should not change. -->
|
||||
|
|
|
@ -5,14 +5,14 @@
|
|||
|
||||
<PropertyGroup>
|
||||
<RuntimeNETCoreAppPackageName>microsoft.netcore.app.runtime.$(SharedFrameworkRid)</RuntimeNETCoreAppPackageName>
|
||||
<_crossDir Condition="'$(Architecture)' == 'arm64'">/x64_arm64</_crossDir>
|
||||
<_crossDir Condition="'$(Architecture)' == 'arm64' and '$(BuildArchitecture)' != 'arm64'">/x64_arm64</_crossDir>
|
||||
<_crossDir Condition="'$(Architecture)' == 'arm' And '$(OSName)' == 'win'">/x86_arm</_crossDir>
|
||||
<_crossDir Condition="'$(Architecture)' == 'arm' And '$(OSName)' == 'linux'">/x64_arm</_crossDir>
|
||||
<CrossgenPath>$(NuGetPackageRoot)/$(RuntimeNETCoreAppPackageName)/$(MicrosoftNETCoreAppRuntimePackageVersion)/tools$(_crossDir)/crossgen$(ExeExtension)</CrossgenPath>
|
||||
<LibCLRJitRid Condition="!$(Architecture.StartsWith('arm'))">$(SharedFrameworkRid)</LibCLRJitRid>
|
||||
<LibCLRJitRid Condition="'$(Architecture)' == 'arm64'">x64_arm64</LibCLRJitRid>
|
||||
<LibCLRJitRid Condition="'$(Architecture)' == 'arm64' and '$(BuildArchitecture)' == 'x64'">x64_arm64</LibCLRJitRid>
|
||||
<LibCLRJitRid Condition="'$(Architecture)' == 'arm' And '$(OSName)' == 'win'">x86_arm</LibCLRJitRid>
|
||||
<LibCLRJitRid Condition="'$(Architecture)' == 'arm' And '$(OSName)' == 'linux'">x64_arm</LibCLRJitRid>
|
||||
<LibCLRJitRid Condition="'$(LibCLRJitRid)' == ''">$(SharedFrameworkRid)</LibCLRJitRid>
|
||||
<LibCLRJitPath>$(NuGetPackageRoot)/$(RuntimeNETCoreAppPackageName)/$(MicrosoftNETCoreAppRuntimePackageVersion)/runtimes/$(LibCLRJitRid)/native/$(DynamicLibPrefix)clrjit$(DynamicLibExtension)</LibCLRJitPath>
|
||||
<SharedFrameworkNameVersionPath>$(RedistLayoutPath)shared/$(SharedFrameworkName)/$(MicrosoftNETCoreAppRuntimePackageVersion)</SharedFrameworkNameVersionPath>
|
||||
<DIASymReaderCrossgenFilter>*</DIASymReaderCrossgenFilter>
|
||||
|
|
|
@ -48,11 +48,11 @@
|
|||
|
||||
<!-- Use the "x64" Rid when downloading Linux shared framework 'DEB' installer files. -->
|
||||
<SharedFrameworkInstallerFileRid>$(CoreSetupRid)</SharedFrameworkInstallerFileRid>
|
||||
<SharedFrameworkInstallerFileRid Condition=" '$(IsDebianBaseDistro)' == 'true' OR '$(IsRPMBasedDistro)' == 'true' ">x64</SharedFrameworkInstallerFileRid>
|
||||
<SharedFrameworkInstallerFileRid Condition=" '$(IsDebianBaseDistro)' == 'true' OR '$(IsRPMBasedDistro)' == 'true' ">$(Architecture)</SharedFrameworkInstallerFileRid>
|
||||
|
||||
<!-- Use the "x64" Rid when downloading Linux runtime dependencies Debian package. -->
|
||||
<RuntimeDepsInstallerFileRid>$(CoreSetupRid)</RuntimeDepsInstallerFileRid>
|
||||
<RuntimeDepsInstallerFileRid Condition=" '$(IsDebianBaseDistro)' == 'true' ">x64</RuntimeDepsInstallerFileRid>
|
||||
<RuntimeDepsInstallerFileRid Condition=" '$(IsDebianBaseDistro)' == 'true' ">$(Architecture)</RuntimeDepsInstallerFileRid>
|
||||
|
||||
<AlternateArchitecture Condition="'$(Architecture)' == 'x86'">x64</AlternateArchitecture>
|
||||
<AlternateArchitecture Condition="'$(Architecture)' == 'x64'">x86</AlternateArchitecture>
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
<OSName Condition=" '$(OSName)' == '' AND '$(IsLinux)' == 'True' ">linux</OSName>
|
||||
<OSPlatform Condition=" '$(OSPlatform)' == '' AND '$(IsLinux)' == 'True' ">linux</OSPlatform>
|
||||
|
||||
<Architecture Condition=" '$(Architecture)' == '' ">x64</Architecture>
|
||||
<Rid Condition=" '$(Rid)' == '' ">$(OSName)-$(Architecture)</Rid>
|
||||
</PropertyGroup>
|
||||
|
||||
|
|
Loading…
Reference in a new issue