Skip to content

Commit 80f5558

Browse files
committed
Use vs17 on php 8.4+
1 parent 5dd2137 commit 80f5558

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

windows_build.rs

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,12 +163,28 @@ impl DevelPack {
163163
/// Downloads a new PHP development pack, unzips it in the build script
164164
/// temporary directory.
165165
fn new(version: &str, is_zts: bool, arch: Arch) -> Result<DevelPack> {
166+
// If the PHP version is more than 8.4.1, use VS17 instead of VS16.
167+
let version_float = version
168+
.split('.')
169+
.take(2)
170+
.collect::<Vec<_>>()
171+
.join(".")
172+
.parse::<f32>()
173+
.context("Failed to parse PHP version as float")?;
174+
175+
// PHP builds switched to VS17 in PHP 8.4.1.
176+
let visual_studio_version = if version_float >= 8.4f32 {
177+
"vs17"
178+
} else {
179+
"vs16"
180+
};
181+
182+
166183
let zip_name = format!(
167184
"php-devel-pack-{}{}-Win32-{}-{}.zip",
168185
version,
169186
if is_zts { "" } else { "-nts" },
170-
"vs16", /* TODO(david): At the moment all PHPs supported by ext-php-rs use VS16 so
171-
* this is constant. */
187+
visual_studio_version,
172188
arch
173189
);
174190

0 commit comments

Comments
 (0)