| Crates.io | cargo-godot-lib |
| lib.rs | cargo-godot-lib |
| version | 0.1.3 |
| created_at | 2026-01-04 21:37:09.562137+00 |
| updated_at | 2026-01-12 06:15:43.447984+00 |
| description | A library to run Godot from a Cargo run script |
| homepage | https://github.com/dragonaxe/cargo-godot-lib |
| repository | https://github.com/dragonaxe/cargo-godot-lib |
| max_upload_size | |
| id | 2022523 |
| size | 42,952 |
A Rust library for launching Godot from a Cargo run script, specifically designed for GDExtension development.
cargo-godot-lib provides similar functionality to the cargo-godot executable but as a library. This allows you to include it as a dependency in your project, ensuring all developers have access to the same runner without requiring a separate global installation via cargo install.
.gdextension Generation: Supports customized Cargo target directory (e.g. target-dir = ".cache/cargo/target").godot --import --headless if the .godot folder is missing, eliminating the need to manually open the editor on a fresh clone.godot or GODOT), the system PATH, or common installation paths.--debug flag by default for better output in your terminal.GodotRunner for details).Example project structure:
project/
├── Cargo.toml (workspace)
├── godot/
│ └── project.godot
└── rust/
├── Cargo.toml (package: example)
├── run_godot.rs
└── src/
└── main.rs
The main interface of cargo-godot-lib is the GodotRunner struct.
This struct follows a builder pattern and can be configured to suit your needs.
See the following project/rust/run_godot.rs example:
fn main() {
let runner = cargo_godot_lib::GodotRunner::create(
env!("CARGO_PKG_NAME"),
&std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("../godot"),
);
if let Err(e) = runner.execute() {
eprintln!("{e}");
std::process::exit(1);
}
}
Add cargo-godot-lib to your dependencies and define the binary in project/rust/Cargo.toml:
[package]
name = "example"
version = "0.1.0"
edition = "2024"
[[bin]]
name = "run-godot"
path = "run_godot.rs"
[dependencies]
# ... your other dependencies (e.g. godot-rust)
cargo-godot-lib = "<latest_version_goes_here>"
Now any developer can launch the Godot project and build the extension in one command:
cargo run --package example
This project is licensed under the MIT License.