@@ -1556,47 +1556,52 @@ function Build-Mimalloc() {
1556
1556
[hashtable ]$Arch
1557
1557
)
1558
1558
1559
- if ($Arch -eq $ArchX64 ) {
1560
- $Args = @ ()
1561
- Isolate- EnvVars {
1562
- Invoke-VsDevShell $Arch
1563
- # Avoid hard-coding the VC tools version number
1564
- $VCRedistDir = (Get-ChildItem " ${env: VCToolsRedistDir} \$ ( $HostArch.ShortName ) " - Filter " Microsoft.VC*.CRT" ).FullName
1565
- if ($VCRedistDir ) {
1566
- $Args += " -p:VCRedistDir=$VCRedistDir \"
1567
- }
1568
- }
1569
- $Args += " $SourceCache \mimalloc\ide\vs2022\mimalloc.sln"
1570
- $Args += " -p:Configuration=Release"
1571
- $Args += " -p:ProductArchitecture=$ ( $Arch.VSName ) "
1572
- Invoke-Program $msbuild @Args
1573
- $Dest = " $ ( $Arch.ToolchainInstallRoot ) \usr\bin"
1574
- Copy-Item - Path " $SourceCache \mimalloc\out\msvc-$ ( $Arch.ShortName ) \Release\mimalloc-override.dll" `
1575
- - Destination " $Dest "
1576
- Copy-Item - Path " $SourceCache \mimalloc\out\msvc-$ ( $Arch.ShortName ) \Release\mimalloc-redirect.dll" `
1577
- - Destination " $Dest "
1578
- $MimallocExecutables = @ (" swift.exe" , " swiftc.exe" , " swift-driver.exe" , " swift-frontend.exe" )
1579
- $MimallocExecutables += @ (" clang.exe" , " clang++.exe" , " clang-cl.exe" )
1580
- $MimallocExecutables += @ (" lld.exe" , " lld-link.exe" , " ld.lld.exe" , " ld64.lld.exe" )
1581
- foreach ($Exe in $MimallocExecutables ) {
1582
- $ExePath = [IO.Path ]::Combine($Dest , $Exe )
1583
- # Binary-patch in place
1584
- $Args = @ ()
1585
- $Args += " -f"
1586
- $Args += " -i"
1587
- $Args += " -v"
1588
- $Args += $ExePath
1589
- Invoke-Program " $SourceCache \mimalloc\bin\minject" @Args
1590
- # Log the import table
1591
- $Args = @ ()
1592
- $Args += " -l"
1593
- $Args += $ExePath
1594
- Invoke-Program " $SourceCache \mimalloc\bin\minject" @Args
1595
- dir " $ExePath "
1596
- }
1597
- } else {
1559
+ if ($Arch -ne $ArchX64 ) {
1598
1560
throw " mimalloc is currently supported for X64 only"
1599
1561
}
1562
+
1563
+ $MSBuildArgs = @ (" $SourceCache \mimalloc\ide\vs2022\mimalloc.sln" )
1564
+ $MSBuildArgs += " -noLogo"
1565
+ $MSBuildArgs += " -maxCpuCount"
1566
+ $MSBuildArgs += " -p:Configuration=Release"
1567
+ $MSBuildArgs += " -p:ProductArchitecture=$ ( $Arch.VSName ) "
1568
+
1569
+ Isolate- EnvVars {
1570
+ Invoke-VsDevShell $Arch
1571
+ # Avoid hard-coding the VC tools version number
1572
+ $VCRedistDir = (Get-ChildItem " ${env: VCToolsRedistDir} \$ ( $HostArch.ShortName ) " - Filter " Microsoft.VC*.CRT" ).FullName
1573
+ if ($VCRedistDir ) {
1574
+ $MSBuildArgs += " -p:VCRedistDir=$VCRedistDir \"
1575
+ }
1576
+ }
1577
+
1578
+ Invoke-Program $msbuild @MSBuildArgs
1579
+
1580
+ $Products = @ ( " mimalloc-override.dll" , " mimalloc-redirect.dll" )
1581
+ foreach ($Product in $Products ) {
1582
+ Copy-Item - Path " $SourceCache \mimalloc\out\msvc-$ ( $Arch.ShortName ) \Release\$Product " - Destination " $ ( Arch.ToolchainInstallRoot) \usr\bin"
1583
+ }
1584
+
1585
+ $Tools = @ (
1586
+ " swift.exe" ,
1587
+ " swiftc.exe" ,
1588
+ " swift-driver.exe" ,
1589
+ " swift-frontend.exe" ,
1590
+ " clang.exe" ,
1591
+ " clang++.exe" ,
1592
+ " clang-cl.exe" ,
1593
+ " lld.exe" ,
1594
+ " lld-link.exe" ,
1595
+ " ld.lld.exe" ,
1596
+ " ld64.lld.exe"
1597
+ )
1598
+ foreach ($Tool in $Tools ) {
1599
+ $Binary = [IO.Path ]::Combine($Dest , $Tool )
1600
+ # Binary-patch in place
1601
+ Invoke-Program " $SourceCache \mimalloc\bin\minject" @ (" -f" , " -i" , " -v" , $Binary )
1602
+ # Log the import table
1603
+ Invoke-Program " $SourceCache \mimalloc\bin\minject" @ (" -l" , $Binary )
1604
+ }
1600
1605
}
1601
1606
1602
1607
function Build-LLVM ([Platform ]$Platform , $Arch ) {
0 commit comments