From 0ddc81f261acf05b9bbd1508fdfbb7290a8199ed Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Fri, 30 Jun 2023 12:47:49 +0200 Subject: [PATCH 1/4] Add Native AOT cross-build support for iOS-like platforms --- eng/Subsets.props | 40 ++++++------- eng/build.sh | 2 +- eng/liveBuilds.targets | 4 +- eng/native/build-commons.sh | 11 ++++ src/coreclr/build-runtime.sh | 7 ++- src/coreclr/crosscomponents.cmake | 56 ++++++++++--------- src/coreclr/runtime.proj | 1 + .../tools/aot/ILCompiler/ILCompiler.csproj | 2 +- .../tools/aot/ILCompiler/ILCompiler.props | 8 +-- .../ILCompiler/ILCompiler_crossarch.csproj | 5 +- .../tools/aot/crossgen2/crossgen2.csproj | 2 +- .../tools/aot/crossgen2/crossgen2.props | 6 +- .../aot/crossgen2/crossgen2_crossarch.csproj | 5 +- src/mono/sample/iOS-NativeAOT/Program.csproj | 2 +- 14 files changed, 83 insertions(+), 68 deletions(-) diff --git a/eng/Subsets.props b/eng/Subsets.props index bfa808ab25cd9..07f5d4799afef 100644 --- a/eng/Subsets.props +++ b/eng/Subsets.props @@ -267,6 +267,22 @@ Category="clr" /> + + + + + @@ -300,26 +316,6 @@ CMakeArgs=$(CMakeArgs) -DCLR_CROSS_COMPONENTS_BUILD=1" Category="clr" /> - - - true - TargetOS=osx;TargetArchitecture=$(BuildArchitecture) - - - - - - - @@ -336,8 +332,8 @@ - - + + diff --git a/eng/build.sh b/eng/build.sh index bfe3d351e2a62..9292a11e044cf 100755 --- a/eng/build.sh +++ b/eng/build.sh @@ -141,7 +141,7 @@ initDistroRid() 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 + 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 5ea1ca5525a2a..3bb674c498a53 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)', 'host', 'ilc')) $([MSBuild]::NormalizeDirectory('$(CoreCLRArtifactsPath)', 'aotsdk')) $([MSBuild]::NormalizeDirectory('$(CoreCLRArtifactsPath)', 'build')) @@ -71,7 +71,7 @@ $([MSBuild]::NormalizeDirectory('$(CoreCLRArtifactsPath)','sharedFramework')) $([MSBuild]::NormalizeDirectory('$(CoreCLRSharedFrameworkDir)','PDB')) $([MSBuild]::NormalizeDirectory('$(CoreCLRArtifactsPath)','$(CoreCLRCrossTargetComponentDirName)','sharedFramework')) + Condition="'$(CoreCLRCrossTargetComponentDirName)' != ''">$([MSBuild]::NormalizeDirectory('$(CoreCLRArtifactsPath)','host','sharedFramework')) $([MSBuild]::NormalizeDirectory('$(MonoArtifactsPath)')) diff --git a/eng/native/build-commons.sh b/eng/native/build-commons.sh index e9d696fa87f14..377e711f38b18 100755 --- a/eng/native/build-commons.sh +++ b/eng/native/build-commons.sh @@ -287,6 +287,7 @@ __TargetArch=$arch __TargetOS=$os __HostOS=$os __OutputRid='' +__OutputRIDOS='' # Get the number of processors available to the scheduler platform="$(uname -s | tr '[:upper:]' '[:lower:]')" @@ -482,6 +483,16 @@ while :; do fi ;; + outputridos|-outputridos) + if [[ -n "$2" ]]; then + __OutputRIDOS="$2" + shift + else + echo "ERROR: 'outputridos' requires a non-empty option argument" + exit 1 + fi + ;; + *) handle_arguments "$1" "$2" if [[ "$__ShiftArgs" == 1 ]]; then diff --git a/src/coreclr/build-runtime.sh b/src/coreclr/build-runtime.sh index 90179bc475654..99fdb5a435563 100755 --- a/src/coreclr/build-runtime.sh +++ b/src/coreclr/build-runtime.sh @@ -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" +fi __BinDir="$__RootBinDir/bin/coreclr/$__ConfigTriplet" __ArtifactsObjDir="$__RepoRootDir/artifacts/obj" __ArtifactsIntermediatesDir="$__ArtifactsObjDir/coreclr" @@ -117,8 +120,8 @@ __IntermediatesDir="$__ArtifactsIntermediatesDir/$__ConfigTriplet" export __IntermediatesDir __ArtifactsIntermediatesDir if [[ "$__ExplicitHostArch" == 1 ]]; then - __IntermediatesDir="$__IntermediatesDir/$__HostArch" - __BinDir="$__BinDir/$__HostArch" + __IntermediatesDir="$__IntermediatesDir/host" + __BinDir="$__BinDir/host" fi # CI_SPECIFIC - On CI machines, $HOME may not be set. In such a case, create a subfolder and set the variable to set. diff --git a/src/coreclr/crosscomponents.cmake b/src/coreclr/crosscomponents.cmake index 2bd288221192f..87b51adb1b44a 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 . + DESTINATIONS ../host 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 ../host + 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 ../host + COMPONENT crosscomponents + ) + elseif (CLR_CMAKE_TARGET_UNIX) + install_clr (TARGETS + clrjit_unix_${ARCH_TARGET_NAME}_${ARCH_HOST_NAME} + DESTINATIONS ../host + COMPONENT crosscomponents + ) + else() + install_clr (TARGETS + clrjit_win_${ARCH_TARGET_NAME}_${ARCH_HOST_NAME} + DESTINATIONS ../host + COMPONENT crosscomponents + ) + endif() endif() endif() @@ -37,7 +39,7 @@ if(NOT CLR_CMAKE_HOST_LINUX AND NOT CLR_CMAKE_HOST_APPLE AND NOT FEATURE_CROSSBI install_clr (TARGETS mscordaccore mscordbi - DESTINATIONS . sharedFramework + DESTINATIONS ../host sharedFramework COMPONENT crosscomponents ) endif() diff --git a/src/coreclr/runtime.proj b/src/coreclr/runtime.proj index 496e28198429f..eb0bf5e0245d8 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="'$(OutputRIDOS)' != ''" Include="-outputridos $(OutputRIDOS)" /> <_CoreClrBuildArg Include="-outputrid $(OutputRID)" /> diff --git a/src/coreclr/tools/aot/ILCompiler/ILCompiler.csproj b/src/coreclr/tools/aot/ILCompiler/ILCompiler.csproj index 7e5f930584abf..24cb6cee0f7fb 100644 --- a/src/coreclr/tools/aot/ILCompiler/ILCompiler.csproj +++ b/src/coreclr/tools/aot/ILCompiler/ILCompiler.csproj @@ -42,7 +42,7 @@ - + diff --git a/src/coreclr/tools/aot/ILCompiler/ILCompiler.props b/src/coreclr/tools/aot/ILCompiler/ILCompiler.props index 247c50653e20b..6fd090478ba46 100644 --- a/src/coreclr/tools/aot/ILCompiler/ILCompiler.props +++ b/src/coreclr/tools/aot/ILCompiler/ILCompiler.props @@ -51,7 +51,7 @@ $(runtimefreebsdarm64MicrosoftNETCoreRuntimeObjWriterVersion) - true + true true @@ -102,13 +102,13 @@ - $(TargetArchitecture) - $(CrossHostArch) + $(TargetArchitecture) + $(BuildArchitecture) arm $(LibPrefix)jitinterface_$(TargetArchitectureForSharedLibraries)$(LibSuffix) - $(RuntimeBinDir)$(CrossHostArch) + $(RuntimeBinDir)$(CrossHostPath) diff --git a/src/coreclr/tools/aot/ILCompiler/ILCompiler_crossarch.csproj b/src/coreclr/tools/aot/ILCompiler/ILCompiler_crossarch.csproj index 9ed97b693e6dd..021f2c676c621 100644 --- a/src/coreclr/tools/aot/ILCompiler/ILCompiler_crossarch.csproj +++ b/src/coreclr/tools/aot/ILCompiler/ILCompiler_crossarch.csproj @@ -1,7 +1,8 @@ - $(BuildArchitecture) - $(RuntimeBinDir)/$(CrossHostArch)/ilc/ + + host + $(RuntimeBinDir)/$(CrossHostPath)/ilc/ $(ToolsRID) diff --git a/src/coreclr/tools/aot/crossgen2/crossgen2.csproj b/src/coreclr/tools/aot/crossgen2/crossgen2.csproj index ceeb4d63ad0c1..443eb4b67cdd3 100644 --- a/src/coreclr/tools/aot/crossgen2/crossgen2.csproj +++ b/src/coreclr/tools/aot/crossgen2/crossgen2.csproj @@ -40,7 +40,7 @@ - + diff --git a/src/coreclr/tools/aot/crossgen2/crossgen2.props b/src/coreclr/tools/aot/crossgen2/crossgen2.props index 4e16e52c3dc76..87b5377849cb4 100644 --- a/src/coreclr/tools/aot/crossgen2/crossgen2.props +++ b/src/coreclr/tools/aot/crossgen2/crossgen2.props @@ -42,13 +42,13 @@ - $(TargetArchitecture) - $(CrossHostArch) + $(TargetArchitecture) + $(BuildArchitecture) arm $(LibPrefix)jitinterface_$(TargetArchitectureForSharedLibraries)$(LibSuffix) - $(RuntimeBinDir)$(CrossHostArch) + $(RuntimeBinDir)$(CrossHostPath) diff --git a/src/coreclr/tools/aot/crossgen2/crossgen2_crossarch.csproj b/src/coreclr/tools/aot/crossgen2/crossgen2_crossarch.csproj index 544b4271117b5..47db6169443bd 100644 --- a/src/coreclr/tools/aot/crossgen2/crossgen2_crossarch.csproj +++ b/src/coreclr/tools/aot/crossgen2/crossgen2_crossarch.csproj @@ -1,7 +1,8 @@ - $(BuildArchitecture) - $(RuntimeBinDir)/$(CrossHostArch)/crossgen2 + + host + $(RuntimeBinDir)$(CrossHostPath)/crossgen2 false diff --git a/src/mono/sample/iOS-NativeAOT/Program.csproj b/src/mono/sample/iOS-NativeAOT/Program.csproj index cb9d6c6c8b27c..dcbcd58f54ae9 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)', 'host' ,'ilc')) $(IlcPath) $(CoreCLRAotSdkDir) $(LibrariesAllBinArtifactsPath) From 560dbf7444e6f3bb95d9e34ca37f6aa8a18b56b8 Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Fri, 30 Jun 2023 14:36:26 +0200 Subject: [PATCH 2/4] Use cross architecture path for cross-os builds --- eng/liveBuilds.targets | 4 ++-- src/coreclr/build-runtime.sh | 4 ++-- src/coreclr/crosscomponents.cmake | 12 ++++++------ src/coreclr/tools/aot/ILCompiler/ILCompiler.props | 8 ++++---- .../tools/aot/ILCompiler/ILCompiler_crossarch.csproj | 5 ++--- src/coreclr/tools/aot/crossgen2/crossgen2.props | 6 +++--- .../tools/aot/crossgen2/crossgen2_crossarch.csproj | 5 ++--- src/mono/sample/iOS-NativeAOT/Program.csproj | 2 +- 8 files changed, 22 insertions(+), 24 deletions(-) diff --git a/eng/liveBuilds.targets b/eng/liveBuilds.targets index 3bb674c498a53..0a38fecbf2ad0 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)', 'host', 'ilc')) + $([MSBuild]::NormalizeDirectory('$(CoreCLRArtifactsPath)', '$(BuildArchitecture)', 'ilc')) $([MSBuild]::NormalizeDirectory('$(CoreCLRArtifactsPath)', 'aotsdk')) $([MSBuild]::NormalizeDirectory('$(CoreCLRArtifactsPath)', 'build')) @@ -71,7 +71,7 @@ $([MSBuild]::NormalizeDirectory('$(CoreCLRArtifactsPath)','sharedFramework')) $([MSBuild]::NormalizeDirectory('$(CoreCLRSharedFrameworkDir)','PDB')) $([MSBuild]::NormalizeDirectory('$(CoreCLRArtifactsPath)','host','sharedFramework')) + Condition="'$(CoreCLRCrossTargetComponentDirName)' != ''">$([MSBuild]::NormalizeDirectory('$(CoreCLRArtifactsPath)','$(BuildArchitecture)','sharedFramework')) $([MSBuild]::NormalizeDirectory('$(MonoArtifactsPath)')) diff --git a/src/coreclr/build-runtime.sh b/src/coreclr/build-runtime.sh index 99fdb5a435563..fc39de0325c4f 100755 --- a/src/coreclr/build-runtime.sh +++ b/src/coreclr/build-runtime.sh @@ -120,8 +120,8 @@ __IntermediatesDir="$__ArtifactsIntermediatesDir/$__ConfigTriplet" export __IntermediatesDir __ArtifactsIntermediatesDir if [[ "$__ExplicitHostArch" == 1 ]]; then - __IntermediatesDir="$__IntermediatesDir/host" - __BinDir="$__BinDir/host" + __IntermediatesDir="$__IntermediatesDir/$__HostArch" + __BinDir="$__BinDir/$__HostArch" fi # CI_SPECIFIC - On CI machines, $HOME may not be set. In such a case, create a subfolder and set the variable to set. diff --git a/src/coreclr/crosscomponents.cmake b/src/coreclr/crosscomponents.cmake index 87b51adb1b44a..a95a1722a6f8f 100644 --- a/src/coreclr/crosscomponents.cmake +++ b/src/coreclr/crosscomponents.cmake @@ -2,7 +2,7 @@ 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 ../host + DESTINATIONS . COMPONENT crosscomponents ) @@ -10,25 +10,25 @@ if (CLR_CMAKE_HOST_OS STREQUAL CLR_CMAKE_TARGET_OS OR CLR_CMAKE_TARGET_IOS OR CL if (CLR_CMAKE_TARGET_OSX AND ARCH_TARGET_NAME STREQUAL arm64) install_clr (TARGETS clrjit_universal_${ARCH_TARGET_NAME}_${ARCH_HOST_NAME} - DESTINATIONS ../host + 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 ../host + DESTINATIONS . COMPONENT crosscomponents ) elseif (CLR_CMAKE_TARGET_UNIX) install_clr (TARGETS clrjit_unix_${ARCH_TARGET_NAME}_${ARCH_HOST_NAME} - DESTINATIONS ../host + DESTINATIONS . COMPONENT crosscomponents ) else() install_clr (TARGETS clrjit_win_${ARCH_TARGET_NAME}_${ARCH_HOST_NAME} - DESTINATIONS ../host + DESTINATIONS . COMPONENT crosscomponents ) endif() @@ -39,7 +39,7 @@ if(NOT CLR_CMAKE_HOST_LINUX AND NOT CLR_CMAKE_HOST_APPLE AND NOT FEATURE_CROSSBI install_clr (TARGETS mscordaccore mscordbi - DESTINATIONS ../host sharedFramework + DESTINATIONS . sharedFramework COMPONENT crosscomponents ) endif() diff --git a/src/coreclr/tools/aot/ILCompiler/ILCompiler.props b/src/coreclr/tools/aot/ILCompiler/ILCompiler.props index 6fd090478ba46..247c50653e20b 100644 --- a/src/coreclr/tools/aot/ILCompiler/ILCompiler.props +++ b/src/coreclr/tools/aot/ILCompiler/ILCompiler.props @@ -51,7 +51,7 @@ $(runtimefreebsdarm64MicrosoftNETCoreRuntimeObjWriterVersion) - true + true true @@ -102,13 +102,13 @@ - $(TargetArchitecture) - $(BuildArchitecture) + $(TargetArchitecture) + $(CrossHostArch) arm $(LibPrefix)jitinterface_$(TargetArchitectureForSharedLibraries)$(LibSuffix) - $(RuntimeBinDir)$(CrossHostPath) + $(RuntimeBinDir)$(CrossHostArch) diff --git a/src/coreclr/tools/aot/ILCompiler/ILCompiler_crossarch.csproj b/src/coreclr/tools/aot/ILCompiler/ILCompiler_crossarch.csproj index 021f2c676c621..9ed97b693e6dd 100644 --- a/src/coreclr/tools/aot/ILCompiler/ILCompiler_crossarch.csproj +++ b/src/coreclr/tools/aot/ILCompiler/ILCompiler_crossarch.csproj @@ -1,8 +1,7 @@ - - host - $(RuntimeBinDir)/$(CrossHostPath)/ilc/ + $(BuildArchitecture) + $(RuntimeBinDir)/$(CrossHostArch)/ilc/ $(ToolsRID) diff --git a/src/coreclr/tools/aot/crossgen2/crossgen2.props b/src/coreclr/tools/aot/crossgen2/crossgen2.props index 87b5377849cb4..4e16e52c3dc76 100644 --- a/src/coreclr/tools/aot/crossgen2/crossgen2.props +++ b/src/coreclr/tools/aot/crossgen2/crossgen2.props @@ -42,13 +42,13 @@ - $(TargetArchitecture) - $(BuildArchitecture) + $(TargetArchitecture) + $(CrossHostArch) arm $(LibPrefix)jitinterface_$(TargetArchitectureForSharedLibraries)$(LibSuffix) - $(RuntimeBinDir)$(CrossHostPath) + $(RuntimeBinDir)$(CrossHostArch) diff --git a/src/coreclr/tools/aot/crossgen2/crossgen2_crossarch.csproj b/src/coreclr/tools/aot/crossgen2/crossgen2_crossarch.csproj index 47db6169443bd..544b4271117b5 100644 --- a/src/coreclr/tools/aot/crossgen2/crossgen2_crossarch.csproj +++ b/src/coreclr/tools/aot/crossgen2/crossgen2_crossarch.csproj @@ -1,8 +1,7 @@ - - host - $(RuntimeBinDir)$(CrossHostPath)/crossgen2 + $(BuildArchitecture) + $(RuntimeBinDir)/$(CrossHostArch)/crossgen2 false diff --git a/src/mono/sample/iOS-NativeAOT/Program.csproj b/src/mono/sample/iOS-NativeAOT/Program.csproj index dcbcd58f54ae9..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', '$(TargetOS).$(TargetArchitecture).$(CoreCLRConfiguration)', 'host' ,'ilc')) + $([MSBuild]::NormalizeDirectory('$(RepoRoot)', 'artifacts', 'bin', 'coreclr', '$(TargetOS).$(TargetArchitecture).$(CoreCLRConfiguration)', '$(BuildArchitecture)' ,'ilc')) $(IlcPath) $(CoreCLRAotSdkDir) $(LibrariesAllBinArtifactsPath) From 02f37c2af20625425907e5b9fe6d3997512fc570 Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Mon, 10 Jul 2023 16:15:53 +0200 Subject: [PATCH 3/4] Add -hostos parameter for cross-components build --- eng/Subsets.props | 23 ++++--------------- eng/liveBuilds.targets | 4 ++-- eng/native/build-commons.sh | 20 ++++++++-------- src/coreclr/build-runtime.sh | 5 +--- src/coreclr/runtime.proj | 2 +- .../tools/aot/ILCompiler/ILCompiler.csproj | 4 ++-- .../tools/aot/crossgen2/crossgen2.csproj | 4 ++-- 7 files changed, 23 insertions(+), 39 deletions(-) diff --git a/eng/Subsets.props b/eng/Subsets.props index 07f5d4799afef..12adcce07ce0f 100644 --- a/eng/Subsets.props +++ b/eng/Subsets.props @@ -254,28 +254,13 @@ - + - - - - - - - + + diff --git a/eng/liveBuilds.targets b/eng/liveBuilds.targets index 995e2b6ee9770..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')) @@ -71,7 +71,7 @@ $([MSBuild]::NormalizeDirectory('$(CoreCLRArtifactsPath)','sharedFramework')) $([MSBuild]::NormalizeDirectory('$(CoreCLRSharedFrameworkDir)','PDB')) $([MSBuild]::NormalizeDirectory('$(CoreCLRArtifactsPath)','$(BuildArchitecture)','sharedFramework')) + Condition="'$(CoreCLRCrossTargetComponentDirName)' != ''">$([MSBuild]::NormalizeDirectory('$(CoreCLRArtifactsPath)','$(CoreCLRCrossTargetComponentDirName)','sharedFramework')) $([MSBuild]::NormalizeDirectory('$(MonoArtifactsPath)')) diff --git a/eng/native/build-commons.sh b/eng/native/build-commons.sh index 377e711f38b18..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,9 +285,7 @@ source "$__RepoRootDir/eng/native/init-os-and-arch.sh" __TargetArch=$arch __TargetOS=$os -__HostOS=$os __OutputRid='' -__OutputRIDOS='' # Get the number of processors available to the scheduler platform="$(uname -s | tr '[:upper:]' '[:lower:]')" @@ -483,12 +481,12 @@ while :; do fi ;; - outputridos|-outputridos) + hostos|-hostos) if [[ -n "$2" ]]; then - __OutputRIDOS="$2" + __HostOS="$2" shift else - echo "ERROR: 'outputridos' requires a non-empty option argument" + echo "ERROR: 'hostos' requires a non-empty option argument" exit 1 fi ;; @@ -509,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 fc39de0325c4f..31c5cc286d530 100755 --- a/src/coreclr/build-runtime.sh +++ b/src/coreclr/build-runtime.sh @@ -109,9 +109,6 @@ __ConfigTriplet="$__TargetOS.$__TargetArch.$__BuildType" if [[ "$__TargetOS" == "linux-bionic" ]]; then __ConfigTriplet="linux.$__TargetArch.$__BuildType" fi -if [[ ! -z "$__OutputRIDOS" ]]; then - __ConfigTriplet="$__OutputRIDOS.$__TargetArch.$__BuildType" -fi __BinDir="$__RootBinDir/bin/coreclr/$__ConfigTriplet" __ArtifactsObjDir="$__RepoRootDir/artifacts/obj" __ArtifactsIntermediatesDir="$__ArtifactsObjDir/coreclr" @@ -176,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/runtime.proj b/src/coreclr/runtime.proj index eb0bf5e0245d8..0b936f4579c56 100644 --- a/src/coreclr/runtime.proj +++ b/src/coreclr/runtime.proj @@ -45,7 +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="'$(OutputRIDOS)' != ''" Include="-outputridos $(OutputRIDOS)" /> + <_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 24cb6cee0f7fb..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 @@ - + From 1276b5347279031d944a30f36fec1f4547710d86 Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Mon, 10 Jul 2023 16:16:49 +0200 Subject: [PATCH 4/4] Update eng/build.sh MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Michal Strehovský --- eng/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/build.sh b/eng/build.sh index 9292a11e044cf..c4f18b3051df2 100755 --- a/eng/build.sh +++ b/eng/build.sh @@ -140,7 +140,7 @@ 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 + # 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