Skip to content

Use prebuilt bindings for the bundled path, gate bindgen behind a cfg - #43

Merged
mmghannam merged 1 commit into
mainfrom
prebuilt-bundled-bindings
Jun 23, 2026
Merged

Use prebuilt bindings for the bundled path, gate bindgen behind a cfg#43
mmghannam merged 1 commit into
mainfrom
prebuilt-bundled-bindings

Conversation

@mmghannam

Copy link
Copy Markdown
Member

Summary

The bundled SCIP release is pinned, so bindgen's output is deterministic per target. This ships prebuilt bindings under src/bindings/<target>.rs and copies them in the bundled build instead of running bindgen every time.

bindgen is now an optional build-dependency, enabled by default so the system/SCIPOPTDIR/conda and from-source paths keep working out of the box. Building with --no-default-features --features bundled drops bindgen and its libclang requirement entirely.

Why

Measured on the bundled path:

  • ~3.3s bindgen generation on (almost) every build → replaced by a file copy.
  • ~12.5s of one-time bindgen-subtree crate compilation (clang-sys, prettyplease, regex, …) off clean builds.
  • No more libclang dependency 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.rs split 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=1 escape hatch to regenerate committed bindings.
  • generate-bindings.yml workflow: regenerates all 5 platforms and opens a PR.
  • Drift-check + lean-path jobs added to the test workflow (green now, auto-activate per platform as bindings land).
  • .gitattributes pins these files to LF for stable cross-platform diffs.

Rollout note

Only macos-arm bindings are committed so far (the only platform I could generate locally). Other platforms transparently fall back to bindgen until the generate-bindings workflow populates them.

🤖 Generated with Claude Code

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>
@mmghannam
mmghannam merged commit c37af1a into main Jun 23, 2026
20 of 21 checks passed
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