未验证 提交 7d562f9d 编写于 作者: J Jeremy Koritzinsky 提交者: GitHub

Make the cross-component build just another invocation of the build-runtime script (#67108)

上级 490c166d
......@@ -137,6 +137,28 @@ If you wanted to support armv7 CPU with VFPv3-d16, you'd use the following compi
./src/coreclr/build-runtime.sh -cross -arm -cmakeargs -DCLR_ARM_FPU_CAPABILITY=0x3 -cmakeargs -DCLR_ARM_FPU_TYPE=vfpv3-d16
```
Building the Cross-Targeting Tools
------------------------------------
Some parts of our build process need some native components that are built for the current machine architecture, even when you are building for a different target architecture. These tools are referred to as cross-targeting tools or "cross tools". There are two categories of these tools today:
- Crossgen2 JIT tools
- Diagnostic libraries
The Crossgen2 JIT tools are used to run Crossgen2 on libraries built during the current build, such as during the clr.nativecorelib stage. These tools are automatically built when using the `./build.cmd` or `./build.sh` scripts at the root of the repo to build any of the CoreCLR native files, but they are not automatically built when using the `build-runtime.cmd/sh` scripts. To build these tools, you need to pass the `-hostarch` flag with the architecture of the host machine and the `-component crosscomponents` flag to specify that you only want to build the cross-targetting tools. For example:
```
./src/coreclr/build-runtime.sh -arm -hostarch x64 -component crosscomponents -cmakeargs -DCLR_CROSS_COMPONENTS_BUILD=1
```
On Windows, the cross-targeting diagnostic libraries are built with the `linuxdac` and `alpinedac` subsets from the root `build.cmd` script, but they can also be built manually with the `build-runtime.cmd` scripts. These builds also require you to pass the `-os` flag to specify the target OS. For example:
```
src\coreclr\build-runtime.cmd -arm64 -hostarch x64 -os Linux -component crosscomponents -cmakeargs "-DCLR_CROSS_COMPONENTS_BUILD=1"
```
If you're building the cross-components in powershell, you'll need to wrap `"-DCLR_CROSS_COMPONENTS_BUILD=1"` with single quotes (`'`) to ensure things are escaped correctly for CMD.
Build System.Private.CoreLib on Ubuntu
--------------------------------------
The following instructions assume you are on a Linux machine such as Ubuntu 14.04 x86 64bit.
......
......@@ -58,7 +58,7 @@
</PropertyGroup>
<PropertyGroup>
<DefaultCoreClrSubsets>clr.native+linuxdac+clr.corelib+clr.tools+clr.nativecorelib+clr.packages+clr.nativeaotlibs</DefaultCoreClrSubsets>
<DefaultCoreClrSubsets>clr.native+linuxdac+clr.corelib+clr.tools+clr.nativecorelib+clr.packages+clr.nativeaotlibs+clr.crossarchtools</DefaultCoreClrSubsets>
<!-- Even on platforms that do not support the CoreCLR runtime, we still want to build ilasm/ildasm. -->
<DefaultCoreClrSubsets Condition="'$(PrimaryRuntimeFlavor)' != 'CoreCLR'">clr.iltools+clr.packages</DefaultCoreClrSubsets>
......@@ -108,6 +108,7 @@
<SubsetName Include="Clr.Native" Description="All CoreCLR native non-test components, including the runtime, jits, and other native tools. Includes clr.hosts, clr.runtime, clr.jit, clr.alljits, clr.paltests, clr.iltools, clr.nativeaotruntime, clr.spmi." />
<SubsetName Include="Clr.NativeAotLibs" Description="The CoreCLR native AOT CoreLib and other low level class libraries." />
<SubsetName Include="Clr.NativeAotRuntime" Description="The stripped-down CoreCLR native AOT runtime." />
<SubsetName Include="Clr.CrossArchTools" Description="The cross-targetted CoreCLR tools." />
<SubsetName Include="Clr.PalTests" OnDemand="true" Description="The CoreCLR PAL tests." />
<SubsetName Include="Clr.PalTestList" OnDemand="true" Description="Generate the list of the CoreCLR PAL tests. When using the command line, use Clr.PalTests instead." />
<SubsetName Include="Clr.Hosts" Description="The CoreCLR corerun test host." />
......@@ -221,19 +222,70 @@
</ItemGroup>
<ItemGroup Condition="'$(ClrRuntimeBuildSubsets)' != ''">
<ProjectToBuild Include="$(CoreClrProjectRoot)runtime.proj" AdditionalProperties="%(AdditionalProperties);$(ClrRuntimeBuildSubsets)" Category="clr" />
<ProjectToBuild
Include="$(CoreClrProjectRoot)runtime.proj"
AdditionalProperties="%(AdditionalProperties);$(ClrRuntimeBuildSubsets)"
Category="clr" />
</ItemGroup>
<!-- Build the CoreCLR cross-arch tools when we're doing a cross-architecture build and either we're building any CoreCLR native tools for platforms CoreCLR fully supports or when someone explicitly requests them -->
<ItemGroup Condition="(('$(ClrRuntimeBuildSubsets)' != '' and '$(PrimaryRuntimeFlavor)' == 'CoreCLR' and '$(TargetsMobile)' != 'true') or $(_subset.Contains('+clr.crossarchtools+'))) and '$(BuildArchitecture)' != '$(TargetArchitecture)'">
<ProjectToBuild
Include="$(CoreClrProjectRoot)runtime.proj"
AdditionalProperties="%(AdditionalProperties);
ClrCrossComponentsSubset=true;
HostArchitecture=$(BuildArchitecture);
PgoInstrument=false;
NoPgoOptimize=true;
CrossBuild=false;
CMakeArgs=$(CMakeArgs) -DCLR_CROSS_COMPONENTS_BUILD=1"
Category="clr" />
</ItemGroup>
<ItemGroup Condition="(('$(ClrRuntimeBuildSubsets)' != '' and '$(PrimaryRuntimeFlavor)' == 'CoreCLR' and '$(TargetsMobile)' != 'true') or $(_subset.Contains('+clr.crossarchtools+'))) and $([MSBuild]::IsOsPlatform(Windows)) and '$(TargetArchitecture)' == 'arm' and '$(BuildArchitecture)' == 'x64'">
<ProjectToBuild
Include="$(CoreClrProjectRoot)runtime.proj"
AdditionalProperties="%(AdditionalProperties);
ClrCrossComponentsSubset=true;
HostArchitecture=x86;
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>
<PropertyGroup>
<CrossDacHostArch>x64</CrossDacHostArch>
<CrossDacHostArch Condition="'$(TargetArchitecture)' == 'arm'">x86</CrossDacHostArch>
</PropertyGroup>
<ItemGroup Condition="$(_subset.Contains('+linuxdac+')) and $([MSBuild]::IsOsPlatform(Windows)) and '$(TargetArchitecture)' != 'x86'">
<ProjectToBuild Include="$(CoreClrProjectRoot)runtime.proj" AdditionalProperties="%(AdditionalProperties);$(ClrDefaultRuntimeBuildSubsets);CrossDac=linux" Category="clr" />
<ProjectToBuild
Include="$(CoreClrProjectRoot)runtime.proj"
AdditionalProperties="%(AdditionalProperties);
ClrCrossComponentsSubset=true;
HostArchitecture=$(CrossDacHostArch);
PgoInstrument=false;
NoPgoOptimize=true;
TargetOS=Linux;
CMakeArgs=$(CMakeArgs) -DCLR_CROSS_COMPONENTS_BUILD=1" Category="clr" />
</ItemGroup>
<ItemGroup Condition="$(_subset.Contains('+alpinedac+')) and $([MSBuild]::IsOsPlatform(Windows)) and '$(TargetArchitecture)' != 'x86'">
<ProjectToBuild Include="$(CoreClrProjectRoot)runtime.proj" AdditionalProperties="%(AdditionalProperties);$(ClrDefaultRuntimeBuildSubsets);CrossDac=alpine" Category="clr" />
<ProjectToBuild
Include="$(CoreClrProjectRoot)runtime.proj"
AdditionalProperties="%(AdditionalProperties);
ClrCrossComponentsSubset=true;
HostArchitecture=$(CrossDacHostArch);
PgoInstrument=false;
NoPgoOptimize=true;
TargetOS=alpine;
CMakeArgs=$(CMakeArgs) -DCLR_CROSS_COMPONENTS_BUILD=1" Category="clr" />
</ItemGroup>
<ItemGroup Condition="$(_subset.Contains('+crossdacpack+'))">
......
......@@ -11,7 +11,7 @@ initTargetDistroRid()
passedRootfsDir="$ROOTFS_DIR"
fi
initDistroRidGlobal "$__TargetOS" "$__BuildArch" "$__PortableBuild" "$passedRootfsDir"
initDistroRidGlobal "$__TargetOS" "$__TargetArch" "$__PortableBuild" "$passedRootfsDir"
}
setup_dirs()
......@@ -53,7 +53,7 @@ build_native()
fi
targetOS="$1"
platformArch="$2"
hostArch="$2"
cmakeDir="$3"
intermediatesDir="$4"
target="$5"
......@@ -61,15 +61,15 @@ build_native()
message="$7"
# All set to commence the build
echo "Commencing build of \"$target\" target in \"$message\" for $__TargetOS.$__BuildArch.$__BuildType in $intermediatesDir"
echo "Commencing build of \"$target\" target in \"$message\" for $__TargetOS.$__TargetArch.$__BuildType in $intermediatesDir"
if [[ "$targetOS" == OSX || "$targetOS" == MacCatalyst ]]; then
if [[ "$platformArch" == x64 ]]; then
if [[ "$hostArch" == x64 ]]; then
cmakeArgs="-DCMAKE_OSX_ARCHITECTURES=\"x86_64\" $cmakeArgs"
elif [[ "$platformArch" == arm64 ]]; then
elif [[ "$hostArch" == arm64 ]]; then
cmakeArgs="-DCMAKE_OSX_ARCHITECTURES=\"arm64\" $cmakeArgs"
else
echo "Error: Unknown OSX architecture $platformArch."
echo "Error: Unknown OSX architecture $hostArch."
exit 1
fi
fi
......@@ -90,16 +90,16 @@ build_native()
# Don't try to set CC/CXX in init-compiler.sh - it's handled in android.toolchain.cmake already
__Compiler="default"
if [[ "$platformArch" == x64 ]]; then
if [[ "$hostArch" == x64 ]]; then
cmakeArgs="-DANDROID_ABI=x86_64 $cmakeArgs"
elif [[ "$platformArch" == x86 ]]; then
elif [[ "$hostArch" == x86 ]]; then
cmakeArgs="-DANDROID_ABI=x86 $cmakeArgs"
elif [[ "$platformArch" == arm64 ]]; then
elif [[ "$hostArch" == arm64 ]]; then
cmakeArgs="-DANDROID_ABI=arm64-v8a $cmakeArgs"
elif [[ "$platformArch" == arm ]]; then
elif [[ "$hostArch" == arm ]]; then
cmakeArgs="-DANDROID_ABI=armeabi-v7a $cmakeArgs"
else
echo "Error: Unknown Android architecture $platformArch."
echo "Error: Unknown Android architecture $hostArch."
exit 1
fi
fi
......@@ -117,7 +117,7 @@ build_native()
scan_build=scan-build
fi
nextCommand="\"$__RepoRootDir/eng/native/gen-buildsys.sh\" \"$cmakeDir\" \"$intermediatesDir\" $platformArch $__Compiler $__BuildType \"$generator\" $scan_build $cmakeArgs"
nextCommand="\"$__RepoRootDir/eng/native/gen-buildsys.sh\" \"$cmakeDir\" \"$intermediatesDir\" $hostArch $__Compiler $__BuildType \"$generator\" $scan_build $cmakeArgs"
echo "Invoking $nextCommand"
eval $nextCommand
......@@ -228,8 +228,7 @@ usage()
source "$__RepoRootDir/eng/native/init-os-and-arch.sh"
__BuildArch=$arch
__HostArch=$arch
__TargetArch=$arch
__TargetOS=$os
__HostOS=$os
__BuildOS=$os
......@@ -267,19 +266,19 @@ while :; do
;;
arm|-arm)
__BuildArch=arm
__TargetArch=arm
;;
armv6|-armv6)
__BuildArch=armv6
__TargetArch=armv6
;;
arm64|-arm64)
__BuildArch=arm64
__TargetArch=arm64
;;
armel|-armel)
__BuildArch=armel
__TargetArch=armel
;;
bindir|-bindir)
......@@ -374,23 +373,23 @@ while :; do
;;
x86|-x86)
__BuildArch=x86
__TargetArch=x86
;;
x64|-x64)
__BuildArch=x64
__TargetArch=x64
;;
loongarch64|-loongarch64)
__BuildArch=loongarch64
__TargetArch=loongarch64
;;
s390x|-s390x)
__BuildArch=s390x
__TargetArch=s390x
;;
wasm|-wasm)
__BuildArch=wasm
__TargetArch=wasm
;;
os|-os)
......@@ -403,6 +402,16 @@ while :; do
fi
;;
hostarch|-hostarch)
if [[ -n "$2" ]]; then
__HostArch="$2"
shift
else
echo "ERROR: 'hostarch' requires a non-empty option argument"
exit 1
fi
;;
*)
handle_arguments "$1" "$2"
if [[ "$__ShiftArgs" == 1 ]]; then
......@@ -415,7 +424,11 @@ while :; do
shift
done
__CommonMSBuildArgs="/p:TargetArchitecture=$__BuildArch /p:Configuration=$__BuildType /p:TargetOS=$__TargetOS /nodeReuse:false $__OfficialBuildIdArg $__SignTypeArg $__SkipRestoreArg"
if [[ -z "$__HostArch" ]]; then
__HostArch=$__TargetArch
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
if [[ "$__VerboseBuild" == 1 ]]; then
......@@ -428,7 +441,7 @@ if [[ "$__PortableBuild" == 0 ]]; then
__CommonMSBuildArgs="$__CommonMSBuildArgs /p:PortableBuild=false"
fi
if [[ "$__BuildArch" == wasm ]]; then
if [[ "$__TargetArch" == wasm ]]; then
# nothing to do here
true
elif [[ "$__TargetOS" == iOS || "$__TargetOS" == iOSSimulator ]]; then
......@@ -450,7 +463,7 @@ if [[ "$__CrossBuild" == 1 ]]; then
export CROSSCOMPILE
# Darwin that doesn't use rootfs
if [[ -z "$ROOTFS_DIR" && "$platform" != "Darwin" ]]; then
ROOTFS_DIR="$__RepoRootDir/.tools/rootfs/$__BuildArch"
ROOTFS_DIR="$__RepoRootDir/.tools/rootfs/$__TargetArch"
export ROOTFS_DIR
fi
fi
......
......@@ -10,7 +10,7 @@ if [[ "$#" -lt 4 ]]; then
echo "gen-buildsys.sh <path to top level CMakeLists.txt> <path to intermediate directory> <Architecture> <compiler> [build flavor] [ninja] [scan-build] [cmakeargs]"
echo "Specify the path to the top level CMake file."
echo "Specify the path that the build system files are generated in."
echo "Specify the target architecture."
echo "Specify the host architecture (the architecture the built tools should run on)."
echo "Specify the name of compiler (clang or gcc)."
echo "Optionally specify the build configuration (flavor.) Defaults to DEBUG."
echo "Optionally specify 'scan-build' to enable build with clang static analyzer."
......@@ -19,12 +19,12 @@ if [[ "$#" -lt 4 ]]; then
exit 1
fi
build_arch="$3"
host_arch="$3"
compiler="$4"
if [[ "$compiler" != "default" ]]; then
nativescriptroot="$( cd -P "$scriptroot/../common/native" && pwd )"
source "$nativescriptroot/init-compiler.sh" "$nativescriptroot" "$build_arch" "$compiler"
source "$nativescriptroot/init-compiler.sh" "$nativescriptroot" "$host_arch" "$compiler"
CCC_CC="$CC"
CCC_CXX="$CXX"
......@@ -67,7 +67,7 @@ if [[ "$CROSSCOMPILE" == "1" ]]; then
exit 1
fi
TARGET_BUILD_ARCH="$build_arch"
TARGET_BUILD_ARCH="$host_arch"
export TARGET_BUILD_ARCH
cmake_extra_defines="$cmake_extra_defines -C $scriptroot/tryrun.cmake"
......@@ -79,7 +79,7 @@ if [[ "$CROSSCOMPILE" == "1" ]]; then
fi
fi
if [[ "$build_arch" == "armel" ]]; then
if [[ "$host_arch" == "armel" ]]; then
cmake_extra_defines="$cmake_extra_defines -DARM_SOFTFP=1"
fi
......@@ -92,7 +92,7 @@ if [[ "$scan_build" == "ON" && -n "$SCAN_BUILD_COMMAND" ]]; then
cmake_command="$SCAN_BUILD_COMMAND $cmake_command"
fi
if [[ "$build_arch" == "wasm" ]]; then
if [[ "$host_arch" == "wasm" ]]; then
cmake_command="emcmake $cmake_command"
fi
......
......@@ -3,17 +3,21 @@
<NativeOptimizationDataSupported Condition="'$(TargetOS)' == 'windows' And ('$(TargetArchitecture)' == 'x64' Or '$(TargetArchitecture)' == 'x86')">true</NativeOptimizationDataSupported>
<NativeOptimizationDataSupported Condition="'$(TargetOS)' == 'Linux' And '$(TargetArchitecture)' == 'x64'">true</NativeOptimizationDataSupported>
<NativeOptimizationDataSupported Condition="'$(NoPgoOptimize)' == 'true'">false</NativeOptimizationDataSupported>
<NativeOptimizationDataSupported Condition="'$(DotNetBuildFromSource)' == 'true'">false</NativeOptimizationDataSupported>
<NativeOptimizationDataSupported Condition="'$(Configuration)' != 'Release'">false</NativeOptimizationDataSupported>
<_NativeOptimizationDataPackageTarget>$(TargetOS.ToLower())-$(TargetArchitecture.ToLower())</_NativeOptimizationDataPackageTarget>
<_NativeOptimizationDataPackageTarget Condition="'$(TargetOS)' == 'windows'">windows_nt-$(TargetArchitecture.ToLower())</_NativeOptimizationDataPackageTarget>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="optimization.$(_NativeOptimizationDataPackageTarget).PGO.CoreCLR"
<ItemGroup Condition="'$(optimizationPGOCoreCLRVersion)'!='' and '$(DotNetBuildFromSource)' != 'true'">
<PackageReference Include="optimization.windows_nt-x64.PGO.CoreCLR"
Version="$(optimizationPGOCoreCLRVersion)"
GeneratePathProperty="true" />
<PackageReference Include="optimization.windows_nt-x86.PGO.CoreCLR"
Version="$(optimizationPGOCoreCLRVersion)"
GeneratePathProperty="true" />
<PackageReference Include="optimization.linux-x64.PGO.CoreCLR"
Version="$(optimizationPGOCoreCLRVersion)"
Condition="'$(optimizationPGOCoreCLRVersion)'!='' And '$(NativeOptimizationDataSupported)'=='true'"
GeneratePathProperty="true" />
</ItemGroup>
......
......@@ -106,7 +106,7 @@ jobs:
- script: $(Build.SourcesDirectory)/src/coreclr/build-runtime$(scriptExt) $(buildConfig) $(archType) $(crossArg) -ci $(compilerArg) -component alljits -component spmi
displayName: Build CoreCLR JIT
- ${{ if eq(parameters.osGroup, 'windows') }}:
- script: set __TestIntermediateDir=int&&$(Build.SourcesDirectory)/src/coreclr/build-runtime$(scriptExt) $(buildConfig) $(archType) -ci -component alljits -component spmi
- script: $(Build.SourcesDirectory)/src/coreclr/build-runtime$(scriptExt) $(buildConfig) $(archType) -ci -component alljits -component spmi
displayName: Build CoreCLR JIT
- ${{ if eq(parameters.uploadAs, 'azureBlob') }}:
......
......@@ -197,9 +197,17 @@ jobs:
- script: $(Build.SourcesDirectory)/src/coreclr/build-runtime$(scriptExt) $(buildConfig) $(archType) $(crossArg) $(osArg) -ci $(compilerArg) $(clrRuntimeComponentsBuildArg) $(pgoInstrumentArg) $(officialBuildIdArg) $(clrInterpreterBuildArg) $(clrRuntimePortableBuildArg) $(CoreClrPgoDataArg)
displayName: Build CoreCLR Runtime
- ${{ if eq(parameters.osGroup, 'windows') }}:
- script: set __TestIntermediateDir=int&&$(Build.SourcesDirectory)/src/coreclr/build-runtime$(scriptExt) $(buildConfig) $(archType) -ci $(enforcePgoArg) $(pgoInstrumentArg) $(officialBuildIdArg) $(clrInterpreterBuildArg) $(CoreClrPgoDataArg)
- script: $(Build.SourcesDirectory)/src/coreclr/build-runtime$(scriptExt) $(buildConfig) $(archType) -ci $(enforcePgoArg) $(pgoInstrumentArg) $(officialBuildIdArg) $(clrInterpreterBuildArg) $(CoreClrPgoDataArg)
displayName: Build CoreCLR Runtime
- ${{ if ne(parameters.archType, 'x64') }}:
- script: $(Build.SourcesDirectory)/src/coreclr/build-runtime$(scriptExt) $(buildConfig) $(archType) -hostarch x64 $(osArg) -ci $(compilerArg) -component crosscomponents -cmakeargs "-DCLR_CROSS_COMPONENTS_BUILD=1" $(officialBuildIdArg) $(clrRuntimePortableBuildArg)
displayName: Build CoreCLR Cross-Arch Tools (Tools that run on x64 targetting x86)
- ${{ if and(eq(parameters.osGroup, 'windows'), eq(parameters.archType, 'arm')) }}:
- script: $(Build.SourcesDirectory)/src/coreclr/build-runtime$(scriptExt) $(buildConfig) $(archType) -hostarch x86 $(osArg) -ci $(compilerArg) -component crosscomponents -cmakeargs "-DCLR_CROSS_COMPONENTS_BUILD=1" $(officialBuildIdArg) $(clrRuntimePortableBuildArg)
displayName: Build CoreCLR Cross-Arch Tools (Tools that run on x86 targetting arm)
- ${{ if in(parameters.osGroup, 'OSX', 'iOS', 'tvOS') }}:
- script: |
du -sh $(Build.SourcesDirectory)/*
......@@ -285,11 +293,20 @@ jobs:
displayName: 'product build'
- ${{ if and(in(parameters.osGroup, 'windows', 'Linux'), ne(parameters.archType, 'x86'), ne(parameters.compilerName, 'gcc'), ne(parameters.testGroup, 'clrTools'), eq(parameters.pgoType, '')) }}:
- template: /eng/pipelines/coreclr/templates/crossdac-build.yml
parameters:
archType: ${{ parameters.archType }}
osGroup: ${{ parameters.osGroup }}
osSubgroup: ${{ parameters.osSubgroup }}
- ${{ if ne(parameters.archType, 'arm') }}:
- template: /eng/pipelines/coreclr/templates/crossdac-build.yml
parameters:
archType: ${{ parameters.archType }}
osGroup: ${{ parameters.osGroup }}
osSubgroup: ${{ parameters.osSubgroup }}
hostArchType: x64
- ${{ if eq(parameters.archType, 'arm') }}:
- template: /eng/pipelines/coreclr/templates/crossdac-build.yml
parameters:
archType: ${{ parameters.archType }}
osGroup: ${{ parameters.osGroup }}
osSubgroup: ${{ parameters.osSubgroup }}
hostArchType: x86
- ${{ if and(ne(parameters.compilerName, 'gcc'), ne(parameters.testGroup, ''), ne(parameters.testGroup, 'clrTools'), ne(parameters.disableClrTest, true)) }}:
# Publish test native components for consumption by test execution.
......
......@@ -2,14 +2,15 @@ parameters:
archType: ''
osGroup: ''
osSubgroup: ''
hostArchType: ''
steps:
# Always build the crossdac, that way we know in CI/PR if things break to build.
- ${{ if and(eq(parameters.osGroup, 'windows'), notin(parameters.archType, 'x86')) }}:
- script: set __TestIntermediateDir=int&&$(Build.SourcesDirectory)/src/coreclr/build-runtime$(scriptExt) $(buildConfig) $(archType) -ci -linuxdac -ninja $(officialBuildIdArg)
- script: $(Build.SourcesDirectory)/src/coreclr/build-runtime$(scriptExt) $(buildConfig) $(archType) -hostarch ${{ parameters.hostArchType }} -ci -os Linux -cmakeargs "-DCLR_CROSS_COMPONENTS_BUILD=1" -ninja $(officialBuildIdArg) -component crosscomponents
displayName: Build Cross OS Linux DAC for Windows
- script: set __TestIntermediateDir=int&&$(Build.SourcesDirectory)/src/coreclr/build-runtime$(scriptExt) $(buildConfig) $(archType) -ci -alpinedac -ninja $(officialBuildIdArg)
- script: $(Build.SourcesDirectory)/src/coreclr/build-runtime$(scriptExt) $(buildConfig) $(archType) -hostarch ${{ parameters.hostArchType }} -ci -os alpine -cmakeargs "-DCLR_CROSS_COMPONENTS_BUILD=1" -ninja $(officialBuildIdArg) -component crosscomponents
displayName: Build Cross OS Linux-musl DAC for Windows
- task: CopyFiles@2
......
#!/usr/bin/env bash
usage_list+=("-coverage: optional argument to enable code coverage build (currently supported only for Linux and OSX).")
usage_list+=("-skipmanaged: do not build managed components.")
usage_list+=("-skipnative: do not build native components.")
handle_arguments() {
......@@ -11,17 +9,6 @@ handle_arguments() {
__CodeCoverage=1
;;
skipmanaged|-skipmanaged)
__SkipManaged=1
__BuildTestWrappers=0
;;
skipnative|-skipnative)
__SkipNative=1
__SkipCoreCLR=1
__CopyNativeProjectsAfterCombinedTestBuild=false
;;
*)
handle_arguments_local "$1" "$2"
;;
......
此差异已折叠。
......@@ -30,42 +30,6 @@ setup_dirs_local()
mkdir -p "$__LogsDir"
mkdir -p "$__MsbuildDebugLogsDir"
if [[ "$__CrossBuild" == 1 ]]; then
mkdir -p "$__CrossComponentBinDir"
fi
}
build_cross_architecture_components()
{
local intermediatesForBuild="$__IntermediatesDir/Host$__CrossArch/crossgen"
local crossArchBinDir="$__BinDir/$__CrossArch"
mkdir -p "$intermediatesForBuild"
mkdir -p "$crossArchBinDir"
__SkipCrossArchBuild=1
# check supported cross-architecture components host(__HostArch)/target(__BuildArch) pair
if [[ ("$__BuildArch" == "arm" || "$__BuildArch" == "armel") && ("$__CrossArch" == "x86" || "$__CrossArch" == "x64") ]]; then
__SkipCrossArchBuild=0
elif [[ "$__BuildArch" == "arm64" && "$__CrossArch" == "x64" ]]; then
__SkipCrossArchBuild=0
elif [[ "$__BuildArch" == "loongarch64" && "$__CrossArch" == "x64" ]]; then
__SkipCrossArchBuild=0
else
# not supported
return
fi
__CMakeBinDir="$crossArchBinDir"
CROSSCOMPILE=0
export __CMakeBinDir CROSSCOMPILE
__CMakeArgs="-DCLR_CMAKE_TARGET_ARCH=$__BuildArch -DCLR_CROSS_COMPONENTS_BUILD=1 $__CMakeArgs"
build_native "$__TargetOS" "$__CrossArch" "$__ProjectRoot" "$intermediatesForBuild" "crosscomponents" "$__CMakeArgs" "cross-architecture components"
CROSSCOMPILE=1
export CROSSCOMPILE
}
handle_arguments_local() {
......@@ -81,10 +45,6 @@ handle_arguments_local() {
__PgoInstrument=1
;;
skipcrossarchnative|-skipcrossarchnative)
__SkipCrossArchNative=1
;;
staticanalyzer|-staticanalyzer)
__StaticAnalyzer=1
;;
......@@ -112,7 +72,7 @@ echo "Commencing CoreCLR Repo build"
__ProjectRoot="$(cd "$(dirname "$0")"; pwd -P)"
__RepoRootDir="$(cd "$__ProjectRoot"/../..; pwd -P)"
__BuildArch=
__TargetArch=
__BuildType=Debug
__CodeCoverage=0
......@@ -130,9 +90,6 @@ __ProjectDir="$__ProjectRoot"
__RootBinDir="$__RepoRootDir/artifacts"
__SignTypeArg=""
__SkipConfigure=0
__SkipNative=0
__SkipCrossArchNative=0
__SkipManaged=0
__SkipRestore=""
__SourceDir="$__ProjectDir/src"
__StaticAnalyzer=0
......@@ -149,18 +106,17 @@ source "$__ProjectRoot"/_build-commons.sh
# Set the remaining variables based upon the determined build configuration
__LogsDir="$__RootBinDir/log/$__BuildType"
__MsbuildDebugLogsDir="$__LogsDir/MsbuildDebugLogs"
__ConfigTriplet="$__TargetOS.$__BuildArch.$__BuildType"
__ConfigTriplet="$__TargetOS.$__TargetArch.$__BuildType"
__BinDir="$__RootBinDir/bin/coreclr/$__ConfigTriplet"
__ArtifactsObjDir="$__RepoRootDir/artifacts/obj"
__ArtifactsIntermediatesDir="$__ArtifactsObjDir/coreclr"
__IntermediatesDir="$__ArtifactsIntermediatesDir/$__ConfigTriplet"
export __IntermediatesDir __ArtifactsIntermediatesDir
__CrossComponentBinDir="$__BinDir"
__CrossArch="$__HostArch"
if [[ "$__CrossBuild" == 1 ]]; then
__CrossComponentBinDir="$__CrossComponentBinDir/$__CrossArch"
if [[ "$__TargetArch" != "$__HostArch" ]]; then
__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.
......@@ -205,20 +161,13 @@ if [[ -z "$__CMakeTarget" ]]; then
__CMakeTarget="install"
fi
if [[ "$__SkipNative" == 1 ]]; then
echo "Skipping CoreCLR component build."
else
eval "$__RepoRootDir/eng/native/version/copy_version_files.sh"
if [[ "$__TargetArch" != "$__HostArch" ]]; then
__CMakeArgs="-DCLR_CMAKE_TARGET_ARCH=$__TargetArch $__CMakeArgs"
fi
build_native "$__TargetOS" "$__BuildArch" "$__ProjectRoot" "$__IntermediatesDir" "$__CMakeTarget" "$__CMakeArgs" "CoreCLR component"
eval "$__RepoRootDir/eng/native/version/copy_version_files.sh"
# Build cross-architecture components
if [[ "$__SkipCrossArchNative" != 1 ]]; then
if [[ "$__CrossBuild" == 1 ]]; then
build_cross_architecture_components
fi
fi
fi
build_native "$__TargetOS" "$__HostArch" "$__ProjectRoot" "$__IntermediatesDir" "$__CMakeTarget" "$__CMakeArgs" "CoreCLR component"
# Build complete
......
# Add targets to the crosscomponents subcomponent build
if (CLR_CMAKE_HOST_OS STREQUAL CLR_CMAKE_TARGET_OS)
install_clr (TARGETS
jitinterface_${ARCH_HOST_NAME}
......
<Project Sdk="Microsoft.Build.NoTargets">
<PropertyGroup>
<NativeBuildPartitionPropertiesToRemove>ClrFullNativeBuild;ClrRuntimeSubset;ClrJitSubset;ClrPalTestsSubset;ClrAllJitsSubset;ClrILToolsSubset</NativeBuildPartitionPropertiesToRemove>
<NativeBuildPartitionPropertiesToRemove>ClrFullNativeBuild;ClrRuntimeSubset;ClrJitSubset;ClrPalTestsSubset;ClrAllJitsSubset;ClrILToolsSubset;ClrNativeAotSubset;ClrSpmiSubset;ClrCrossComponentsSubset;HostArchitecture;PgoInstrument;NativeOptimizationDataSupported;CMakeArgs</NativeBuildPartitionPropertiesToRemove>
</PropertyGroup>
<ItemGroup>
......@@ -15,8 +15,7 @@
BeforeTargets="Build">
<ItemGroup>
<_CoreClrBuildArg Condition="'$(TargetArchitecture)' != ''" Include="-$(TargetArchitecture)" />
<_CoreClrBuildArg Condition="!$([MSBuild]::IsOsPlatform(Windows)) and '$(CMakeArgs)' != ''" Include="$(CMakeArgs)" />
<_CoreClrBuildArg Condition="$([MSBuild]::IsOsPlatform(Windows)) and '$(CMakeArgs)' != ''" Include="-cmakeargs &quot;$(CMakeArgs)&quot;" />
<_CoreClrBuildArg Condition="'$(CMakeArgs)' != ''" Include="-cmakeargs &quot;$(CMakeArgs)&quot;" />
<_CoreClrBuildArg Include="-$(Configuration.ToLower())" />
<_CoreClrBuildArg Include="$(Compiler)" />
<_CoreClrBuildArg Condition="'$(ConfigureOnly)' == 'true'" Include="-configureonly" />
......@@ -24,7 +23,7 @@
<_CoreClrBuildArg Condition="'$(CrossBuild)' == 'true'" Include="-cross" />
<_CoreClrBuildArg Condition="'$(PortableBuild)' != 'true'" Include="-portablebuild=false" />
<_CoreClrBuildArg Condition="'$(KeepNativeSymbols)' != 'false'" Include="-keepnativesymbols" />
<_CoreClrBuildArg Condition="!$([MSBuild]::IsOsPlatform(Windows))" Include="-os $(TargetOS)" />
<_CoreClrBuildArg Include="-os $(TargetOS)" />
<_CoreClrBuildArg Condition="$([MSBuild]::IsOsPlatform(Windows)) and
('$(TargetArchitecture)' == 'x86' or '$(TargetArchitecture)' == 'x64') and
......@@ -33,11 +32,11 @@
'$(NativeOptimizationDataSupported)' == 'true' and
'$(PgoInstrument)' != 'true'"
Include="-enforcepgo" />
<_CoreClrBuildArg Condition="$([MSBuild]::IsOsPlatform(Windows)) and '$(CrossDac)' != ''" Include="-$(CrossDac)dac" />
<_CoreClrBuildArg Condition="'$(Ninja)' == 'true' and !$([MSBuild]::IsOsPlatform(Windows))" Include="-ninja" />
<_CoreClrBuildArg Condition="'$(Ninja)' == 'false' and $([MSBuild]::IsOsPlatform(Windows))" Include="-msbuild" />
<_CoreClrBuildArg Condition="'$(PgoInstrument)' == 'true'" Include="-pgoinstrument" />
<_CoreClrBuildArg Condition="'$(NativeOptimizationDataSupported)' == 'true' and '$(PgoInstrument)' != 'true'" Include="-pgodatapath &quot;$(PgoPackagePath)&quot;" />
<_CoreClrBuildArg Condition="'$(NativeOptimizationDataSupported)' == 'true' and '$(NoPgoOptimize)' != 'true' and '$(PgoInstrument)' != 'true'" Include="-pgodatapath &quot;$(PgoPackagePath)&quot;" />
<_CoreClrBuildArg Condition="'$(HostArchitecture)' != ''" Include="-hostarch $(HostArchitecture)" />
</ItemGroup>
<ItemGroup Condition="'$(ClrFullNativeBuild)' != 'true'">
......@@ -49,6 +48,7 @@
<_CoreClrBuildArg Condition="'$(ClrILToolsSubset)' == 'true'" Include="-component iltools" />
<_CoreClrBuildArg Condition="'$(ClrNativeAotSubset)' == 'true'" Include="-component nativeaot" />
<_CoreClrBuildArg Condition="'$(ClrSpmiSubset)' == 'true'" Include="-component spmi" />
<_CoreClrBuildArg Condition="'$(ClrCrossComponentsSubset)' == 'true'" Include="-component crosscomponents" />
</ItemGroup>
<PropertyGroup>
......
......@@ -11,7 +11,7 @@ set -e
__scriptpath="$(cd "$(dirname "$0")"; pwd -P)"
__RepoRootDir="$(cd "$__scriptpath"/../../..; pwd -P)"
__BuildArch=x64
__TargetArch=x64
__TargetOS=Linux
__BuildType=Debug
__CMakeArgs=""
......@@ -97,4 +97,4 @@ setup_dirs
check_prereqs
# Build the installer native components.
build_native "$__TargetOS" "$__BuildArch" "$__scriptpath" "$__IntermediatesDir" "install" "$__CMakeArgs" "installer component"
build_native "$__TargetOS" "$__TargetArch" "$__scriptpath" "$__IntermediatesDir" "install" "$__CMakeArgs" "installer component"
......@@ -26,7 +26,7 @@ handle_arguments() {
}
# Set the various build properties here so that CMake and MSBuild can pick them up
__BuildArch=x64
__TargetArch=x64
__TargetOS=Linux
__BuildType=Debug
__CMakeArgs=""
......@@ -43,7 +43,7 @@ source "$__RepoRootDir"/eng/native/build-commons.sh
# Set cross build
if [[ "$__BuildArch" == wasm ]]; then
if [[ "$__TargetArch" == wasm ]]; then
if [[ -z "$EMSDK_PATH" ]]; then
echo "Error: You need to set the EMSDK_PATH environment variable pointing to the emscripten SDK root."
exit 1
......@@ -64,9 +64,9 @@ else
__CMakeArgs="-DFEATURE_DISTRO_AGNOSTIC_SSL=$__PortableBuild $__CMakeArgs"
__CMakeArgs="-DCMAKE_STATIC_LIB_LINK=$__StaticLibLink $__CMakeArgs"
if [[ "$__BuildArch" != x86 && "$__BuildArch" != x64 && "$__BuildArch" != "$__HostArch" ]]; then
if [[ "$__TargetArch" != x86 && "$__TargetArch" != x64 && "$__TargetArch" != "$__HostArch" ]]; then
__CrossBuild=1
echo "Set CrossBuild for $__BuildArch build"
echo "Set CrossBuild for $__TargetArch build"
fi
fi
......@@ -77,54 +77,54 @@ elif [[ "$__TargetOS" == iOSSimulator ]]; then
# set default iOS simulator deployment target
# keep in sync with src/mono/Directory.Build.props
__CMakeArgs="-DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphonesimulator -DCMAKE_OSX_DEPLOYMENT_TARGET=10.0 $__CMakeArgs"
if [[ "$__BuildArch" == x64 ]]; then
if [[ "$__TargetArch" == x64 ]]; then
__CMakeArgs="-DCMAKE_OSX_ARCHITECTURES=\"x86_64\" $__CMakeArgs"
elif [[ "$__BuildArch" == x86 ]]; then
elif [[ "$__TargetArch" == x86 ]]; then
__CMakeArgs="-DCMAKE_OSX_ARCHITECTURES=\"i386\" $__CMakeArgs"
elif [[ "$__BuildArch" == arm64 ]]; then
elif [[ "$__TargetArch" == arm64 ]]; then
__CMakeArgs="-DCMAKE_OSX_ARCHITECTURES=\"arm64\" $__CMakeArgs"
else
echo "Error: Unknown iOSSimulator architecture $__BuildArch."
echo "Error: Unknown iOSSimulator architecture $__TargetArch."
exit 1
fi
elif [[ "$__TargetOS" == iOS ]]; then
# set default iOS device deployment target
# keep in sync with src/mono/Directory.Build.props
__CMakeArgs="-DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphoneos -DCMAKE_OSX_DEPLOYMENT_TARGET=10.0 $__CMakeArgs"
if [[ "$__BuildArch" == arm64 ]]; then
if [[ "$__TargetArch" == arm64 ]]; then
__CMakeArgs="-DCMAKE_OSX_ARCHITECTURES=\"arm64\" $__CMakeArgs"
elif [[ "$__BuildArch" == arm ]]; then
elif [[ "$__TargetArch" == arm ]]; then
__CMakeArgs="-DCMAKE_OSX_ARCHITECTURES=\"armv7;armv7s\" $__CMakeArgs"
else
echo "Error: Unknown iOS architecture $__BuildArch."
echo "Error: Unknown iOS architecture $__TargetArch."
exit 1
fi
elif [[ "$__TargetOS" == tvOSSimulator ]]; then
# set default tvOS simulator deployment target
# keep in sync with src/mono/Directory.Build.props
__CMakeArgs="-DCMAKE_SYSTEM_NAME=tvOS -DCMAKE_OSX_SYSROOT=appletvsimulator -DCMAKE_OSX_DEPLOYMENT_TARGET=10.0 $__CMakeArgs"
if [[ "$__BuildArch" == x64 ]]; then
if [[ "$__TargetArch" == x64 ]]; then
__CMakeArgs="-DCMAKE_OSX_ARCHITECTURES=\"x86_64\" $__CMakeArgs"
elif [[ "$__BuildArch" == arm64 ]]; then
elif [[ "$__TargetArch" == arm64 ]]; then
__CMakeArgs="-DCMAKE_OSX_ARCHITECTURES=\"arm64\" $__CMakeArgs"
else
echo "Error: Unknown tvOSSimulator architecture $__BuildArch."
echo "Error: Unknown tvOSSimulator architecture $__TargetArch."
exit 1
fi
elif [[ "$__TargetOS" == tvOS ]]; then
# set default tvOS device deployment target
# keep in sync with src/mono/Directory.Build.props
__CMakeArgs="-DCMAKE_SYSTEM_NAME=tvOS -DCMAKE_OSX_SYSROOT=appletvos -DCMAKE_OSX_DEPLOYMENT_TARGET=10.0 $__CMakeArgs"
if [[ "$__BuildArch" == arm64 ]]; then
if [[ "$__TargetArch" == arm64 ]]; then
__CMakeArgs="-DCMAKE_OSX_ARCHITECTURES=\"arm64\" $__CMakeArgs"
else
echo "Error: Unknown tvOS architecture $__BuildArch."
echo "Error: Unknown tvOS architecture $__TargetArch."
exit 1
fi
fi
# Set the remaining variables based upon the determined build configuration
__outConfig="${__outConfig:-"$__TargetOS-$__BuildArch-$__BuildType"}"
__outConfig="${__outConfig:-"$__TargetOS-$__TargetArch-$__BuildType"}"
__IntermediatesDir="$__RootBinDir/obj/native/$__outConfig"
__BinDir="$__RootBinDir/bin/native/$__outConfig"
......@@ -140,4 +140,4 @@ setup_dirs
check_prereqs
# Build the corefx native components.
build_native "$__TargetOS" "$__BuildArch" "$__nativeroot" "$__IntermediatesDir" "install" "$__CMakeArgs" "native libraries component"
build_native "$__TargetOS" "$__TargetArch" "$__nativeroot" "$__IntermediatesDir" "install" "$__CMakeArgs" "native libraries component"
......@@ -36,7 +36,7 @@ build_Tests()
fi
echo "__TargetOS: ${__TargetOS}"
echo "__BuildArch: ${__BuildArch}"
echo "__TargetArch: ${__TargetArch}"
echo "__BuildType: ${__BuildType}"
echo "__TestIntermediatesDir: ${__TestIntermediatesDir}"
echo "__NativeTestIntermediatesDir: ${__NativeTestIntermediatesDir}"
......@@ -61,7 +61,7 @@ build_Tests()
if [[ "$__SkipNative" != 1 && "$__BuildTestWrappersOnly" != 1 && "$__GenerateLayoutOnly" != 1 && "$__CopyNativeTestBinaries" != 1 && \
"$__TargetOS" != "Browser" && "$__TargetOS" != "Android" && "$__TargetOS" != "iOS" && "$__TargetOS" != "iOSSimulator" ]]; then
build_native "$__TargetOS" "$__BuildArch" "$__TestDir" "$__NativeTestIntermediatesDir" "install" "CoreCLR test component"
build_native "$__TargetOS" "$__TargetArch" "$__TestDir" "$__NativeTestIntermediatesDir" "install" "CoreCLR test component"
if [[ "$?" -ne 0 ]]; then
echo "${__ErrMsgPrefix}${__MsgPrefix}Error: native test build failed. Refer to the build log files for details (above)"
......@@ -70,10 +70,10 @@ build_Tests()
fi
# Set up directories and file names
__BuildLog="$__LogsDir/${__BuildLogRootName}.${__TargetOS}.${__BuildArch}.${__BuildType}.log"
__BuildWrn="$__LogsDir/${__BuildLogRootName}.${__TargetOS}.${__BuildArch}.${__BuildType}.wrn"
__BuildErr="$__LogsDir/${__BuildLogRootName}.${__TargetOS}.${__BuildArch}.${__BuildType}.err"
__BuildBinLog="$__LogsDir/${__BuildLogRootName}.${__TargetOS}.${__BuildArch}.${__BuildType}.binlog"
__BuildLog="$__LogsDir/${__BuildLogRootName}.${__TargetOS}.${__TargetArch}.${__BuildType}.log"
__BuildWrn="$__LogsDir/${__BuildLogRootName}.${__TargetOS}.${__TargetArch}.${__BuildType}.wrn"
__BuildErr="$__LogsDir/${__BuildLogRootName}.${__TargetOS}.${__TargetArch}.${__BuildType}.err"
__BuildBinLog="$__LogsDir/${__BuildLogRootName}.${__TargetOS}.${__TargetArch}.${__BuildType}.binlog"
__msbuildLog="\"/flp:Verbosity=normal;LogFile=${__BuildLog}\""
__msbuildWrn="\"/flp1:WarningsOnly;LogFile=${__BuildWrn}\""
__msbuildErr="\"/flp2:ErrorsOnly;LogFile=${__BuildErr}\""
......@@ -138,6 +138,8 @@ build_Tests()
usage_list=()
usage_list+=("-skipmanaged: do not build managed components.")
usage_list+=("-skipnative: do not build native components.")
usage_list+=("-skiprestorepackages: skip package restore.")
usage_list+=("-skipgeneratelayout: Do not generate the Core_Root layout.")
usage_list+=("-skiptestwrappers: Don't generate test wrappers.")
......@@ -166,10 +168,20 @@ usage_list+=("-log: base file name to use for log files (used in lab pipelines t
# Obtain the location of the bash script to figure out where the root of the repo is.
__ProjectRoot="$(cd "$(dirname "$0")"; pwd -P)"
__RepoRootDir="$(cd "$__ProjectRoot"/../..; pwd -P)"
__BuildArch=
__TargetArch=
handle_arguments_local() {
case "$1" in
skipmanaged|-skipmanaged)
__SkipManaged=1
__BuildTestWrappers=0
;;
skipnative|-skipnative)
__SkipNative=1
__CopyNativeProjectsAfterCombinedTestBuild=false
;;
buildtestwrappersonly|-buildtestwrappersonly)
__BuildTestWrappersOnly=1
;;
......@@ -331,7 +343,7 @@ CORE_ROOT=
source $__RepoRootDir/src/coreclr/_build-commons.sh
if [[ "${__BuildArch}" != "${__HostArch}" ]]; then
if [[ "${__TargetArch}" != "${__HostArch}" ]]; then
__CrossBuild=1
fi
......@@ -364,7 +376,7 @@ __LogsDir="$__RootBinDir/log"
__MsbuildDebugLogsDir="$__LogsDir/MsbuildDebugLogs"
# Set the remaining variables based upon the determined build configuration
__OSPlatformConfig="$__TargetOS.$__BuildArch.$__BuildType"
__OSPlatformConfig="$__TargetOS.$__TargetArch.$__BuildType"
__BinDir="$__RootBinDir/bin/coreclr/$__OSPlatformConfig"
__PackagesBinDir="$__BinDir/.nuget"
__TestDir="$__RepoRootDir/src/tests"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册