overdrivenpotato / rust-psp

Rust on PSP. Panic and allocation support. Access PSP system libraries.
Other
588 stars 31 forks source link

cargo-psp tries to build the .prx and EBOOT.PBP for a non-PSP binary in a workspace #139

Closed Givralix closed 1 year ago

Givralix commented 1 year ago

Context

I have a workspace set up like this:

.
├── Cargo.toml
├── embedded_frontend/  // Graphic rendering with embedded-graphics
├── pc_app/             // PC-only app
├── psp_app/            // PSP-only app
└── src/                // backend library

pc_app and psp_app are binaries while the root crate and embedded_frontend are libraries (both imported by the binary crates).

Cargo.toml workspace:

[workspace]
members = ["pc_app", "embedded_frontend", "psp_app"]

Problem

When trying to compile the PSP app from the psp_app directory with __CARGO_TESTS_ONLY_SRC_ROOT=/path/to/rust/src/ cargo +nightly-2022-06-11 psp --release, I get the error:

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 2, kind: NotFound, message: "No such file or directory" }', cargo-psp/src/fix_imports.rs:27:42

Editing the cargo-psp source to add dbg!(&path.as_ref()); before the panic shows this: [cargo-psp/src/fix_imports.rs:27] &path.as_ref() = "[my workspace path]/target/mipsel-sony-psp/release/pc_app". But the PC app obviously can't be compiled for the PSP, and even if it was, it's not what I'm trying to build here.

In the meantime, I can exclude psp_app from the workspace but this breaks rust-analyzer on psp_app's source files.

I could make a pull request so that cargo-psp doesn't panic if a binary isn't present.