Skip to content

Commit cc42378

Browse files
authored
Windows image fix (pmmp#215)
* Windows 2022 image for Windows builds * workaround not finding toolset on older visual studio * ... * Drop support for VS 2019, use older toolsets on VS 2022 for 8.2 and 8.3 this should get the build back to green
1 parent 9afe33b commit cc42378

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
lines changed

.github/workflows/main-pm-matrix.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ jobs:
232232

233233
windows:
234234
name: Windows
235-
runs-on: windows-2019
235+
runs-on: windows-2022
236236

237237
steps:
238238
- uses: actions/checkout@v4

windows-compile-vs.ps1

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -182,20 +182,25 @@ if ($PHP_VER -eq "") {
182182
$PHP_GIT_REV="php-$PHP_VER"
183183
$PHP_DISPLAY_VER="$PHP_VER"
184184

185-
#TODO: these should be selected by PHP base version
185+
$CMAKE_TARGET="Visual Studio 17 2022"
186+
186187
$VC_VER=""
187-
$CMAKE_TARGET=""
188+
$SDL_TOOLSET_FLAG=""
189+
$CMAKE_TOOLSET_FLAG=""
188190

189191
$PHP_VERSION_ID = php-version-id $PHP_VER
190192
if ($PHP_VERSION_ID -ge 80400) {
191193
$VC_VER="vs17"
192-
$CMAKE_TARGET="Visual Studio 17 2022"
194+
$SDK_TOOLSET_FLAG=""
195+
$CMAKE_TOOLSET_FLAG=""
193196
} else {
197+
#technically it's fine to build <8.4 with vs17, but this would make the binaries ABI-incompatible with community prebuilt extensions
194198
$VC_VER="vs16"
195-
$CMAKE_TARGET="Visual Studio 16 2019"
199+
$SDK_TOOLSET_FLAG="-s=14.29"
200+
$CMAKE_TOOLSET_FLAG="-T v142"
196201
}
197202

198-
pm-echo "Selected PHP $PHP_VER ($PHP_VERSION_ID) and toolset $VC_VER ($CMAKE_TARGET)"
203+
pm-echo "Selected PHP $PHP_VER ($PHP_VERSION_ID), SDK target $VC_VER ($SDK_TOOLSET_FLAG), CMake target $CMAKE_TARGET ($CMAKE_TOOLSET_FLAG)"
199204

200205
if ($env:SOURCES_PATH -ne $null) {
201206
$SOURCES_PATH=$env:SOURCES_PATH
@@ -273,7 +278,7 @@ function sdk-command {
273278

274279
New-Item task.bat -Value $command >> $log_file 2>&1
275280
echo "Running SDK command: $command" >> $log_file
276-
$wrap = "`"$SOURCES_PATH\phpsdk-$VC_VER-$ARCH.bat`" -t task.bat 2>&1"
281+
$wrap = "`"$SOURCES_PATH\phpsdk-starter.bat`" -c $VC_VER -a $ARCH $SDK_TOOLSET_FLAG -t task.bat 2>&1"
277282
echo "SDK wrapper command: $wrap" >> $log_file
278283
(& cmd.exe /c $wrap) >> $log_file
279284
$result=$LASTEXITCODE
@@ -304,7 +309,7 @@ function build-yaml {
304309
Push-Location libyaml
305310

306311
write-configure
307-
sdk-command "cmake -G `"$CMAKE_TARGET`"^`
312+
sdk-command "cmake -G `"$CMAKE_TARGET`" $CMAKE_TOOLSET_FLAG^`
308313
-DCMAKE_PREFIX_PATH=`"$DEPS_DIR`"^`
309314
-DCMAKE_INSTALL_PREFIX=`"$DEPS_DIR`"^`
310315
-DBUILD_SHARED_LIBS=ON^`
@@ -352,7 +357,7 @@ function build-leveldb {
352357
Push-Location leveldb
353358

354359
write-configure
355-
sdk-command "cmake -G `"$CMAKE_TARGET`"^`
360+
sdk-command "cmake -G `"$CMAKE_TARGET`" $CMAKE_TOOLSET_FLAG^`
356361
-DCMAKE_PREFIX_PATH=`"$DEPS_DIR`"^`
357362
-DCMAKE_INSTALL_PREFIX=`"$DEPS_DIR`"^`
358363
-DBUILD_SHARED_LIBS=ON^`
@@ -381,7 +386,7 @@ function build-libdeflate {
381386

382387
write-configure
383388
#TODO: not sure why we have arch here but not on other cmake targets
384-
sdk-command "cmake -G `"$CMAKE_TARGET`" -A `"$ARCH`"^`
389+
sdk-command "cmake -G `"$CMAKE_TARGET`" -A `"$ARCH`" $CMAKE_TOOLSET_FLAG^`
385390
-DCMAKE_PREFIX_PATH=`"$DEPS_DIR`"^`
386391
-DCMAKE_INSTALL_PREFIX=`"$DEPS_DIR`"^`
387392
-DLIBDEFLATE_BUILD_GZIP=OFF^`

0 commit comments

Comments
 (0)