sola-raylib-sys
Raw FFI bindings for raylib and
raygui, consumed by the safe
sola-raylib wrapper. Not intended to be used directly.
sola-raylib-sys N.x tracks raylib's major version (5.x → raylib 5.5, 6.x →
raylib 6.0) and is pinned to the matching sola-raylib N.x.
How bindings are built
Bindings are generated at build time. There are no checked-in
bindings_*.rs files — every cargo build of this crate runs
bindgen against
binding/binding.h:
build.rsconfigures abindgen::Builderwith-std=c99, rustified enums, and-I./raylib/srcso clang resolves the submoduled raylib headers (not a system/usr/include/raylib.h).binding/binding.hpulls in raylib plus the raygui wrapper shim (binding/rgui_wrapper.h).- The generated
bindings.rsis written to$OUT_DIRand pulled intosrc/lib.rsviainclude!(concat!(env!("OUT_DIR"), "/bindings.rs")). cccompiles the raygui wrapper and links it with libraylib.
To inspect the generated bindings:
find target -name bindings.rs -path '*sola-raylib-sys*'
Regenerating after a header change
build.rs declares rerun-if-changed for binding/binding.h and for itself,
so bindings regenerate automatically when those inputs change. If cargo seems to
be using stale bindings after you:
- bumped the
raylibsubmodule to a new version, - replaced
binding/raygui.hwith a new raygui release, or - edited
binding/binding.h/ the wrapper shims,
force a rebuild:
cargo clean -p sola-raylib-sys
cargo build -p sola-raylib-sys
See DEVELOPING.md for the full "bumping raylib" checklist.
Feature flags
| Feature | Purpose |
|---|---|
bindgen (default) |
Generate bindings at build time. Turn off if you need to hand-roll bindings.rs for a platform bindgen can't target. |
nobuild |
Skip building and linking raylib entirely. For docs.rs and headless setups — you are responsible for linking. |
wayland |
Build raylib with Wayland support on Linux. |
sdl |
Build raylib with the SDL platform backend. |
opengl_21 / opengl_33 / opengl_es_20 / opengl_es_30 |
Select the GL backend raylib compiles against. |
noscreenshot, nogif |
Disable raylib's F12 screenshot / GIF recording. |
custom_frame_control |
Enable raylib's SUPPORT_CUSTOM_FRAME_CONTROL build flag. |
Layout
binding/ raygui wrapper shim, binding.h, utils_log
raylib/ git submodule: raysan5/raylib (C source + headers)
src/lib.rs thin shell that includes the bindgen output
build.rs drives bindgen + cc for the wrappers + raylib linkage