Conversation
dotnet#112256 added the ability to cross compile android on windows. This regressed the win-arm64 crossdac build because it stopped passing CMAKE_TARGET_ARCH and CMAKE_TARGET_OS for cross component builds where the host and target os's match. This change makes sure the cmake variables are passed in all cases except when the hostos isn't passed in or is windows (host == target).
7d20179 to
1db7ce4
Compare
eng/native/configureplatform.cmake
Outdated
| endif() | ||
|
|
||
| if (CLR_CMAKE_TARGET_ANDROID) | ||
| if (CLR_CMAKE_TARGET_ANDROID AND NOT CLR_CROSS_COMPONENTS_BUILD) |
There was a problem hiding this comment.
| if (CLR_CMAKE_TARGET_ANDROID AND NOT CLR_CROSS_COMPONENTS_BUILD) | |
| if (CLR_CMAKE_HOST_ANDROID) |
?
src/coreclr/build-runtime.cmd
Outdated
|
|
||
| if /i "%__TargetOS%" == "android" ( | ||
| if not "%__HostOS%" == "" ( | ||
| set "__TargetOS=!__HostOS!" |
There was a problem hiding this comment.
If command line says -os android -hostos windows, this line is going to override the requested configuration to -os windows -hostos windows. Why would we want to do that? If the caller of the script asks for android targeting binary, we should build an android targeting binary and not ignore what the command line asked for.
There was a problem hiding this comment.
Yeah, I think that was another part of the workaround. I'll remove it and see.
There was a problem hiding this comment.
ok, I remember... We need a host built JIT for live builds of crossgen / ILC. There may be other reasons I'm not aware of.
The approach is equivalent of what we do on non-windows platforms:
Executing "/Users/runner/work/1/s/src/coreclr/build-runtime.sh" -cmakeargs "-DCLR_CROSS_COMPONENTS_BUILD=1" -arm64 -release -ci -os ios -hostarch x64 -hostos osx -outputrid ios-arm64 -subdir x64 -cmakeargs "-DCLR_DOTNET_HOST_PATH=/Users/runner/work/1/s/.dotnet/dotnet" -component alljits
And where it gets flipped... It's arranged slightly different, but nonetheless the same outcome.
runtime/eng/native/build-commons.sh
Lines 521 to 523 in 457e3eb
There was a problem hiding this comment.
runtime/eng/native/build-commons.sh
Lines 521 to 523 in 457e3eb
This condition makes sense. It sets HostOS to TargetOS when the HostOS was not specified (ie it sets the default). Can we do it the same way here? Set the default if the value is not specified instead of overriding what was specified on the command line.
jkotas
left a comment
There was a problem hiding this comment.
LGTM, assuming that it works as expected. Thank you!
#112256 added the ability to cross compile android on windows. This regressed the win-arm64 crossdac build because it stopped passing CMAKE_TARGET_ARCH and CMAKE_TARGET_OS for cross component builds where the host and target os's match.
This change makes sure the cmake variables are passed in all cases except when the hostos isn't passed in or is
windows (host == target).