Skip to content

feat(build): add automated Windows build script with multi-variant support - #172

Open
SebZar wants to merge 1 commit into
gkralik:mainfrom
SebZar:feat/windows-build
Open

feat(build): add automated Windows build script with multi-variant support#172
SebZar wants to merge 1 commit into
gkralik:mainfrom
SebZar:feat/windows-build

Conversation

@SebZar

@SebZar SebZar commented Jun 13, 2026

Copy link
Copy Markdown

Summary

Adds a self-contained PowerShell build script (build/build-windows.ps1) and accompanying documentation (build/build-windows.md) for building the extension on Windows across multiple PHP variants.

  • Discovers all PHP variants (TS/NTS, version, toolset, arch) from zip files placed in build\php\ — no git clone or internet access needed
  • Auto-detects installed Visual Studio via vswhere; handles cross-toolset builds (e.g. vs16/vs17 PHP zips on a VS 2026 host) via vcvarsall -vcvars_ver
  • Produces versioned DLL filenames encoding extension, PHP, and SDK versions: php_sapnwrfc-{ext}+php.{php}-{ts|nts}-{toolset}-{arch}.sdk.{sdk}.dll
  • All DLLs collected flat in build\output\
  • Optional -RunTests flag runs nmake test after each build using the same MSVC environment as the build step (correct for cross-toolset)

Also updates .gitignore: replaces the blanket build/ exclusion with specific subdirectory entries (output/, php/, sap/, workspace/) so the script and documentation are tracked, and adds Windows build artefacts (x64/, x86/, configure.bat, *.log) to the ignore list.

Test plan

  • Place PHP binary + devel zips and SAP NW RFC SDK zip in the expected directories
  • Run .\build-windows.ps1 on a VS 2026 machine with vs16 and vs17 components installed
  • Verify each built DLL loads in PHP (php -m | findstr sapnwrfc)
  • Run with -RunTests and confirm test output is reported per variant
  • Confirm build\output\, build\php\, build\sap\, build\workspace\ are excluded from git status

🤖 Generated with Claude Code

…pport

Adds build/build-windows.ps1 and build/build-windows.md for building
php-sapnwrfc on Windows without manual VS environment setup.

Key features:
- Discovers all PHP variants (TS/NTS, version, toolset, arch) from
  zip files placed in build\php\ — no git clone or internet access needed
- Auto-detects installed Visual Studio via vswhere; handles cross-toolset
  builds (e.g. vs16/vs17 PHP zips on VS 2026 host) via vcvarsall -vcvars_ver
- Produces versioned DLL filenames encoding extension, PHP, and SDK versions:
  php_sapnwrfc-{ext}+php.{php}-{ts|nts}-{toolset}-{arch}.sdk.{sdk}.dll
- All DLLs collected flat in build\output\; no per-variant subdirectories
- Optional -RunTests flag runs nmake test after each build using the
  same MSVC environment as the build step (correct for cross-toolset)
- Reliable exit-code capture: build steps wrapped in CMD subroutine so
  || exit /b 1 guards exit the subroutine, not the outer bat — the exit
  file is always written regardless of which step fails

Also updates .gitignore: replaces the blanket build/ exclusion with
specific subdirectory entries (output/, php/, sap/, workspace/) so that
the script and documentation are tracked, and adds Windows build artefacts
(x64/, x86/, configure.bat, *.log) to the ignore list.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@SebZar
SebZar force-pushed the feat/windows-build branch from 75b732c to 411ef04 Compare June 14, 2026 13:14
@SebZar SebZar changed the title feat(build): add PowerShell build script for Windows feat(build): add automated Windows build script with multi-variant support Jun 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant