Skip to content

Building from Source

DoubleGate edited this page Jun 29, 2026 · 1 revision

Building from Source

This guide covers building the RustyNES project across its various platforms.

Prerequisites

  1. Rust Toolchain: RustyNES targets Rust 1.96 (Edition 2024). Install Rust via rustup.
  2. System Dependencies (Linux): If you're building the desktop frontend on Linux, you need wgpu/winit/cpal dependencies:
    # Debian/Ubuntu:
    sudo apt-get install -y libxkbcommon-dev libwayland-dev libxkbcommon-x11-dev libasound2-dev libudev-dev
    # Arch/CachyOS:
    sudo pacman -S --needed libxkbcommon wayland alsa-lib systemd-libs

Standard Desktop Build

To build and run the default desktop application (rustynes-frontend):

# Build the workspace
cargo build --release --workspace

# Run the emulator
cargo run --release -p rustynes-frontend -- path/to/rom.nes

Testing and Quality Gates

RustyNES maintains a strict 100% AccuracyCoin testing bar. Ensure your changes pass all tests before submitting PRs.

# Run unit and integration tests
cargo test --workspace

# Run with test ROM suites (AccuracyCoin/blargg)
cargo test --workspace --features test-roms

# Formatting and linting (CI Gates)
cargo fmt --all --check
cargo clippy --workspace --all-targets -- -D warnings

Libretro Core

To build the RetroArch core (rustynes-libretro):

cd crates/rustynes-libretro
make

The output will be the appropriate shared library for your platform (rustynes_libretro.so, .dylib, or .dll).

WebAssembly (WASM) Build

To build the web frontend, you'll need the wasm32-unknown-unknown target and trunk:

rustup target add wasm32-unknown-unknown
cargo install trunk

Run the dev server:

cd crates/rustynes-frontend/web
trunk serve

Or build for production (creates output in dist/):

cd crates/rustynes-frontend/web
trunk build --release

Maximal Native Build

The full feature aggregates every optional native feature (retroachievements, scripting, script-ipc, hd-pack, debug-hooks, av-record) that is off by default in standard builds.

# Build with all optional features enabled
cargo build --release -p rustynes-frontend --features full

Mobile Builds

For mobile, you'll need Android Studio (for the JNI host in crates/rustynes-android / android/ directory) and/or Xcode (for crates/rustynes-ios / ios/ directory). The core is bridged via rustynes-mobile using UniFFI.

# Example: Adding required targets for Android
rustup target add aarch64-linux-android x86_64-linux-android
cargo install cargo-ndk

Clone this wiki locally