24 releases

0.3.14 Feb 10, 2024
0.3.13 Jan 14, 2024
0.3.12 Nov 21, 2023
0.3.11 Oct 27, 2023
0.0.0 Jun 26, 2023

#96 in Cargo plugins

Download history 2/week @ 2023-11-01 2/week @ 2023-11-08 43/week @ 2023-11-15 93/week @ 2023-11-22 114/week @ 2023-11-29 39/week @ 2023-12-06 27/week @ 2023-12-13 26/week @ 2023-12-20 48/week @ 2023-12-27 2/week @ 2024-01-03 44/week @ 2024-01-10 17/week @ 2024-01-17 51/week @ 2024-01-24 51/week @ 2024-01-31 46/week @ 2024-02-07 302/week @ 2024-02-14

450 downloads per month

MIT/Apache

380KB
9K SLoC

Build System for Playdate applications

Cargo-playdate is a plugin for cargo that can build programs for Playdate handheld gaming system written in Rust.

It can build programs written in Rust, manage assets, build package for Playdate and run in sim or install and run on device. Usually it builds static or dynamic libraries for sim and hardware, but also it can build executable binaries for hardware and this method produces highly optimized output with dramatically minimized size (thanks to DCE & LTO). * But for binaries you're need also patched pdc from dev-forum.

Status

Currently tested and works good on following platforms:

  • Unix (x86-64 and aarch64)
    • macos 👍
    • linux 👍
  • Windows (x86-64 and aarch64)
    • build 👍
    • package 👍
    • install & run ⚠️ - issues, work in progress, see troubleshooting.

Prerequisites

To build cargo-playdate you're need:

  1. Rust nightly toolchain
  2. Probably libusb and pkg-config or vcpkg, follow instructions for rusb crate.

To build programs using cargo-playdate you need:

  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. This tool.

Installation

cargo install --git="https://github.com/boozook/playdate.git" --bin=cargo-playdate

Hello World

Generate new project using new or init command.

mkdir hello-world && cd $_
cargo playdate init --lib --full-metadata --deps="playdate"
cargo playdate run

Note, there is more options for this commands, e.g. --deps="sys:git, controls:git". Run cargo playdate new --help for more about it.

New package will be created.

Take a look at the package manifest file (Cargo.toml).

There is extra metadata for your playdate package.

For more information about metadata read documentation.

Configuration

There is no configuration other then inherited by cargo and some special environment variables.

  • CARGO_PLAYDATE_LOG working same way as CARGO_LOG or default RUST_LOG. Also CARGO_PLAYDATE_LOG_STYLE
  • PLAYDATE_SDK_PATH path to the SDK root
  • ARM_GCC_PATH path to the arm-none-eabi-gcc executable.

Execute cargo playdate -h for more details, or with --help for further more.

Limitations

  1. Global crate-level attributes like crate_type and crate_name doesn't supported, e.g:
#![crate_name = "Game"]
#![crate_type = "lib"]
  1. Cargo-targets such as bin and example should be in the cargo manifest. Autodetect isn't yet tested and may not work. Example:
[[example]]
name = "demo"
crate-type = ["dylib", "staticlib"]
path = "examples/demo.rs"
  1. Assets especially for example cargo-targets inherits from package assets. Currently there's no way to set assets for single cargo-target, but only for entire package. WiP, there will be "dev-assets" extra table inherited by main.

Troubleshooting

  • Is some cases (see status) hardware cannot be detected. Try to build cargo-playdate with or without feature usb.

  • Welcome to discussions and issues.


This software is not sponsored or supported by Panic.

Dependencies

~97MB
~2M SLoC