macalimlim / godot-rust-template

A template for godot-rust projects
MIT License
51 stars 22 forks source link

use rustc default target in `make run` #41

Closed paul-marechal closed 3 years ago

paul-marechal commented 3 years ago

Rust seem to make querying the default target painful, but it is possible using rustc --print cfg and some processing.

paul-marechal commented 3 years ago

This is in answer to https://github.com/godot-rust/godot-rust-template/pull/40#issuecomment-813756454 where I mentioned making make run work based on the current running OS.

I honestly don't know what to think. On one hand it should work, but on the other hand I'm not especially fan of the implementation. If that's what it takes to have it cross-platform then so be it, but if anyone has a better idea I'll gladly listen.

ghost commented 3 years ago

Yes, I agree that this does seem a bit fragile. In case any new cfg entries are added, the hard-coded indices can break. What do you think about adding a build-dynamic target that invokes cargo without a --target flag, with the mv command adjusted accordingly, and use that in run instead?

paul-marechal commented 3 years ago

that invokes cargo without a --target flag, with the mv command adjusted accordingly, and use that in run instead?

This will output the shared libraries into target/default, but I couldn't find where to move those files so that Godot would know it has to use those given the current platform?

paul-marechal commented 3 years ago

Closing because with hindsight I realize how fragile this is. Thanks for the comment.