40 releases
new 0.4.7 | Apr 24, 2024 |
---|---|
0.3.16 | Mar 21, 2024 |
0.3.12 | Nov 21, 2023 |
0.0.0 |
|
#17 in Cargo plugins
1,496 downloads per month
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:
- Rust nightly toolchain
To build programs using cargo-playdate
you need:
- Rust nightly toolchain
- Playdate SDK
- Ensure that env var
PLAYDATE_SDK_PATH
points to the SDK root
- Ensure that env var
- Follow the official documentation
- Ensure that
arm-none-eabi-gcc
orgcc-arm-none-eabi
in yourPATH
- Ensure that
To run on sim or dev with cargo-playdate
:
- Linux only:
libudev
, follow [instructions for udev crate][udev-crate-deps].
- 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"
. 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.
Configuration
There is no configuration other then inherited by cargo and some special environment variables.
CARGO_PLAYDATE_LOG
working same way asCARGO_LOG
or defaultRUST_LOG
. AlsoCARGO_PLAYDATE_LOG_STYLE
PLAYDATE_SDK_PATH
path to the SDK rootARM_GCC_PATH
path to thearm-none-eabi-gcc
executable.
Execute cargo playdate -h
for more details, or with --help
for further more.
Limitations
- Global crate-level attributes like
crate_type
andcrate_name
doesn't supported, e.g:
#![crate_name = "Game"]
#![crate_type = "lib"]
- Cargo-targets such as
bin
andexample
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"
- 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 isdev-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 featureeject
. -
Welcome to discussions and issues.
This software is not sponsored or supported by Panic.
Dependencies
~91–130MB
~2.5M SLoC