Use prebuilt bindings for the bundled path, gate bindgen behind a cfg - #43
Merged
Conversation
The bundled SCIP release is pinned, so bindgen's output is deterministic per target. Ship prebuilt bindings under src/bindings/<target>.rs and copy them in the bundled build instead of running bindgen on every build. bindgen is now an optional build-dependency (enabled by default so the system/SCIPOPTDIR/conda and from-source paths keep working). Building with --no-default-features --features bundled drops bindgen and its libclang requirement entirely, shaving the ~3.3s per-build generation step plus the one-time bindgen-subtree compilation off clean builds. build.rs splits link-directive emission from bindgen builder creation and dispatches on cfg. A SCIP_SYS_REGENERATE_BINDINGS escape hatch regenerates the committed bindings; the generate-bindings workflow uses it to refresh all platforms and open a PR, and a drift-check job fails if they fall out of sync with the pinned release. Only macos-arm bindings are committed so far; other platforms transparently fall back to bindgen until the generate-bindings workflow populates them. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The bundled SCIP release is pinned, so bindgen's output is deterministic per target. This ships prebuilt bindings under
src/bindings/<target>.rsand copies them in the bundled build instead of running bindgen every time.bindgenis now an optional build-dependency, enabled by default so the system/SCIPOPTDIR/conda andfrom-sourcepaths keep working out of the box. Building with--no-default-features --features bundleddrops bindgen and its libclang requirement entirely.Why
Measured on the bundled path:
clang-sys,prettyplease,regex, …) off clean builds.libclangdependency on the lean path.The dominant cost (rustc compiling the ~59k-line bindings) is unchanged — that happens whether the file comes from bindgen or a prebuilt copy.
What's here
build.rssplit into link-directive emission (always compiled) vs. bindgen builder (cfg-gated), with cfg-based dispatch across bundled / from-source / system paths.SCIP_SYS_REGENERATE_BINDINGS=1escape hatch to regenerate committed bindings.generate-bindings.ymlworkflow: regenerates all 5 platforms and opens a PR..gitattributespins these files to LF for stable cross-platform diffs.Rollout note
Only
macos-armbindings are committed so far (the only platform I could generate locally). Other platforms transparently fall back to bindgen until thegenerate-bindingsworkflow populates them.🤖 Generated with Claude Code