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

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

Hello World

Generate new project using new or init command.

bash 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.

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: ```rust

    ![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: toml [[example]] name = "demo" crate-type = ["dylib", "staticlib"] path = "examples/demo.rs"

  2. 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


This software is not sponsored or supported by Panic.