Skip to content

Allow cross-compiling outside of build.rs #242

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

madsmtm
Copy link
Contributor

@madsmtm madsmtm commented Mar 24, 2025

Reliance on CARGO_CFG_TARGET_OS/CARGO_CFG_TARGET_ARCH was introduced in #158, but these are not available when outside build.rs scripts. Instead, we should try to determine CMAKE_SYSTEM_NAME and CMAKE_SYSTEM_PROCESSOR based on the target triple.

In cc-rs, we do this by parsing the target triple, though I suspect that to be overkill for cmake-rs' purposes, so I've tried to keep it simpler.
It's doable for CMAKE_SYSTEM_NAME but kinda difficult for CMAKE_SYSTEM_PROCESSOR, because the values expected that aren't really documented, so it's hard to know if we emit it correctly? In any case, I've written it in a way that the user can override CMAKE_SYSTEM_PROCESSOR if necessary.

Fixes #228.
bootstrap currently has to work around this in rust-lang/rust#138784.

madsmtm added 2 commits March 24, 2025 15:14
Do not expect CARGO_CFG_TARGET_OS/CARGO_CFG_TARGET_ARCH to always be
available, and instead try to determine this information based on the
rustc target tuple.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Latest versions break rust-lang bootstrap
1 participant