#gd-native #projects #generate #build-script #godot #directory #resources

build gdnative-project-utils

Utilies for working with godot-rust GDNative projects

5 releases

0.1.4 Feb 4, 2021
0.1.3 Jan 10, 2021
0.1.2 Sep 13, 2020
0.1.1 Jul 8, 2020
0.1.0 Jul 5, 2020

#16 in #gd-native

22 downloads per month

MIT license

21KB
415 lines

GDNative Project Utilities

Automatically creating .gdnlib and .gdns files

This crate autogenerates a .gdnlib file for a crate and .gdns files for all types that derive NativeClass from a cargo build script.

Example

The following code in the build.rs (or any cargo build script) will automatically generate the Godot resources when the Rust code changes.

use gdnative_project_utils::*;

fn main() -> Result<(), Box<dyn std::error::Error>>{
    /// directory to scan for Rust files
    let classes = scan_crate("src")?;

    /// generate files inside the Godot project directory
    Generator::new()
        .godot_project_dir("../")
        .build(classes)?;

    Ok(())
}

License

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you shall be licensed under the MIT license, without any additional terms or conditions.


lib.rs:

Utilities for working with GDNative projects.

This crate can be used in cargo build scripts to automatically generate .gdnlib and .gdns files for the current project.

It currently does this by scanning the project sources for types that derive NativeClass and generates one .gdns file for each type.

Dependencies

~5–14MB
~164K SLoC