Fix non-MSVC builds on Windows and cross-compilation in general #155
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Simple
cfg!(target_* = "...")
doesn't work in build scripts the way itdoes in crate's code, because build scripts are being compiled for the
toolchain's target triple -- not the default-host nor the cargo's
eventual target. Instead, such configuration should be loaded from
provided environment variables at run-time.
While initially trying to fix linkage issues for Windows + MinGW target
(first reported by @stuartZhang in #150), I came to realize in the
process that
cfg!(target_os = ...)
, although being used only for OS Xat this moment, is likely screwed up in the same way (except, who would
ever cross-compile to or from Mac, and why?)
https://doc.rust-lang.org/cargo/reference/environment-variables.html#environment-variables-cargo-sets-for-build-scripts
Fixes #154
My life priorities are seriously questionable, and it almost makes me wonder why did I choose this job in the first place. Now to get some well-deserved rest...