Skip to content

Commit 30a8a64

Browse files
committed
Fix win-arm64 crossdac build
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).
1 parent 5608cd9 commit 30a8a64

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/coreclr/build-runtime.cmd

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ set __Ninja=1
7474
set __RequestedBuildComponents=
7575
set __OutputRid=
7676
set __SubDir=
77+
set __ShouldEmitCmakeTarget=0
7778

7879
:Arg_Loop
7980
if "%1" == "" goto ArgsDone
@@ -392,12 +393,19 @@ if %__BuildNative% EQU 1 (
392393
set __ExtraCmakeArgs="-DCMAKE_BUILD_TYPE=!__BuildType!"
393394
)
394395

396+
:: We want to specify CMAKE_TARGET_* when __HostOS isn't passed in or is windows (host == target)
395397
if /i not "%__HostOS%" == "%__TargetOS%" (
396398
if /i "%__HostOS%" == "" (
397-
set __ExtraCmakeArgs=!__ExtraCmakeArgs! "-DCLR_CMAKE_TARGET_ARCH=%__TargetArch%" "-DCLR_CMAKE_TARGET_OS=%__TargetOS%"
399+
set __ShouldEmitCmakeTarget=1
398400
)
401+
) else (
402+
set __ShouldEmitCmakeTarget=1
399403
)
400404

405+
if %__ShouldEmitCmakeTarget% EQU 1 (
406+
set __ExtraCmakeArgs=!__ExtraCmakeArgs! "-DCLR_CMAKE_TARGET_ARCH=%__TargetArch%" "-DCLR_CMAKE_TARGET_OS=%__TargetOS%"
407+
)
408+
401409
set __ExtraCmakeArgs=!__ExtraCmakeArgs! "-DCLI_CMAKE_FALLBACK_OS=%__HostFallbackOS%" "-DCLR_CMAKE_PGO_INSTRUMENT=%__PgoInstrument%" "-DCLR_CMAKE_OPTDATA_PATH=%__PgoOptDataPath%" "-DCLR_CMAKE_PGO_OPTIMIZE=%__PgoOptimize%"
402410

403411
if /i "%__TargetOS%" == "android" (

0 commit comments

Comments
 (0)