Skip to content

Commit

Permalink
Enable build on hosted arm64 (dotnet#40453)
Browse files Browse the repository at this point in the history
This is attempt #2. The first attempt was commit
176da26.

Initialize HostArch to the arch-style used in RIDs directly by
converting things to lowercase.

Use the HostArch for the tool runtime instead of assuming x64.
  • Loading branch information
omajid authored and ViktorHofer committed Sep 12, 2019
1 parent b384d34 commit be3d4ba
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@
<TargetGroup Condition="'$(TargetGroup)' == ''">netcoreapp</TargetGroup>
<OSGroup Condition="'$(OSGroup)' == ''">$(DefaultOSGroup)</OSGroup>
<ConfigurationGroup Condition="'$(ConfigurationGroup)' == ''">Debug</ConfigurationGroup>
<HostArch>$([System.Runtime.InteropServices.RuntimeInformation]::ProcessArchitecture)</HostArch>
<ArchGroup Condition="'$(ArchGroup)' == '' AND '$(HostArch)' == 'Arm'">arm</ArchGroup>
<ArchGroup Condition="'$(ArchGroup)' == '' AND '$(HostArch)' == 'Arm64'">arm64</ArchGroup>
<HostArch>$([System.Runtime.InteropServices.RuntimeInformation]::ProcessArchitecture.ToString().ToLowerInvariant)</HostArch>
<ArchGroup Condition="'$(ArchGroup)' == '' AND '$(HostArch)' == 'arm'">arm</ArchGroup>
<ArchGroup Condition="'$(ArchGroup)' == '' AND '$(HostArch)' == 'arm64'">arm64</ArchGroup>
<ArchGroup Condition="'$(ArchGroup)' == ''">x64</ArchGroup>

<!-- Initialize BuildConfiguration from the individual properties if it wasn't already explicitly set -->
Expand Down Expand Up @@ -135,9 +135,10 @@
<_runtimeOS Condition="'$(_runtimeOS)' == 'tizen.4.0.0'">linux</_runtimeOS>
<_runtimeOS Condition="'$(_runtimeOS)' == 'tizen.5.0.0'">linux</_runtimeOS>
<_runtimeOS Condition="'$(PortableBuild)' == 'true'">$(_portableOS)</_runtimeOS>
<ToolRuntimeRID>$(_runtimeOS)-x64</ToolRuntimeRID>
<ToolRuntimeRID Condition="'$(BuildingInsideVisualStudio)' == 'true'">$(_runtimeOS)-x64</ToolRuntimeRID>
<ToolRuntimeRID Condition="'$(ToolRuntimeID)' == ''">$(_runtimeOS)-$(HostArch)</ToolRuntimeRID>
<!-- We build linux-musl-arm on a ubuntu container, so we can't use the toolset build for alpine runtime. We need to use portable linux RID for our toolset in order to be able to use it. -->
<ToolRuntimeRID Condition="'$(_runtimeOS)' == 'linux-musl' AND $(ArchGroup.StartsWith('arm')) AND !$(HostArch.StartsWith('Arm'))">linux-x64</ToolRuntimeRID>
<ToolRuntimeRID Condition="'$(_runtimeOS)' == 'linux-musl' AND $(ArchGroup.StartsWith('arm')) AND !$(HostArch.StartsWith('arm'))">linux-x64</ToolRuntimeRID>

<!-- There are no WebAssembly tools, so treat them as Windows -->
<ToolRuntimeRID Condition="'$(RuntimeOS)' == 'WebAssembly'">win-x64</ToolRuntimeRID>
Expand Down

0 comments on commit be3d4ba

Please sign in to comment.