Skip to content

Commit

Permalink
Build CoreLib as AnyCPU (dotnet#101084)
Browse files Browse the repository at this point in the history
Reduce amount of architecture specific code. Minor cleanup motivated by dotnet#101038.
  • Loading branch information
jkotas authored and matouskozak committed Apr 30, 2024
1 parent e8d3893 commit b9ead90
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
<PropertyGroup>
<Platform Condition=" '$(Platform)' == '' ">$(TargetArchitecture)</Platform>
<Platform Condition=" '$(Platform)' == 'armel' ">arm</Platform>
<PlatformTarget>AnyCPU</PlatformTarget>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<!-- This prevents the default MsBuild targets from referencing System.Core.dll -->
<AddAdditionalExplicitAssemblyReferences>false</AddAdditionalExplicitAssemblyReferences>
Expand All @@ -59,28 +60,21 @@

<!-- Platform specific properties -->
<PropertyGroup Condition="'$(Platform)' == 'x64'">
<PlatformTarget>x64</PlatformTarget>
<Prefer32Bit>false</Prefer32Bit>
<DefineConstants>$(DefineConstants);TARGET_AMD64</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(Platform)' == 'x86'">
<PlatformTarget>x86</PlatformTarget>
<DefineConstants>$(DefineConstants);TARGET_X86</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(Platform)' == 'arm'">
<PlatformTarget>arm</PlatformTarget>
<DefineConstants>$(DefineConstants);TARGET_ARM</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(Platform)' == 'arm64'">
<PlatformTarget>AnyCPU</PlatformTarget>
<DefineConstants>$(DefineConstants);TARGET_ARM64</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(Platform)' == 'loongarch64'">
<PlatformTarget>AnyCPU</PlatformTarget>
<DefineConstants>$(DefineConstants);TARGET_LOONGARCH64</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(Platform)' == 'riscv64'">
<PlatformTarget>AnyCPU</PlatformTarget>
<DefineConstants>$(DefineConstants);TARGET_RISCV64</DefineConstants>
</PropertyGroup>

Expand Down
6 changes: 1 addition & 5 deletions src/coreclr/nativeaot/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

<Platform Condition=" '$(Platform)' == '' ">$(TargetArchitecture)</Platform>
<Platform Condition=" '$(Platform)' == 'armel' ">arm</Platform>
<PlatformTarget>AnyCPU</PlatformTarget>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<!-- This prevents the default MsBuild targets from referencing System.Core.dll -->
<AddAdditionalExplicitAssemblyReferences>false</AddAdditionalExplicitAssemblyReferences>
Expand Down Expand Up @@ -78,20 +79,15 @@

<!-- Platform specific properties -->
<PropertyGroup Condition="'$(Platform)' == 'x64'">
<PlatformTarget>x64</PlatformTarget>
<Prefer32Bit>false</Prefer32Bit>
<DefineConstants>TARGET_64BIT;TARGET_AMD64;$(DefineConstants)</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(Platform)' == 'x86'">
<PlatformTarget>x86</PlatformTarget>
<DefineConstants>TARGET_32BIT;TARGET_X86;$(DefineConstants)</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(Platform)' == 'arm'">
<PlatformTarget>arm</PlatformTarget>
<DefineConstants>TARGET_32BIT;TARGET_ARM;$(DefineConstants)</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(Platform)' == 'arm64'">
<PlatformTarget>AnyCPU</PlatformTarget>
<DefineConstants>TARGET_64BIT;TARGET_ARM64;$(DefineConstants)</DefineConstants>
</PropertyGroup>

Expand Down
11 changes: 1 addition & 10 deletions src/mono/System.Private.CoreLib/System.Private.CoreLib.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
</ItemGroup>

<PropertyGroup>
<PlatformTarget>AnyCPU</PlatformTarget>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<!-- This prevents the default MsBuild targets from referencing System.Core.dll -->
<AddAdditionalExplicitAssemblyReferences>false</AddAdditionalExplicitAssemblyReferences>
Expand All @@ -48,40 +49,30 @@

<!-- Platform specific properties -->
<PropertyGroup Condition="'$(Platform)' == 'x64'">
<PlatformTarget>x64</PlatformTarget>
<Prefer32Bit>false</Prefer32Bit>
<DefineConstants>$(DefineConstants);TARGET_AMD64</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(Platform)' == 'x86'">
<PlatformTarget>x86</PlatformTarget>
<DefineConstants>$(DefineConstants);TARGET_X86</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(Platform)' == 'armv6'">
<PlatformTarget>arm</PlatformTarget>
<DefineConstants>$(DefineConstants);TARGET_ARMV6</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(Platform)' == 'arm'">
<PlatformTarget>arm</PlatformTarget>
<DefineConstants>$(DefineConstants);TARGET_ARM</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(Platform)' == 'arm64'">
<PlatformTarget>AnyCPU</PlatformTarget>
<DefineConstants>$(DefineConstants);TARGET_ARM64</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(Platform)' == 'riscv64'">
<PlatformTarget>AnyCPU</PlatformTarget>
<DefineConstants>$(DefineConstants);TARGET_RISCV64</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(Platform)' == 's390x'">
<PlatformTarget>AnyCPU</PlatformTarget>
<DefineConstants>$(DefineConstants);TARGET_S390X</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(Platform)' == 'wasm'">
<PlatformTarget>AnyCPU</PlatformTarget>
<DefineConstants>$(DefineConstants);TARGET_WASM</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(Platform)' == 'ppc64le'">
<PlatformTarget>AnyCPU</PlatformTarget>
<DefineConstants>$(DefineConstants);TARGET_POWERPC64</DefineConstants>
</PropertyGroup>

Expand Down

0 comments on commit b9ead90

Please sign in to comment.