Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/scripts/windows/build.bat
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ if not exist "%SDK_RUNNER%" (
exit /b 3
)

cmd /c %SDK_RUNNER% -t .github\scripts\windows\build_task.bat
for /f "delims=" %%T in ('call .github\scripts\windows\find-vs-toolset.bat %PHP_BUILD_CRT%') do set "VS_TOOLSET=%%T"
echo Got VS Toolset %VS_TOOLSET%
cmd /c %SDK_RUNNER% -s %VS_TOOLSET% -t .github\scripts\windows\build_task.bat
if %errorlevel% neq 0 exit /b 3

exit /b 0
49 changes: 49 additions & 0 deletions .github/scripts/windows/find-vs-toolset.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
@echo off

setlocal enabledelayedexpansion

if "%~1"=="" (
echo ERROR: Usage: %~nx0 [vc14^|vc15^|vs16^|vs17]
exit /b 1
)

set "toolsets_vc14=14.0"
set "toolsets_vc15="
set "toolsets_vs16="
set "toolsets_vs17="


for /f "usebackq tokens=*" %%I in (`vswhere.exe -latest -find "VC\Tools\MSVC"`) do set "MSVCDIR=%%I"

if not defined MSVCDIR (
echo ERROR: could not locate VC\Tools\MSVC
exit /b 1
)

for /f "delims=" %%D in ('dir /b /ad "%MSVCDIR%"') do (
for /f "tokens=1,2 delims=." %%A in ("%%D") do (
set "maj=%%A" & set "min=%%B"
if "!maj!"=="14" (
if !min! LEQ 9 (
set "toolsets_vc14=%%D"
) else if !min! LEQ 19 (
set "toolsets_vc15=%%D"
) else if !min! LEQ 29 (
set "toolsets_vs16=%%D"
) else (
set "toolsets_vs17=%%D"
)
)
)
)

set "KEY=%~1"
set "VAR=toolsets_%KEY%"
call set "RESULT=%%%VAR%%%"
if defined RESULT (
echo %RESULT%
exit /b 0
) else (
echo ERROR: no toolset found for %KEY%
exit /b 1
)
3 changes: 2 additions & 1 deletion .github/scripts/windows/test.bat
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ if not exist "%SDK_RUNNER%" (
exit /b 3
)

cmd /c %SDK_RUNNER% -t .github\scripts\windows\test_task.bat
for /f "delims=" %%T in ('call .github\scripts\windows\find-vs-toolset.bat %PHP_BUILD_CRT%') do set "VS_TOOLSET=%%T"
cmd /c %SDK_RUNNER% -s %VS_TOOLSET% -t .github\scripts\windows\test_task.bat
if %errorlevel% neq 0 exit /b 3

exit /b 0
2 changes: 1 addition & 1 deletion .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ jobs:
WINDOWS:
if: github.repository == 'php/php-src' || github.event_name == 'pull_request'
name: WINDOWS_X64_ZTS
runs-on: windows-2019
runs-on: windows-2022
env:
PHP_BUILD_CACHE_BASE_DIR: C:\build-cache
PHP_BUILD_OBJ_DIR: C:\obj
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/root.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jobs:
ubuntu_version: ${{
(((matrix.branch.version[0] == 8 && matrix.branch.version[1] >= 5) || matrix.branch.version[0] >= 9) && '24.04')
|| '22.04' }}
windows_version: ${{ ((matrix.branch.version[0] == 8 && matrix.branch.version[1] >= 4) || matrix.branch.version[0] >= 9) && '2022' || '2019' }}
windows_version: '2022'
skip_laravel: ${{ matrix.branch.version[0] == 8 && matrix.branch.version[1] == 1 }}
skip_symfony: ${{ matrix.branch.version[0] == 8 && matrix.branch.version[1] == 1 }}
skip_wordpress: ${{ matrix.branch.version[0] == 8 && matrix.branch.version[1] == 1 }}
Expand Down
Loading