40 releases

new 0.4.7 Apr 24, 2024
0.3.16 Mar 21, 2024
0.3.12 Nov 21, 2023
0.0.0 Jun 26, 2023

#17 in Cargo plugins

Download history 2/week @ 2024-01-12 7/week @ 2024-02-09 12/week @ 2024-02-16 22/week @ 2024-02-23 150/week @ 2024-03-01 31/week @ 2024-03-08 95/week @ 2024-03-15 42/week @ 2024-03-22 291/week @ 2024-03-29 386/week @ 2024-04-05 496/week @ 2024-04-12 323/week @ 2024-04-19

1,496 downloads per month

MIT/Apache

465KB
11K SLoC

Build System for Playdate applications

Cargo-playdate is a cross-platform plugin for cargo that can build programs for Playdate handheld gaming system written in Rust. It also works as standalone tool.

It can build programs written in Rust, manage assets, build package for Playdate and run on sim or 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)*.

* For executable binaries use --no-gcc argument._

Prerequisites

To build cargo-playdate you're need:

  1. Rust nightly toolchain

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

To run on sim or dev with cargo-playdate:

  1. Linux only:
  • libudev, follow [instructions for udev crate][udev-crate-deps].
  1. Windows only:
  • powershell (used as fallback)

Installation

cargo install cargo-playdate
# or
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 are more options for this command, 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 or for dev-targets - there is dev-assets extra table inherited by main.

Troubleshooting

  • On windows in some cases hardware cannot be ejected because of no permissions. Try to give rights and/or build cargo-playdate with feature eject.

  • Welcome to discussions and issues.


This software is not sponsored or supported by Panic.

Dependencies

~91–130MB
~2.5M SLoC