php / php-sdk-binary-tools

Tool kit for building PHP under Windows
BSD 2-Clause "Simplified" License
85 stars 32 forks source link

Add support for toolset #15

Closed shivammathur closed 3 months ago

shivammathur commented 3 months ago

This PR adds a toolset input to call vcvarsall.bat script with -vcvars_ver argument.

nono303 commented 3 months ago

Hi @shivammathur, Thx for this PR! Fyi, vcvarsall.bat doesn't exist anymore on Visual Studio 2022 Community >= 17.10 (preview) This is my config to build PHP with vs16 & vs17

{
  "version": "1.0",
  "components": [
    "Microsoft.VisualStudio.Component.CoreEditor",
    "Microsoft.VisualStudio.Workload.CoreEditor",
    "Microsoft.Net.Component.4.8.SDK",
    "Microsoft.VisualStudio.Component.Roslyn.Compiler",
    "Microsoft.Component.MSBuild",
    "Microsoft.VisualStudio.Component.TextTemplating",
    "Microsoft.Net.Component.4.8.TargetingPack",
    "Microsoft.VisualStudio.Component.VC.CoreIde",
    "Microsoft.VisualStudio.Component.VC.14.40.17.10.x86.x64",
    "Microsoft.VisualStudio.Component.VC.Redist.14.Latest",
    "Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Core",
    "Microsoft.VisualStudio.ComponentGroup.WebToolsExtensions.CMake",
    "Microsoft.VisualStudio.Component.Windows11SDK.22621",
    "Microsoft.VisualStudio.Workload.NativeDesktop",
    "Microsoft.VisualStudio.Component.VC.14.29.16.11.x86.x64",
    "Microsoft.VisualStudio.Component.VC.14.40.17.10.ATL"
  ],
  "extensions": []
}

I had to patch this way to have it working

 bin/phpsdk_setshell.bat | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bin/phpsdk_setshell.bat b/bin/phpsdk_setshell.bat
index 8c41734..0dcb846 100644
--- a/bin/phpsdk_setshell.bat
+++ b/bin/phpsdk_setshell.bat
@@ -211,7 +211,7 @@ if 15 gtr %PHP_SDK_VS_NUM% (
     )
 ) else (
     if NOT "%TOOLSET%"=="" (
-        set PHP_SDK_VS_SHELL_CMD="!PHP_SDK_VC_DIR!\Auxiliary\Build\vcvarsall.bat" !VCVARSALL_ARCH_NAME! -vcvars_ver=%TOOLSET%
+        set PHP_SDK_VS_SHELL_CMD="!PHP_SDK_VC_DIR!\VsDevCmd.bat" -arch=!VCVARSALL_ARCH_NAME! -vcvars_ver=%TOOLSET% -winsdk=%WKITVER% -no_logo
     ) else (
         set PHP_SDK_VS_SHELL_CMD="!PHP_SDK_VC_DIR!\Auxiliary\Build\vcvarsall.bat" !VCVARSALL_ARCH_NAME!
     )
cmb69 commented 2 days ago

Fyi, vcvarsall.bat doesn't exist anymore on Visual Studio 2022 Community >= 17.10 (preview)

Possible, but that's not supposed to be the case. For me (17.11.2) it's in C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build, and it's found by the phpsdk_setshell.bat.

Jan-E commented 2 days ago

Possible, but that's not supposed to be the case. For me (17.11.2) it's in C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build

Same here on my laptop with 17.11.2