-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Allow specifying target-dependent build.rs scripts #4932
Comments
Why can't you conditionally compile the contents of the build script? |
The The goal is that the build script example below would not depend on // #[$BUILD_cfg(unix)]
extern crate cc;
fn main() { ... }
... A lot of the time Does that explain the issue clearly enough? NB: I’m using |
Ah right, that makes sense. One option could be for cargo to set equivalent cfgs for the target - something like |
Another good reason to have target-dependent build-scripts: currently use of build scripts will force compilation of a dependency that's used during |
* x11 shell keyboard mapping * allow deref_nullptr in tests * [CI] install libxkbcommon for Docs * More keys for x11 * More keys for gtk * cache looked up mods names and avoid as *mut i8 * Apply suggestions from code review * Move keycodes to a separate file * allow non_upper_case_globals in keycodes.rs * using cfg(target_os) in build scripts is *wrong* see <rust-lang/cargo#4932> * UnsafeCell is not needed UnsafeCell is used to provide `*mut T` through `&T` but we already have `*mut T` * Update CHANGELOG
I met this issue when writing a build.rs and .cargo/config.toml for a project cross-compiling from x86_64 linux to aarch64 android. The reason why I need target-dependable build.rs is: // build.rs
println!("cargo:rustc-link-search=native=platform/specific/lib/path");
println!("cargo:rustc-link-lib=static=some_aarch64_lib"); which means I want to link different libs by platforms in build.rs in project level. However, .cargo/config.toml only supports sub-module level over-write according to my research. |
Currently it is possible to specify something like following in
Cargo.toml
:however it is not feasible to use this functionality, because you cannot conditionally
extern use
crates or specify per-target build.rs scripts (i.e. the following does not work):The text was updated successfully, but these errors were encountered: