Skip to content

Use vcpkg for Windows build dependencies - #358

Merged
ofajardo merged 1 commit into
Roche:devfrom
hpoettker:vcpkg
Nov 24, 2026
Merged

ofajardo merged 1 commit into
Roche:devfrom
hpoettker:vcpkg

Conversation

@hpoettker

Copy link
Copy Markdown
Contributor

Background

The PR WizardMac/ReadStat#439 added vcpkg to ReadStat as this allowed a more general fix for a breaking change in zlib and improved the developer experience on Windows quite a bit. It's no longer the developer who has to find and provide zlib and libiconv. It's instead handled by vcpkg or Visual Studio, which has a vcpkg integration, automatically.

Summary

This PR proposes to do the same for pyreadstat.

The benefit in developer experience on Windows isn't as large as for ReadStat but I think it's still a material improvement.

It also simplifies updating the dependencies for Windows as it's now only a bump of the vcpkg baseline.

Changes

Replace the hand-built libiconv/zlib setup (kiyolee *-win-build repos compiled with msbuild and copied into win_libs/) with a vcpkg manifest.

  • Add vcpkg.json declaring libiconv and zlib, pinned via builtin-baseline.
  • Rewrite the windows_actions composite action: check out the baseline in the runner's vcpkg clone and bootstrap the matching tool (the preinstalled clone may predate the baseline), then install with the x64-/arm64-windows-static-md triplet. vcpkg_installed/ is cached keyed on runner arch and vcpkg.json.
  • setup.py: link iconv, charset and libzs from vcpkg_installed/
    (overridable via VCPKG_INSTALLED_DIR / VCPKG_TARGET_TRIPLET). zlib 1.4 renamed its static MSVC library to libzs.lib. The conda fallback is unchanged.
  • Remove win_libs/ including the prebuilt sample libraries.
  • Update windows_compilation.md accordingly.

The *-static-md triplets still link the libraries statically, so the wheels need no extra DLLs. Unlike the previous /MT builds, they use the dynamic CRT, matching Python and the extension itself, and give the same setup on x64 and ARM64.

Impact on the wheels build

I'll post a separate draft PR for the wheels build. Then you can see how it would need to be modified if this PR is merged.

Replace the hand-built libiconv/zlib setup (kiyolee *-win-build repos
compiled with msbuild and copied into win_libs/) with a vcpkg manifest.

- Add vcpkg.json declaring libiconv and zlib, pinned via builtin-baseline.
- Rewrite the windows_actions composite action: check out the baseline in
  the runner's vcpkg clone and bootstrap the matching tool (the
  preinstalled clone may predate the baseline), then install with the
  x64-/arm64-windows-static-md triplet. vcpkg_installed/ is cached keyed
  on runner arch and vcpkg.json.
- setup.py: link iconv, charset and libzs from vcpkg_installed/<triplet>
  (overridable via VCPKG_INSTALLED_DIR / VCPKG_TARGET_TRIPLET). zlib 1.4
  renamed its static MSVC library to libzs.lib. The conda fallback is
  unchanged.
- Remove win_libs/ including the prebuilt sample libraries.
- Update windows_compilation.md accordingly.

The *-static-md triplets still link the libraries statically, so the
wheels need no extra DLLs. Unlike the previous /MT builds, they use the
dynamic CRT, matching Python and the extension itself, and give the same
setup on x64 and ARM64.
@ofajardo

Copy link
Copy Markdown
Collaborator

thanks!

@ofajardo
ofajardo merged commit c182476 into Roche:dev Nov 24, 2026
3 checks passed
@ofajardo

Copy link
Copy Markdown
Collaborator

it would be good to have this in pyreadstat_wheels5 as well I guess

@hpoettker
hpoettker deleted the vcpkg branch November 24, 2026 11:20
@hpoettker

Copy link
Copy Markdown
Contributor Author

Yes, I'll revert the changes in wheels.yml of ofajardo/pyreadstat_wheels5#3 and remove the draft status tonight.

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.

2 participants