nabijaczleweli / rust-embed-resource

A Cargo build script library to handle compilation and inclusion of Windows resources, in the most resilient fashion imaginable
MIT License
173 stars 29 forks source link

Add support for cross-compilation to windows on linux #13

Closed SonnyX closed 5 years ago

nabijaczleweli commented 5 years ago

Is this available on compile-time (via env!(TARGET)/cfg!(something)/somesuch)?

Doing if let Ok(target) = std::env::var("TARGET") twice kinda (okay, a lot) sucks, especially if SUPPORTED is universally true now

SonnyX commented 5 years ago

Sadly it is not possible to achieve this on compile-time, see: https://github.com/rust-lang/cargo/issues/4423

Although not the prettiest of solutions, it is a valid one none-the-less, polling std::env twice should not have any impact on anyone's performance.

nabijaczleweli commented 5 years ago

Hmm, alright, then, I'll merge this as is, refactor to dedupe, since that's my major concern, and not performance, and I'll ask you to test the refactored version to see if I fucked something up in the process

nabijaczleweli commented 5 years ago

If you could check with the above commit on the master branch, that'd be lovely

SonnyX commented 5 years ago

I've verified the code, this is indeed the way it should be done. I've run tests for linux->linux, and linux->windows builds on the most recent commit. Both work as intended. I cannot test windows->windows, so I assume you will verify that yourself.

Thanks for merging!

nabijaczleweli commented 5 years ago

Dope

Released in v1.3.0