5 releases
Uses new Rust 2024
| new 0.1.4 | Mar 5, 2026 |
|---|---|
| 0.1.3 | Mar 4, 2026 |
| 0.1.2 | Mar 4, 2026 |
| 0.1.1 | Mar 2, 2026 |
| 0.1.0 | Mar 1, 2026 |
#132 in FFI
6MB
61K
SLoC
sdl-sys-rs
Rust FFI bindings for SDL3 and its satellite libraries (SDL3_image, SDL3_mixer, SDL3_ttf), generated with bindgen.
Workspace Crates
| Crate | Purpose |
|---|---|
sdl-sys |
Raw FFI bindings for SDL3 |
sdl-image-sys |
Raw FFI bindings for SDL3_image |
sdl-mixer-sys |
Raw FFI bindings for SDL3_mixer |
sdl-ttf-sys |
Raw FFI bindings for SDL3_ttf |
sdl3-gfx-sys |
Raw FFI bindings for SDL3_gfx |
sdl-main |
Idiomatic Rust wrapper for SDL's callback-based app loop |
sdl-bindgen |
Binding generator (developer tool, not published) |
sdl-build-helper |
Shared build script logic for -sys crates |
Getting Started
Prerequisites
- Rust (edition 2024)
- SDL3 shared libraries installed system-wide (or reachable via
LD_LIBRARY_PATH) - Clang (required by bindgen)
Clone with Submodules
git clone --recurse-submodules https://github.com/achusbyr/sdl-sys-rs.git
cd sdl-sys-rs
If you already cloned without submodules:
git submodule update --init --recursive
Regenerate Bindings (optional)
Only needed if you update the SDL submodules or want to add a new target:
cargo run -p sdl-bindgen
This reads the C headers from submodules/ and writes generated Rust files into each crate's src/generated/ directory.
Build
cargo build
Run Examples
cargo run -p sdl-sys --example hello_world
cargo run -p sdl-main --example callbacks
Adding a New Target
- Add the target triple to
TARGETSinsdl-bindgen/src/main.rs - Run
cargo run -p sdl-bindgen - The new bindings will be generated with appropriate
#[cfg]attributes