|
23 | 23 |
|
24 | 24 | <PropertyGroup Condition="'$(TestNativeAot)' == 'true'"> |
25 | 25 | <IlcToolsPath>$(CoreCLRILCompilerDir)</IlcToolsPath> |
26 | | - <IlcToolsPath Condition="'$(TargetArchitecture)' != '$(BuildArchitecture)'">$(CoreCLRCrossILCompilerDir)</IlcToolsPath> |
| 26 | + <IlcToolsPath Condition="'$(CrossBuild)' == 'true' or '$(TargetArchitecture)' != '$(BuildArchitecture)'">$(CoreCLRCrossILCompilerDir)</IlcToolsPath> |
27 | 27 | <SysRoot Condition="('$(CrossBuild)' == 'true' or '$(BuildArchitecture)' != '$(TargetArchitecture)') and '$(HostOS)' != 'windows'">$(ROOTFS_DIR)</SysRoot> |
28 | 28 | <IlcBuildTasksPath>$(CoreCLRILCompilerDir)netstandard/ILCompiler.Build.Tasks.dll</IlcBuildTasksPath> |
29 | 29 | <IlcSdkPath>$(CoreCLRAotSdkDir)</IlcSdkPath> |
|
36 | 36 | <SuppressAotAnalysisWarnings>true</SuppressAotAnalysisWarnings> |
37 | 37 | </PropertyGroup> |
38 | 38 |
|
| 39 | + <!-- Needed for the amd64 -> amd64 musl cross-build to pass the target flag. --> |
| 40 | + <Target Name="_FixIlcTargetTriple" |
| 41 | + AfterTargets="SetupOSSpecificProps" |
| 42 | + Condition="'$(CrossBuild)' == 'true' and '$(HostOS)' != 'windows'"> |
| 43 | + <!-- Compute CrossCompileRid, and copy the downstream logic as-is. --> |
| 44 | + <PropertyGroup> |
| 45 | + <CrossCompileRid>$(RuntimeIdentifier)</CrossCompileRid> |
| 46 | + |
| 47 | + <CrossCompileArch /> |
| 48 | + <CrossCompileArch Condition="$(CrossCompileRid.EndsWith('-x64'))">x86_64</CrossCompileArch> |
| 49 | + <CrossCompileArch Condition="$(CrossCompileRid.EndsWith('-arm64')) and '$(_IsApplePlatform)' != 'true'">aarch64</CrossCompileArch> |
| 50 | + <CrossCompileArch Condition="$(CrossCompileRid.EndsWith('-arm64')) and '$(_IsApplePlatform)' == 'true'">arm64</CrossCompileArch> |
| 51 | + |
| 52 | + <TargetTriple /> |
| 53 | + <TargetTriple Condition="'$(CrossCompileArch)' != ''">$(CrossCompileArch)-linux-gnu</TargetTriple> |
| 54 | + <TargetTriple Condition="'$(CrossCompileArch)' != '' and ($(CrossCompileRid.StartsWith('linux-musl')) or $(CrossCompileRid.StartsWith('alpine')))">$(CrossCompileArch)-alpine-linux-musl</TargetTriple> |
| 55 | + <TargetTriple Condition="'$(CrossCompileArch)' != '' and ($(CrossCompileRid.StartsWith('freebsd')))">$(CrossCompileArch)-unknown-freebsd12</TargetTriple> |
| 56 | + </PropertyGroup> |
| 57 | + |
| 58 | + <ItemGroup> |
| 59 | + <LinkerArg Include="--target=$(TargetTriple)" Condition="'$(TargetOS)' != 'osx' and '$(TargetTriple)' != ''" /> |
| 60 | + </ItemGroup> |
| 61 | + </Target> |
| 62 | + |
| 63 | + <ItemGroup Condition="'$(NativeAotSupported)' == 'true'"> |
| 64 | + <CustomLinkerArg Condition="'$(CrossBuild)' == 'true' and '$(_hostArchitecture)' == '$(_targetArchitecture)' and '$(_hostOS)' != 'windows'" Include="--gcc-toolchain=$(ROOTFS_DIR)/usr" /> |
| 65 | + </ItemGroup> |
| 66 | + |
39 | 67 | <PropertyGroup Condition="'$(PublishSingleFile)' == 'true' or '$(TestNativeAot)' == 'true'"> |
40 | 68 | <DefineConstants>$(DefineConstants);SINGLE_FILE_TEST_RUNNER</DefineConstants> |
41 | 69 | </PropertyGroup> |
|
0 commit comments