11 releases

0.1.10 Apr 15, 2024
0.1.9 Apr 13, 2024
0.1.5 Feb 10, 2024
0.1.4 Jan 16, 2024
0.0.0 Sep 4, 2023

#187 in FFI

Download history 10/week @ 2024-01-08 66/week @ 2024-01-15 79/week @ 2024-02-05 17/week @ 2024-02-12 116/week @ 2024-02-19 53/week @ 2024-02-26 47/week @ 2024-03-04 31/week @ 2024-03-11 45/week @ 2024-03-18 37/week @ 2024-03-25 333/week @ 2024-04-01 312/week @ 2024-04-08 198/week @ 2024-04-15

884 downloads per month
Used in 13 crates (via playdate-sys)

MIT/Apache and maybe GPL-3.0+

82KB
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–20MB
~252K SLoC