diff --git a/eng/Subsets.props b/eng/Subsets.props index bfa808ab25cd9..12adcce07ce0f 100644 --- a/eng/Subsets.props +++ b/eng/Subsets.props @@ -254,12 +254,13 @@ - + - - - true - TargetOS=osx;TargetArchitecture=$(BuildArchitecture) - - - - - - - @@ -336,8 +317,8 @@ - - + + diff --git a/eng/build.sh b/eng/build.sh index bfe3d351e2a62..c4f18b3051df2 100755 --- a/eng/build.sh +++ b/eng/build.sh @@ -140,8 +140,8 @@ initDistroRid() local isCrossBuild="$3" local isPortableBuild="$4" - # Only pass ROOTFS_DIR if __DoCrossArchBuild is specified and the current platform is not OSX that doesn't use rootfs - if [[ $isCrossBuild == 1 && "$targetOs" != "osx" ]]; then + # Only pass ROOTFS_DIR if __DoCrossArchBuild is specified and the current platform is not an Apple platform (that doesn't use rootfs) + if [[ $isCrossBuild == 1 && "$targetOs" != "osx" && "$targetOs" != "ios" && "$targetOs" != "iossimulator" && "$targetOs" != "tvos" && "$targetOs" != "tvossimulator" && "$targetOs" != "maccatalyst" ]]; then passedRootfsDir=${ROOTFS_DIR} fi initDistroRidGlobal "${targetOs}" "${targetArch}" "${isPortableBuild}" "${passedRootfsDir}" diff --git a/eng/liveBuilds.targets b/eng/liveBuilds.targets index 855ad32118d3d..3830816fc037a 100644 --- a/eng/liveBuilds.targets +++ b/eng/liveBuilds.targets @@ -25,7 +25,7 @@ $([MSBuild]::NormalizeDirectory('$(CoreCLRArtifactsPath)', 'sharedFramework')) $([MSBuild]::NormalizeDirectory('$(CoreCLRArtifactsPath)', 'crossgen2')) $([MSBuild]::NormalizeDirectory('$(CoreCLRArtifactsPath)', 'ilc-published')) - $([MSBuild]::NormalizeDirectory('$(CoreCLRArtifactsPath)', '$(BuildArchitecture)', 'ilc')) + $([MSBuild]::NormalizeDirectory('$(CoreCLRArtifactsPath)', '$(BuildArchitecture)', 'ilc')) $([MSBuild]::NormalizeDirectory('$(CoreCLRArtifactsPath)', 'aotsdk')) $([MSBuild]::NormalizeDirectory('$(CoreCLRArtifactsPath)', 'build')) diff --git a/eng/native/build-commons.sh b/eng/native/build-commons.sh index e9d696fa87f14..8f4a19453bd7d 100755 --- a/eng/native/build-commons.sh +++ b/eng/native/build-commons.sh @@ -104,7 +104,7 @@ build_native() echo "Error: Unknown Android architecture $hostArch." exit 1 fi - elif [[ "$__TargetOS" == iossimulator ]]; then + elif [[ "$targetOS" == iossimulator ]]; then cmakeArgs="-C $__RepoRootDir/eng/native/tryrun_ios_tvos.cmake $cmakeArgs" # set default iOS simulator deployment target @@ -118,7 +118,7 @@ build_native() echo "Error: Unknown iOS Simulator architecture $__TargetArch." exit 1 fi - elif [[ "$__TargetOS" == ios ]]; then + elif [[ "$targetOS" == ios ]]; then cmakeArgs="-C $__RepoRootDir/eng/native/tryrun_ios_tvos.cmake $cmakeArgs" # set default iOS device deployment target @@ -130,7 +130,7 @@ build_native() echo "Error: Unknown iOS architecture $__TargetArch." exit 1 fi - elif [[ "$__TargetOS" == tvossimulator ]]; then + elif [[ "$targetOS" == tvossimulator ]]; then cmakeArgs="-C $__RepoRootDir/eng/native/tryrun_ios_tvos.cmake $cmakeArgs" # set default tvOS simulator deployment target @@ -144,7 +144,7 @@ build_native() echo "Error: Unknown tvOS Simulator architecture $__TargetArch." exit 1 fi - elif [[ "$__TargetOS" == tvos ]]; then + elif [[ "$targetOS" == tvos ]]; then cmakeArgs="-C $__RepoRootDir/eng/native/tryrun_ios_tvos.cmake $cmakeArgs" # set default tvOS device deployment target @@ -285,7 +285,6 @@ source "$__RepoRootDir/eng/native/init-os-and-arch.sh" __TargetArch=$arch __TargetOS=$os -__HostOS=$os __OutputRid='' # Get the number of processors available to the scheduler @@ -482,6 +481,16 @@ while :; do fi ;; + hostos|-hostos) + if [[ -n "$2" ]]; then + __HostOS="$2" + shift + else + echo "ERROR: 'hostos' requires a non-empty option argument" + exit 1 + fi + ;; + *) handle_arguments "$1" "$2" if [[ "$__ShiftArgs" == 1 ]]; then @@ -498,6 +507,10 @@ if [[ -z "$__HostArch" ]]; then __HostArch=$__TargetArch fi +if [[ -z "$__HostOS" ]]; then + __HostOS=$__TargetOS +fi + __CommonMSBuildArgs="/p:TargetArchitecture=$__TargetArch /p:Configuration=$__BuildType /p:TargetOS=$__TargetOS /nodeReuse:false $__OfficialBuildIdArg $__SignTypeArg $__SkipRestoreArg" # Configure environment if we are doing a verbose build diff --git a/src/coreclr/build-runtime.sh b/src/coreclr/build-runtime.sh index 90179bc475654..31c5cc286d530 100755 --- a/src/coreclr/build-runtime.sh +++ b/src/coreclr/build-runtime.sh @@ -173,7 +173,7 @@ fi eval "$__RepoRootDir/eng/native/version/copy_version_files.sh" -build_native "$__TargetOS" "$__HostArch" "$__ProjectRoot" "$__IntermediatesDir" "$__CMakeTarget" "$__CMakeArgs" "CoreCLR component" +build_native "$__HostOS" "$__HostArch" "$__ProjectRoot" "$__IntermediatesDir" "$__CMakeTarget" "$__CMakeArgs" "CoreCLR component" # Build complete diff --git a/src/coreclr/crosscomponents.cmake b/src/coreclr/crosscomponents.cmake index 2bd288221192f..a95a1722a6f8f 100644 --- a/src/coreclr/crosscomponents.cmake +++ b/src/coreclr/crosscomponents.cmake @@ -1,35 +1,37 @@ # Add targets to the crosscomponents subcomponent build -if (CLR_CMAKE_HOST_OS STREQUAL CLR_CMAKE_TARGET_OS) +if (CLR_CMAKE_HOST_OS STREQUAL CLR_CMAKE_TARGET_OS OR CLR_CMAKE_TARGET_IOS OR CLR_CMAKE_TARGET_TVOS OR CLR_CMAKE_TARGET_MACCATALYST) install_clr (TARGETS jitinterface_${ARCH_HOST_NAME} DESTINATIONS . COMPONENT crosscomponents ) - if (CLR_CMAKE_TARGET_OSX AND ARCH_TARGET_NAME STREQUAL arm64) - install_clr (TARGETS - clrjit_universal_${ARCH_TARGET_NAME}_${ARCH_HOST_NAME} - DESTINATIONS . - COMPONENT crosscomponents - ) - elseif (CLR_CMAKE_TARGET_ARCH_ARM OR CLR_CMAKE_TARGET_ARCH_ARM64) - install_clr (TARGETS - clrjit_universal_${ARCH_TARGET_NAME}_${ARCH_HOST_NAME} - DESTINATIONS . - COMPONENT crosscomponents - ) - elseif (CLR_CMAKE_TARGET_UNIX) - install_clr (TARGETS - clrjit_unix_${ARCH_TARGET_NAME}_${ARCH_HOST_NAME} - DESTINATIONS . - COMPONENT crosscomponents - ) - else() - install_clr (TARGETS - clrjit_win_${ARCH_TARGET_NAME}_${ARCH_HOST_NAME} - DESTINATIONS . - COMPONENT crosscomponents - ) + if (NOT (CLR_CMAKE_TARGET_IOS OR CLR_CMAKE_TARGET_TVOS OR CLR_CMAKE_TARGET_MACCATALYST)) + if (CLR_CMAKE_TARGET_OSX AND ARCH_TARGET_NAME STREQUAL arm64) + install_clr (TARGETS + clrjit_universal_${ARCH_TARGET_NAME}_${ARCH_HOST_NAME} + DESTINATIONS . + COMPONENT crosscomponents + ) + elseif (CLR_CMAKE_TARGET_ARCH_ARM OR CLR_CMAKE_TARGET_ARCH_ARM64) + install_clr (TARGETS + clrjit_universal_${ARCH_TARGET_NAME}_${ARCH_HOST_NAME} + DESTINATIONS . + COMPONENT crosscomponents + ) + elseif (CLR_CMAKE_TARGET_UNIX) + install_clr (TARGETS + clrjit_unix_${ARCH_TARGET_NAME}_${ARCH_HOST_NAME} + DESTINATIONS . + COMPONENT crosscomponents + ) + else() + install_clr (TARGETS + clrjit_win_${ARCH_TARGET_NAME}_${ARCH_HOST_NAME} + DESTINATIONS . + COMPONENT crosscomponents + ) + endif() endif() endif() diff --git a/src/coreclr/runtime.proj b/src/coreclr/runtime.proj index 496e28198429f..0b936f4579c56 100644 --- a/src/coreclr/runtime.proj +++ b/src/coreclr/runtime.proj @@ -45,6 +45,7 @@ <_CoreClrBuildArg Condition="'$(PgoInstrument)' == 'true'" Include="-pgoinstrument" /> <_CoreClrBuildArg Condition="'$(NativeOptimizationDataSupported)' == 'true' and '$(NoPgoOptimize)' != 'true' and '$(PgoInstrument)' != 'true'" Include="-pgodatapath "$(PgoPackagePath)"" /> <_CoreClrBuildArg Condition="'$(HostArchitecture)' != ''" Include="-hostarch $(HostArchitecture)" /> + <_CoreClrBuildArg Condition="'$(HostCrossOS)' != ''" Include="-hostos $(HostCrossOS)" /> <_CoreClrBuildArg Include="-outputrid $(OutputRID)" /> diff --git a/src/coreclr/tools/aot/ILCompiler/ILCompiler.csproj b/src/coreclr/tools/aot/ILCompiler/ILCompiler.csproj index 7e5f930584abf..564a02b632bfb 100644 --- a/src/coreclr/tools/aot/ILCompiler/ILCompiler.csproj +++ b/src/coreclr/tools/aot/ILCompiler/ILCompiler.csproj @@ -42,7 +42,7 @@ - + @@ -68,7 +68,7 @@ - + - + @@ -81,7 +81,7 @@ - + diff --git a/src/mono/sample/iOS-NativeAOT/Program.csproj b/src/mono/sample/iOS-NativeAOT/Program.csproj index cb9d6c6c8b27c..89862c9d8e1a4 100644 --- a/src/mono/sample/iOS-NativeAOT/Program.csproj +++ b/src/mono/sample/iOS-NativeAOT/Program.csproj @@ -47,7 +47,7 @@ - $([MSBuild]::NormalizeDirectory('$(RepoRoot)', 'artifacts', 'bin', 'coreclr', '$(HostOS).$(BuildArchitecture).$(CoreCLRConfiguration)', 'ilc')) + $([MSBuild]::NormalizeDirectory('$(RepoRoot)', 'artifacts', 'bin', 'coreclr', '$(TargetOS).$(TargetArchitecture).$(CoreCLRConfiguration)', '$(BuildArchitecture)' ,'ilc')) $(IlcPath) $(CoreCLRAotSdkDir) $(LibrariesAllBinArtifactsPath)