Skip to content
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

Build Scripts ignore target cfg #35

Closed
RinLovesYou opened this issue Jan 4, 2023 · 2 comments
Closed

Build Scripts ignore target cfg #35

RinLovesYou opened this issue Jan 4, 2023 · 2 comments

Comments

@RinLovesYou
Copy link

RinLovesYou commented Jan 4, 2023

Hi there! Want to just preface this by saying thank you for making this tool, it's been a great help!

It seems that build scripts will ignore target os, when building for windows, on linux

fn main() {
    #[cfg(target_os = "windows")]
    {
        println!("cargo:warning=Linking Exports File..");
        use std::path::Path;
        let lib_path = Path::new("deps").join("Exports.def");
        let absolute_path = std::fs::canonicalize(&lib_path).unwrap();
        println!(
            "cargo:rustc-cdylib-link-arg=/DEF:{}",
            absolute_path.display()
        );
    }
}

building this with cargo xwin build --target x86_64-pc-windows-msvc on linux, will result in no output, and no linking of the definition file. if i remove the target_os attribute, linking succeeds. Obviously this is not good if we're not compiling for windows, as it would require a manual change to the build.rs each time.

@messense
Copy link
Member

messense commented Jan 4, 2023

You are doing it wrong, see Byron/trash-rs#39 (comment)

@messense messense closed this as not planned Won't fix, can't repro, duplicate, stale Jan 4, 2023
@messense
Copy link
Member

messense commented Jan 6, 2023

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

No branches or pull requests

2 participants