deltaphc / raylib-rs

Rust bindings for raylib
Other
751 stars 134 forks source link

Web version builds into libraylib.a #161

Open InfiniteCoder01 opened 1 year ago

InfiniteCoder01 commented 1 year ago

Hello!

I'm using raylib-rs v3.7.0.

In raylib-sys/build.rs there is this:

// on web copy libraylib.bc to libraylib.a
if platform == Platform::Web {
    std::fs::copy(dst_lib.join("libraylib.bc"), dst_lib.join("libraylib.a"))
        .expect("filed to create wasm library");
}

But for some reason, on my system (6.1.31-2-MANJARO (64-bit)), with command cargo build --target=wasm32-unknown-emscripten it builds into "libraylib.a".

I suggest doing this:

// on web copy libraylib.bc to libraylib.a (if exists)
if platform == Platform::Web {
    if dst_lib.join("libraylib.bc").exists() {
        std::fs::copy(dst_lib.join("libraylib.bc"), dst_lib.join("libraylib.a"))
            .expect("filed to create wasm library");
    }
}