diff --git a/utils/build.ps1 b/utils/build.ps1 index 6a2a0a83c26e9..2b7a0c980af19 100644 --- a/utils/build.ps1 +++ b/utils/build.ps1 @@ -2222,15 +2222,24 @@ function Build-mimalloc() { Invoke-Program $msbuild "$SourceCache\mimalloc\ide\vs2022\mimalloc-override-dll.vcxproj" @MSBuildArgs "-p:IntDir=$BinaryCache\$($Platform.Triple)\mimalloc\mimalloc-override-dll\" $HostSuffix = if ($Platform -eq $KnownPlatforms["WindowsX64"]) { "" } else { "-arm64" } - $BuildSuffix = if ($BuildPlatform -eq $KnownPlatforms["WindowsX64"]) { "" } else { "-arm64" } foreach ($item in "mimalloc.dll", "mimalloc-redirect$HostSuffix.dll") { Copy-Item ` -Path "$BinaryCache\$($Platform.Triple)\mimalloc\bin\$item" ` -Destination "$($Platform.ToolchainInstallRoot)\usr\bin\" } +} + +function Patch-mimalloc() { + [CmdletBinding(PositionalBinding = $false)] + param + ( + [Parameter(Position = 0, Mandatory = $true)] + [hashtable]$Platform + ) + + $BuildSuffix = if ($BuildPlatform -eq $KnownPlatforms["WindowsX64"]) { "" } else { "-arm64" } - # TODO: should we split this out into its own function? $Tools = @( "swift.exe", "swiftc.exe", @@ -4030,6 +4039,10 @@ if (-not $SkipBuild -and -not $IsCrossCompiling) { Invoke-BuildStep Build-DocC $HostPlatform } +if (-not $SkipBuild) { + Invoke-BuildStep Patch-mimalloc $HostPlatform +} + if (-not $SkipPackaging) { Invoke-BuildStep Build-Installer $HostPlatform }