Skip to content

Commit

Permalink
Swift bug 72724 workaround for SPMPrebuild.ps1
Browse files Browse the repository at this point in the history
  • Loading branch information
tristanlabelle committed Dec 10, 2024
1 parent d5b93b2 commit 3a4bb88
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions InteropTests/SPMPrebuild.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ The path to SwiftWinRT.exe. If not provided, the script will build it with SPM.
#>
[CmdletBinding(PositionalBinding = $false)]
param(
[string] $SwiftWinRT
[string] $SwiftWinRT,
[ValidateSet("true", "false", "null")]
[string] $SwiftBug72724 = $null
)

Set-StrictMode -Version 3
Expand Down Expand Up @@ -38,10 +40,19 @@ else {
$SwiftWinRT = [IO.Path]::GetFullPath($SwiftWinRT)
}

Write-Host -ForegroundColor Cyan "Building WinRTComponent.dll & winmd..."
$CMakePreset = "debug" # Tests are always built in debug mode
Write-Host -ForegroundColor Cyan "Building WinRTComponent.dll, winmd and projection..."
Push-Location "$PSScriptRoot\WinRTComponent"
& cmake.exe --preset $CMakePreset -D "SWIFTWINRT_EXE=$SwiftWinRT" -D "PROJECTION_DIR=$(Get-Location)\Projection"
$CMakePreset = "debug" # Tests are always built in debug mode
$Defines = @(
"-D", "SWIFTWINRT_EXE=$SwiftWinRT",
"-D", "PROJECTION_DIR=$(Get-Location)\Projection"
)
switch ($SwiftBug72724) {
"true" { $Defines += @("-D", "SWIFT_BUG_72724=ON") }
"false" { $Defines += @("-D", "SWIFT_BUG_72724=OFF") }
default {}
}
& cmake.exe --preset $CMakePreset @Defines
& cmake.exe --build --preset $CMakePreset --target WinRTComponent
$WinRTComponentBinDir = "$(Get-Location)\build\$CMakePreset\Dll"
Pop-Location
Expand Down

0 comments on commit 3a4bb88

Please sign in to comment.