|
36 | 36 | <IlcSdkPath>{IlcSdkPath}</IlcSdkPath> |
37 | 37 | <IlcFrameworkPath>{IlcFrameworkPath}</IlcFrameworkPath> |
38 | 38 | <IlcFrameworkNativePath>{IlcFrameworkNativePath}</IlcFrameworkNativePath> |
39 | | - <LinkerFlavor Condition="'$(TargetOS)' == 'linux'">lld</LinkerFlavor> |
40 | | - <SysRoot Condition="('$(CrossBuild)' == 'true' or '$(BuildArchitecture)' != '$(TargetArchitecture)') and '$(HostOS)' != 'windows'">$(ROOTFS_DIR)</SysRoot> |
| 39 | + <SysRoot Condition="('$(CrossBuild)' == 'true' or '$(BuildArchitecture)' != '$(TargetArchitecture)') and '$(ROOTFS_DIR)' != ''">$(ROOTFS_DIR)</SysRoot> |
41 | 40 | <CoreCLRBuildIntegrationDir>{CoreCLRBuildIntegrationDir}</CoreCLRBuildIntegrationDir> |
42 | 41 | </PropertyGroup> |
43 | 42 |
|
44 | 43 | <ItemGroup> |
45 | | - <CustomLinkerArg Condition="'$(CrossBuild)' == 'true' and '$(_hostArchitecture)' == '$(_targetArchitecture)' and '$(_hostOS)' != 'windows'" Include="--gcc-toolchain=$(ROOTFS_DIR)/usr" /> |
| 44 | + <CustomLinkerArg Condition="'$(CrossBuild)' == 'true' and '$(_hostArchitecture)' == '$(_targetArchitecture)' and '$(ROOTFS_DIR)' != ''" Include="--gcc-toolchain=$(ROOTFS_DIR)/usr" /> |
46 | 45 | </ItemGroup> |
47 | 46 |
|
48 | 47 | <ItemGroup> |
|
62 | 61 | IsImplicitlyDefined="true" /> |
63 | 62 | </ItemGroup> |
64 | 63 |
|
| 64 | + <Target Name="LocateNativeCompiler" |
| 65 | + Condition="'$(PublishAot)' == 'true' and '$(_hostOS)' != 'win'" |
| 66 | + BeforeTargets="SetupOSSpecificProps"> |
| 67 | + <PropertyGroup> |
| 68 | + <CppCompilerAndLinker Condition="'$(CppCompilerAndLinker)' == ''">clang</CppCompilerAndLinker> |
| 69 | + </PropertyGroup> |
| 70 | + |
| 71 | + <Exec Command="sh -c 'build_arch="$(TargetArchitecture)" compiler="$(CppCompilerAndLinker)" . "$(RepositoryEngineeringDir)/common/native/init-compiler.sh" && echo "$CC;$LDFLAGS"' 2>/dev/null" |
| 72 | + EchoOff="true" |
| 73 | + ConsoleToMsBuild="true" |
| 74 | + StandardOutputImportance="Low"> |
| 75 | + <Output TaskParameter="ConsoleOutput" PropertyName="_CC_LDFLAGS" /> |
| 76 | + </Exec> |
| 77 | + |
| 78 | + <PropertyGroup> |
| 79 | + <CppLinker>$(_CC_LDFLAGS.SubString(0, $(_CC_LDFLAGS.IndexOf(';'))))</CppLinker> |
| 80 | + <_LDFLAGS>$(_CC_LDFLAGS.SubString($([MSBuild]::Add($(_CC_LDFLAGS.IndexOf(';')), 1))))</_LDFLAGS> |
| 81 | + <LinkerFlavor Condition="$(_LDFLAGS.Contains('lld'))">lld</LinkerFlavor> |
| 82 | + </PropertyGroup> |
| 83 | + </Target> |
| 84 | + |
65 | 85 | </Project> |
0 commit comments