Closed SonnyX closed 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.
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
If you could check with the above commit on the master
branch, that'd be lovely
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!
Dope
Released in v1.3.0
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 ifSUPPORTED
is universallytrue
now