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