-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[nativeaot] Add Native AOT cross-build support for iOS-like platforms #88242
Changes from 2 commits
0ddc81f
560dbf7
3809ba8
02f37c2
1276b53
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -267,6 +267,22 @@ | |
Category="clr" /> | ||
</ItemGroup> | ||
|
||
<!-- Build the CoreCLR cross tools when we're doing a cross OS build for apple device targets --> | ||
<ItemGroup Condition="('$(ClrRuntimeBuildSubsets)' != '' and '$(PrimaryRuntimeFlavor)' == 'CoreCLR' and '$(NativeAotSupported)' == 'true' and '$(TargetsAppleMobile)' == 'true')"> | ||
<ProjectToBuild | ||
Include="$(CoreClrProjectRoot)runtime.proj" | ||
AdditionalProperties="%(AdditionalProperties); | ||
ClrCrossComponentsSubset=true; | ||
HostArchitecture=$(BuildArchitecture); | ||
TargetOS=$(HostOS); | ||
OutputRIDOS=$(TargetOS); | ||
PgoInstrument=false; | ||
NoPgoOptimize=true; | ||
CrossBuild=false; | ||
CMakeArgs=$(CMakeArgs) -DCLR_CROSS_COMPONENTS_BUILD=1" | ||
Category="clr" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup Condition="$(_subset.Contains('+clr.paltestlist+'))"> | ||
<ProjectToBuild Include="$(CoreClrProjectRoot)pal/tests/palsuite/producepaltestlist.proj" /> | ||
</ItemGroup> | ||
|
@@ -300,26 +316,6 @@ | |
CMakeArgs=$(CMakeArgs) -DCLR_CROSS_COMPONENTS_BUILD=1" Category="clr" /> | ||
</ItemGroup> | ||
|
||
<!-- When targeting the iOS platforms with Native AOT, build the ClrAllJitsSubset and the Ilc for the host --> | ||
<PropertyGroup> | ||
<IsNativeAOTHostBuildEnabled Condition="$(_subset.Contains('+clr.nativeaotruntime+')) and '$(NativeAotSupported)' == 'true' and '$(PrimaryRuntimeFlavor)' == 'CoreCLR' and '$(TargetsAppleMobile)' == 'true'">true</IsNativeAOTHostBuildEnabled> | ||
<NativeAOTAdditionalProperties Condition="'$(IsNativeAOTHostBuildEnabled)' == 'true'">TargetOS=osx;TargetArchitecture=$(BuildArchitecture)</NativeAOTAdditionalProperties> | ||
</PropertyGroup> | ||
<ItemGroup Condition="'$(IsNativeAOTHostBuildEnabled)' == 'true'"> | ||
<ProjectToBuild | ||
Include="$(CoreClrProjectRoot)runtime.proj" | ||
AdditionalProperties="%(AdditionalProperties); | ||
$(NativeAOTAdditionalProperties); | ||
ClrAllJitsSubset=true; | ||
ClrCrossComponentsSubset=true; | ||
PgoInstrument=false; | ||
NoPgoOptimize=true; | ||
CMakeArgs=$(CMakeArgs) -DCLR_CROSS_COMPONENTS_BUILD=1" | ||
Category="clr" /> | ||
<ProjectToBuild Include="$(CoreClrProjectRoot)tools\aot\ILCompiler\ILCompiler.csproj" Category="clr" AdditionalProperties="$(NativeAOTAdditionalProperties)" /> | ||
<ProjectToBuild Include="$(CoreClrProjectRoot)nativeaot\BuildIntegration\BuildIntegration.proj" Category="clr" AdditionalProperties="$(NativeAOTAdditionalProperties)" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup Condition="$(_subset.Contains('+crossdacpack+'))"> | ||
<ProjectToBuild Include="$(CoreClrProjectRoot).nuget\Microsoft.CrossOsDiag.Private.CoreCLR\Microsoft.CrossOsDiag.Private.CoreCLR.proj" Category="clr" /> | ||
</ItemGroup> | ||
|
@@ -336,8 +332,8 @@ | |
<ProjectToBuild Include="$(CoreClrProjectRoot)tools\aot\ILCompiler\ILCompiler.csproj" Category="clr" Condition="'$(NativeAotSupported)' == 'true'" /> | ||
<ProjectToBuild Include="$(CoreClrProjectRoot)nativeaot\BuildIntegration\BuildIntegration.proj" Category="clr" Condition="'$(NativeAotSupported)' == 'true'" /> | ||
|
||
<ProjectToBuild Condition="'$(NativeAotSupported)' == 'true' and ('$(CrossBuild)' == 'true' or '$(BuildArchitecture)' != '$(TargetArchitecture)')" Include="$(CoreClrProjectRoot)tools\aot\ILCompiler\ILCompiler_crossarch.csproj" Category="clr" /> | ||
<ProjectToBuild Condition="'$(TargetArchitecture)' != '$(BuildArchitecture)'" Include="$(CoreClrProjectRoot)tools\aot\crossgen2\crossgen2_crossarch.csproj" Category="clr" /> | ||
<ProjectToBuild Condition="'$(NativeAotSupported)' == 'true' and ('$(CrossBuild)' == 'true' or '$(BuildArchitecture)' != '$(TargetArchitecture)' or ('$(HostOS)' != '$(TargetOS)' and '$(TargetsAppleMobile)' == 'true'))" Include="$(CoreClrProjectRoot)tools\aot\ILCompiler\ILCompiler_crossarch.csproj" Category="clr" /> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need the |
||
<ProjectToBuild Condition="'$(TargetArchitecture)' != '$(BuildArchitecture)' or ('$(HostOS)' != '$(TargetOS)' and '$(TargetsAppleMobile)' == 'true')" Include="$(CoreClrProjectRoot)tools\aot\crossgen2\crossgen2_crossarch.csproj" Category="clr" /> | ||
|
||
<ProjectToBuild Condition="'$(TargetOS)' == 'windows' or ('$(TargetOS)' == 'linux' and ('$(TargetArchitecture)' == 'x64' or '$(TargetArchitecture)' == 'arm64')) or '$(TargetOS)' == 'osx'" Include="$(CoreClrProjectRoot)tools\SuperFileCheck\SuperFileCheck.csproj" Category="clr" /> | ||
</ItemGroup> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,7 +25,7 @@ | |
<CoreCLRSharedFrameworkDir>$([MSBuild]::NormalizeDirectory('$(CoreCLRArtifactsPath)', 'sharedFramework'))</CoreCLRSharedFrameworkDir> | ||
<CoreCLRCrossgen2Dir>$([MSBuild]::NormalizeDirectory('$(CoreCLRArtifactsPath)', 'crossgen2'))</CoreCLRCrossgen2Dir> | ||
<CoreCLRILCompilerDir>$([MSBuild]::NormalizeDirectory('$(CoreCLRArtifactsPath)', 'ilc-published'))</CoreCLRILCompilerDir> | ||
<CoreCLRCrossILCompilerDir Condition="'$(CrossBuild)' == 'true' or '$(BuildArchitecture)' != '$(TargetArchitecture)'">$([MSBuild]::NormalizeDirectory('$(CoreCLRArtifactsPath)', '$(BuildArchitecture)', 'ilc'))</CoreCLRCrossILCompilerDir> | ||
<CoreCLRCrossILCompilerDir Condition="'$(CrossBuild)' == 'true' or '$(BuildArchitecture)' != '$(TargetArchitecture)' or ('$(HostOS)' != '$(TargetOS)' and '$(TargetsAppleMobile)' == 'true')">$([MSBuild]::NormalizeDirectory('$(CoreCLRArtifactsPath)', '$(BuildArchitecture)', 'ilc'))</CoreCLRCrossILCompilerDir> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same question about the TargetsAppleMobile condition. |
||
<CoreCLRAotSdkDir>$([MSBuild]::NormalizeDirectory('$(CoreCLRArtifactsPath)', 'aotsdk'))</CoreCLRAotSdkDir> | ||
<CoreCLRBuildIntegrationDir>$([MSBuild]::NormalizeDirectory('$(CoreCLRArtifactsPath)', 'build'))</CoreCLRBuildIntegrationDir> | ||
|
||
|
@@ -71,7 +71,7 @@ | |
<CoreCLRSharedFrameworkDir>$([MSBuild]::NormalizeDirectory('$(CoreCLRArtifactsPath)','sharedFramework'))</CoreCLRSharedFrameworkDir> | ||
<CoreCLRSharedFrameworkPdbDir>$([MSBuild]::NormalizeDirectory('$(CoreCLRSharedFrameworkDir)','PDB'))</CoreCLRSharedFrameworkPdbDir> | ||
<CoreCLRCrossTargetComponentDir | ||
Condition="'$(CoreCLRCrossTargetComponentDirName)' != ''">$([MSBuild]::NormalizeDirectory('$(CoreCLRArtifactsPath)','$(CoreCLRCrossTargetComponentDirName)','sharedFramework'))</CoreCLRCrossTargetComponentDir> | ||
Condition="'$(CoreCLRCrossTargetComponentDirName)' != ''">$([MSBuild]::NormalizeDirectory('$(CoreCLRArtifactsPath)','$(BuildArchitecture)','sharedFramework'))</CoreCLRCrossTargetComponentDir> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do we need this change (I was not able to find a use of this property that looked relevant)? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not needed, it was a temporary change. |
||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(RuntimeFlavor)' == 'Mono'"> | ||
<MonoArtifactsPath>$([MSBuild]::NormalizeDirectory('$(MonoArtifactsPath)'))</MonoArtifactsPath> | ||
|
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -109,6 +109,9 @@ __ConfigTriplet="$__TargetOS.$__TargetArch.$__BuildType" | |||||||||
if [[ "$__TargetOS" == "linux-bionic" ]]; then | ||||||||||
__ConfigTriplet="linux.$__TargetArch.$__BuildType" | ||||||||||
fi | ||||||||||
if [[ ! -z "$__OutputRIDOS" ]]; then | ||||||||||
__ConfigTriplet="$__OutputRIDOS.$__TargetArch.$__BuildType" | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Instead of introducing this override for output path, would it be better to keep the compiler in its default path and invoke it from there? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In that case, the default path for the cross-compiler is
When building cross-components for cross-arch scenarios, the runtime/src/coreclr/build-runtime.sh Lines 166 to 168 in 36481bf
One approach that I will try is to introduce the |
||||||||||
fi | ||||||||||
__BinDir="$__RootBinDir/bin/coreclr/$__ConfigTriplet" | ||||||||||
__ArtifactsObjDir="$__RepoRootDir/artifacts/obj" | ||||||||||
__ArtifactsIntermediatesDir="$__ArtifactsObjDir/coreclr" | ||||||||||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -42,7 +42,7 @@ | |||||
</PropertyGroup> | ||||||
|
||||||
<ItemGroup> | ||||||
<LinkerArg Include="--target=$(TargetTriple)" Condition="'$(TargetOS)' != 'osx' and '$(TargetTriple)' != ''" /> | ||||||
<LinkerArg Include="--target=$(TargetTriple)" Condition="'$(TargetOS)' != 'osx' and '$(TargetsAppleMobile)' != 'true' and '$(TargetTriple)' != ''" /> | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would this work?
Suggested change
|
||||||
</ItemGroup> | ||||||
</Target> | ||||||
|
||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this be folded into the above
Build the CoreCLR cross tools when we're doing a cross build
block? We currently exclude it with'$(TargetsMobile)' != 'true'
but it looks pretty much the same. The additionalTargetOS
andOutputRIDOS
properties will probably not harm anything if we add them.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think so. Initially, I didn't want to extend the cross-build for unsupported scenarios.