17 releases

0.2.2 Feb 7, 2025
0.1.13 Jan 31, 2025
0.1.11 Jun 5, 2024
0.1.5 Feb 10, 2024
0.1.3 Nov 21, 2023

#105 in FFI

Download history 29/week @ 2024-10-29 17/week @ 2024-11-05 26/week @ 2024-11-12 32/week @ 2024-11-19 42/week @ 2024-11-26 40/week @ 2024-12-03 43/week @ 2024-12-10 19/week @ 2024-12-17 4/week @ 2024-12-31 13/week @ 2025-01-07 16/week @ 2025-01-14 21/week @ 2025-01-21 324/week @ 2025-01-28 494/week @ 2025-02-04 71/week @ 2025-02-11

916 downloads per month
Used in 14 crates (via playdate-sys)

MIT/Apache and maybe GPL-3.0+

94KB
2K SLoC

Playdate Bindings Generator

Util to generate bindings to Playdate with additional code-gen features like in-code documentation directly by official c-reference.

Requirements

  1. Rust nightly toolchain
  2. Playdate SDK
    • Ensure that env var PLAYDATE_SDK_PATH points to the SDK root
  3. Follow the official documentation
    • Ensure that arm-none-eabi-gcc or gcc-arm-none-eabi in your PATH
  4. Requirements inherited by bindgen, follow official documentation.

Configuration

Inherited configuration by bindgen: follow bindgen official documentation.

Env var PLAYDATE_SDK_PATH as described in playdate official documentation.

Optional env var ARM_GCC_PATH to help to find arm-none-eabi-gcc (or gcc-arm-none-eabi) with entire toolchain. Useful only for troubleshooting.

Usage

Cargo.toml:

[build-dependencies.bindgen]
package = "playdate-bindgen"
version = "*"

Add this to build-dependencies and add to your build-script something like this:

let cfg = bindgen::cfg::Config::default();
let generator = bindgen::Generator::new(cfg).expect("Couldn't create bindings generator.");
let out_path = bindgen::env_var("OUT_DIR").map(PathBuf::from)
	                                       .map(|p| p.join(&generator.filename.to_string()))
	                                       .unwrap();
let bindings = generator.generate().expect("Couldn't generate bindings.");
bindings.write_to_file(&out_path).expect("Couldn't write bindings.");

For complex examples see build-script in the playdate-sys crate.


This software is not sponsored or supported by Panic.

Dependencies

~7–18MB
~262K SLoC