Crates.io | cargo-playdate |
lib.rs | cargo-playdate |
version | 0.5.5 |
source | src |
created_at | 2023-06-26 22:02:03.182666 |
updated_at | 2024-08-12 14:59:53.457231 |
description | Build tool for neat yellow console. |
homepage | https://github.com/boozook/playdate |
repository | https://github.com/boozook/playdate.git |
max_upload_size | |
id | 900703 |
size | 442,917 |
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 needed to set up alternative linking final binary.
MacOS:
~/Developer/PlaydateSDK
)export PLAYDATE_SDK_PATH="$HOME/Developer/PlaydateSDK"
brew install cmake
rustup toolchain install nightly
Ubuntu Linux:
export PLAYDATE_SDK_PATH="/path/to/PlaydateSDK-2.x.x/"
sudo apt-get install cmake
rustup toolchain install nightly
sudo apt-get install gcc-arm-none-eabi
sudo apt-get install libudev-dev
Windows:
~/Documents/PlaydateSDK
)sysdm.cpl
PLAYDATE_SDK_PATH
C:\Users\username\Documents\PlaydateSDK
rustup toolchain install nightly
windows+r, run: sysdm.cpl
Advanced Tab -> Environment Variables.
Find Path
and click Edit
Click New
and add C:\Program Files\CMake\bin
Click New
and add C:\Program Files (x86)\Arm GNU Toolchain arm-none-eabi\13.2 Rel1\bin
See also: Inside Playdate with C: Prerequisites
cargo +nightly install cargo-playdate
cargo +nightly playdate --version
Or install to use bleeding edge bits from a local git clone:
cargo +nightly install cargo-playdate --git=https://github.com/boozook/playdate.git
Generate new project using new
or init
command.
mkdir -p ~/code/pd-hello/
cd ~/code/pd-hello/
cargo +nightly playdate init --lib --full-metadata --deps="playdate"
cargo +nightly playdate run
Note, there are more options for this command, e.g.
--deps="sys:git, controls:git"
. Runcargo 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.
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 rootARM_GCC_PATH
path to the arm-none-eabi-gcc
executable.Execute cargo playdate -h
for more details, or with --help
for further more.
cargo-playdate
supports cargo's auto-targets such as bin
and example
, but only for binary executable targets ignoring #![crate_type = "lib"]
attribute. So if you want to build example
-target as lib
, that needed for run in simulator, you could declare it in the package manifest like this:
[[example]]
name = "demo"
crate-type = ["dylib", "staticlib"]
path = "examples/demo.rs"
Otherwise example
will be built as bin
and runnable on device only.
In future versions it may be fixed with adding support of rustc
command like it does cargo rustc
to set --crate-type
.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 and for dev-targets - there is dev-assets
extra table inherited by package assets.
On any OS in case of a restricted environment 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.