mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-02 14:25:41 +08:00
Add Visual Studio 2026 support (#1191)
This commit is contained in:
@@ -22,6 +22,7 @@ class gettext_win
|
||||
{
|
||||
$ver = WindowsUtil::findVisualStudio();
|
||||
$vs_ver_dir = match ($ver['major_version']) {
|
||||
'18', // VS 2026 reuses the VS2022 (MSVC17) solution, which msbuild builds via forward compatibility.
|
||||
'17' => '\MSVC17',
|
||||
'16' => '\MSVC16',
|
||||
default => throw new EnvironmentException("Current VS version {$ver['major_version']} is not supported yet!"),
|
||||
@@ -44,7 +45,9 @@ class gettext_win
|
||||
{
|
||||
$vs_ver_dir = ApplicationContext::get('gettext_win_vs_ver_dir');
|
||||
cmd()->cd("{$lib->getSourceDir()}{$vs_ver_dir}\\libintl_static")
|
||||
->exec('msbuild libintl_static.vcxproj /t:Rebuild /p:Configuration=Release /p:Platform=x64 /p:WindowsTargetPlatformVersion=10.0');
|
||||
// WholeProgramOptimization (/GL) emits LTCG objects that frankenphp's lld-link cannot
|
||||
// read ("is not a native COFF file"); disable it so the .lib stays plain COFF.
|
||||
->exec('msbuild libintl_static.vcxproj /t:Rebuild /p:Configuration=Release /p:Platform=x64 /p:WindowsTargetPlatformVersion=10.0 /p:WholeProgramOptimization=false');
|
||||
FileSystem::createDir($lib->getLibDir());
|
||||
FileSystem::createDir($lib->getIncludeDir());
|
||||
// libintl_a.lib is the static library output; copy as libintl.lib for linker compatibility
|
||||
|
||||
@@ -21,6 +21,7 @@ class libffi_win
|
||||
{
|
||||
$ver = WindowsUtil::findVisualStudio();
|
||||
$vs_ver_dir = match ($ver['major_version']) {
|
||||
'18', // VS 2026 reuses the vs17 solution, which msbuild builds via forward compatibility.
|
||||
'17' => '\win32\vs17_x64',
|
||||
'16' => '\win32\vs16_x64',
|
||||
default => throw new EnvironmentException("Current VS version {$ver['major_version']} is not supported!"),
|
||||
@@ -33,7 +34,9 @@ class libffi_win
|
||||
{
|
||||
$vs_ver_dir = ApplicationContext::get('libffi_win_vs_ver_dir');
|
||||
cmd()->cd("{$lib->getSourceDir()}{$vs_ver_dir}")
|
||||
->exec('msbuild libffi-msvc.sln /t:Rebuild /p:Configuration=Release /p:Platform=x64');
|
||||
// WholeProgramOptimization (/GL) emits LTCG objects that frankenphp's lld-link cannot
|
||||
// read ("is not a native COFF file"); disable it so the .lib stays plain COFF.
|
||||
->exec('msbuild libffi-msvc.sln /t:Rebuild /p:Configuration=Release /p:Platform=x64 /p:WholeProgramOptimization=false');
|
||||
FileSystem::createDir($lib->getLibDir());
|
||||
FileSystem::createDir($lib->getIncludeDir());
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ class libiconv_win
|
||||
{
|
||||
$ver = WindowsUtil::findVisualStudio();
|
||||
$vs_ver_dir = match ($ver['major_version']) {
|
||||
'18', // VS 2026 reuses the VS2022 (MSVC17) solution, which msbuild builds via forward compatibility.
|
||||
'17' => '\MSVC17',
|
||||
'16' => '\MSVC16',
|
||||
default => throw new EnvironmentException("Current VS version {$ver['major_version']} is not supported yet!"),
|
||||
@@ -33,7 +34,9 @@ class libiconv_win
|
||||
{
|
||||
$vs_ver_dir = ApplicationContext::get('vs_ver_dir');
|
||||
cmd()->cd("{$lib->getSourceDir()}{$vs_ver_dir}")
|
||||
->exec('msbuild libiconv.sln /t:Rebuild /p:Configuration=Release /p:Platform=x64');
|
||||
// WholeProgramOptimization (/GL) emits LTCG objects that frankenphp's lld-link cannot
|
||||
// read ("is not a native COFF file"); disable it so the .lib stays plain COFF.
|
||||
->exec('msbuild libiconv.sln /t:Rebuild /p:Configuration=Release /p:Platform=x64 /p:WholeProgramOptimization=false');
|
||||
FileSystem::createDir($lib->getLibDir());
|
||||
FileSystem::createDir($lib->getIncludeDir());
|
||||
FileSystem::copy("{$lib->getSourceDir()}{$vs_ver_dir}\\x64\\lib\\libiconv.lib", "{$lib->getLibDir()}\\libiconv.lib");
|
||||
|
||||
@@ -42,13 +42,16 @@ class libsodium
|
||||
{
|
||||
$ver = WindowsUtil::findVisualStudio();
|
||||
$vs_ver_dir = match ($ver['major_version']) {
|
||||
'18', // VS 2026 reuses the vs2022 solution, which msbuild builds via forward compatibility.
|
||||
'17' => '\vs2022',
|
||||
'16' => '\vs2019',
|
||||
default => throw new EnvironmentException("Current VS version {$ver['major_version']} is not supported yet!"),
|
||||
};
|
||||
|
||||
cmd()->cd("{$lib->getSourceDir()}\\builds\\msvc{$vs_ver_dir}")
|
||||
->exec('msbuild libsodium.sln /t:Rebuild /p:Configuration=StaticRelease /p:Platform=x64 /p:PreprocessorDefinitions="SODIUM_STATIC=1"');
|
||||
// WholeProgramOptimization (/GL) emits LTCG objects that frankenphp's lld-link cannot
|
||||
// read ("is not a native COFF file"); disable it so the .lib stays plain COFF.
|
||||
->exec('msbuild libsodium.sln /t:Rebuild /p:Configuration=StaticRelease /p:Platform=x64 /p:WholeProgramOptimization=false /p:PreprocessorDefinitions="SODIUM_STATIC=1"');
|
||||
FileSystem::createDir($lib->getLibDir());
|
||||
FileSystem::createDir($lib->getIncludeDir());
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ class mpir
|
||||
{
|
||||
$ver = WindowsUtil::findVisualStudio();
|
||||
$vs_ver_dir = match ($ver['major_version']) {
|
||||
'18', // VS 2026 reuses the build.vc17 solution, which msbuild builds via forward compatibility.
|
||||
'17' => '\build.vc17',
|
||||
'16' => '\build.vc16',
|
||||
default => throw new EnvironmentException("Current VS version {$ver['major_version']} is not supported yet!"),
|
||||
|
||||
@@ -512,6 +512,7 @@ HEADER;
|
||||
$vc_matches = ['unknown', 'unknown'];
|
||||
} else {
|
||||
$vc_matches = match ($vc['major_version']) {
|
||||
'18', // VS 2026 shares the VS2022 (v143) runtime conventions, so it reports as VS17.
|
||||
'17' => ['VS17', 'Visual C++ 2022'],
|
||||
'16' => ['VS16', 'Visual C++ 2019'],
|
||||
default => ['unknown', 'unknown'],
|
||||
|
||||
@@ -189,6 +189,10 @@ class WindowsCMakeExecutor extends Executor
|
||||
{
|
||||
return $this->custom_default_args ?? [
|
||||
'-A x64',
|
||||
// CMake 4.x hard-errors on projects requesting compatibility with CMake < 3.5
|
||||
// (e.g. wineditline). This is the documented escape hatch; modern projects and
|
||||
// older CMake releases ignore it.
|
||||
'-DCMAKE_POLICY_VERSION_MINIMUM=3.5',
|
||||
'-DCMAKE_BUILD_TYPE=Release',
|
||||
'-DBUILD_SHARED_LIBS=OFF',
|
||||
'-DBUILD_STATIC_LIBS=ON',
|
||||
|
||||
Reference in New Issue
Block a user