Skip to content

Commit d0777ce

Browse files
committed
fixup! wip: windows
1 parent 3f1790f commit d0777ce

1 file changed

Lines changed: 39 additions & 1 deletion

File tree

.github/workflows/build.ps1

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,43 @@ $ErrorActionPreference = "Stop"
22

33
$env:PATH = "C:\php\devel;C:\php\bin;C:\php\deps\bin;$env:PATH"
44

5+
# toolset
6+
$installerDir = Join-Path "${env:ProgramFiles(x86)}\Microsoft Visual Studio" 'Installer'
7+
$vswherePath = Join-Path $installerDir 'vswhere.exe'
8+
if (-not (Test-Path $vswherePath)) {
9+
if (-not (Test-Path $installerDir)) {
10+
New-Item -Path $installerDir -ItemType Directory -Force | Out-Null
11+
}
12+
$vsWhereUrl = 'https://github.com/microsoft/vswhere/releases/latest/download/vswhere.exe'
13+
Invoke-WebRequest -Uri $vsWhereUrl -OutFile $vswherePath -UseBasicParsing
14+
}
15+
# if($null -eq (Get-Command vswhere -ErrorAction SilentlyContinue)) {
16+
# throw "vswhere is not available"
17+
# }
18+
# $MSVCDirectory = vswhere -latest -products * -find "VC\Tools\MSVC"
19+
$MSVCDirectory = $vswherePath -latest -products * -find "VC\Tools\MSVC"
20+
$selectedToolset = $null
21+
# $minor = $null
22+
foreach ($toolset in (Get-ChildItem $MSVCDirectory)) {
23+
$selectedToolset = $toolset.Name.Trim()
24+
echo "===> $selectedToolset"
25+
# $toolsetMajorVersion, $toolsetMinorVersion = $toolset.Name.split(".")[0,1]
26+
# $requiredVs = $env:VS
27+
# $majorVersionCheck = [int]$requiredVs.major -eq [int]$toolsetMajorVersion
28+
# $minorLowerBoundCheck = [int]$toolsetMinorVersion -ge [int]$requiredVs.minorMin
29+
# $minorUpperBoundCheck = ($null -eq $requiredVs.minorMax) -or ([int]$toolsetMinorVersion -le [int]$requiredVs.minorMax)
30+
# if ($majorVersionCheck -and $minorLowerBoundCheck -and $minorUpperBoundCheck) {
31+
# if($null -eq $minor -or [int]$toolsetMinorVersion -gt [int]$minor) {
32+
# $selectedToolset = $toolset.Name.Trim()
33+
# $minor = $toolsetMinorVersion
34+
# }
35+
# }
36+
}
37+
# if (-not $selectedToolset) {
38+
# throw "toolset not available"
39+
# }
40+
# echo "===> $selectedToolset"
41+
542
echo "===> C:\php\php-sdk-$env:BIN_SDK_VER\phpsdk-starter.bat -c $env:VS -a $env:ARCH -s $env:TOOLSET"
643
# php-sdk\phpsdk-starter.bat -c vs16 -a x64 -s 14.29.30133 -t D:\a\php-ext-lz4\php-ext-lz4\.github\extension\BuildPhpExtension\private\..\config\task.bat
744

@@ -10,7 +47,8 @@ Add-Content $task 'call phpize 2>&1'
1047
Add-Content $task "call configure --with-php-build=C:\php\deps --enable-$env:PHP_EXT --enable-debug-pack 2>&1"
1148
Add-Content $task 'nmake /nologo 2>&1'
1249
Add-Content $task 'exit %errorlevel%'
13-
& "C:\php\php-sdk-$env:BIN_SDK_VER\phpsdk-starter.bat" -c "$env:VS" -a "$env:ARCH" -s "$env:TOOLSET" -t $task
50+
& "C:\php\php-sdk-$env:BIN_SDK_VER\phpsdk-starter.bat" -c "$env:VS" -a "$env:ARCH" -t $task
51+
# & "C:\php\php-sdk-$env:BIN_SDK_VER\phpsdk-starter.bat" -c "$env:VS" -a "$env:ARCH" -s "$env:TOOLSET" -t $task
1452
if (-not $?) {
1553
throw "building failed with errorlevel $LastExitCode"
1654
}

0 commit comments

Comments
 (0)