rust3ds / ctru-rs

Rust wrapper for libctru
https://rust3ds.github.io/ctru-rs/
Other
116 stars 17 forks source link

Question about handling of memory layout #184

Closed SeleDreams closed 3 months ago

SeleDreams commented 3 months ago

Hi, This issue is more about questions on how ctru-rs works. I am working on a wrapper of libnds for the DS and I would like to be able to do something like ctru-rs that can simply be included as a dependency to build for ds with just the .json of the target.

The DS and 3DS both work with specs files that define .ld, .mem files that are included during the build process. I tried to link them with println!("cargo:rustc-link-arg=-specs={}/sys/crts/ds_arm9.specs",&blocksds_path); for the DS but i found out that build.rs link args don't extend to parent crates, as such this wouldn't work when used as a dependency.

How does ctru-rs handle this type of things ? as from what I know it depends on devkitpro which does rely on specs files as well

Meziu commented 3 months ago

These are things that cannot be handled by a simple build script, since they override compilation on a compiler/linker level.

You can specify them as additional linker arguments when creating a target triple .json file or rustc-target configuration.

Here's where we specify these requirements.

Admittedly, this is the only direct reference of devkitPro specific configurations we make in that target triple, but we have also put the toolchain as a requirement in the target docs, so it's fine.