Packaging a Desktop App
Ship a runnable binary.
From Debug to Release
Development uses cargo run, which builds an unoptimized debug binary. For distribution you want a release build: cargo build --release.
Release builds enable optimizations and strip debug overhead, producing a far smaller, faster binary under target/release/.
cargo build --release
# binary at target/release/my_appShrinking the Binary
egui apps can be large because they statically link a GPU backend. Trim size with a release profile in Cargo.toml.
Enabling link-time optimization, a single codegen unit, panic-abort, and stripping symbols can cut megabytes off the final executable.
[profile.release]
opt-level = "z"
lto = true
codegen-units = 1
panic = "abort"
strip = trueAll lessons in this course
- Immediate-Mode UI Basics
- Widgets and Layout
- Managing App State
- Packaging a Desktop App