Skip to content

Use vcpkg for Windows build dependencies - #358

Open
hpoettker wants to merge 1 commit into
Roche:devfrom
hpoettker:vcpkg
Open

hpoettker wants to merge 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.

This branch has not been deployed

No deployments
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