Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: use scikit-build-core #13

Merged
merged 1 commit into from
May 1, 2024

Conversation

henryiii
Copy link
Contributor

@henryiii henryiii commented Apr 30, 2024

This switches the build system to scikit-build-core and adds Windows wheels (close #9 and close #12). It drops s390x because it's missing from upstream and that causes it to be called x86: https://github.com/ggerganov/whisper.cpp/blob/8fac6455ffeb0a0950a84e790ddb74f7290d33c4/CMakeLists.txt#L473-L474 - the logic there should be changed to only add x86 specific flags if x86 is detected, not to filter all known cases that are not x86. A very recent version of CMake is required due to EXCLUDE_FROM_ALL, but scikit-build-core handles requesting it if missing for you.

Tested locally with pipx run build --installer=uv. Checked contents with unzip -l dist/*.whl. Validated pyproject.toml with pipx run validate-pyproject-schema-store[all] pyproject.toml -v. Checked the wheel with pipx run --spec delocate delocate-listdeps dist/whisper_cpp_cli-0.0.2-py3-none-macosx_14_0_x86_64.whl (I had BUILD_SHARED_LIBS set to ON for a bit, somehow thinking that would build static libs when enabled...).

Since there's no pre-commit file, formatted CMakeLists.txt manually with pipx run cmake-format -I CMakeLists.txt.

Adding the other features should just be setting cmake flags; core-ml for example can be enabled by passing -Ccmake.define.WHISPER_COREML=1. Similarly for WHISPER_CUDA, etc.

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
environment.MACOSX_DEPLOYMENT_TARGET = "10.12"

[[tool.cibuildwheel.overrides]]
select = "*-macosx_arm64"
environment.MACOSX_DEPLOYMENT_TARGET = "11.0"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this no longer necessary? (Can cibuildwheel validate the macOS compatibility?)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

scikit-build-core is smart enough to make sure the wheel is tagged as 11 on ARM even if MACOSX_DEPLOYMENT_TARGET is less than 11. Hatch doesn't support MACOSX_DEPLOYMENT_TARGET properly yet, but I'll try to add it soon (pypa/hatch#1445).

I don't remember if it's in a released version, but yes: pypa/cibuildwheel#1766 (delocate supports it, specifically)

@charliermarsh charliermarsh merged commit de81556 into charliermarsh:main May 1, 2024
12 checks passed
@charliermarsh
Copy link
Owner

Amazing, thanks!

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.

Windows support
2 participants