Skip to content
New issue

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

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

Already on GitHub? # to your account

Added arbitrary flag support to try_expand() #640

Merged
merged 3 commits into from
Dec 13, 2021

Conversation

x87-va
Copy link
Contributor

@x87-va x87-va commented Nov 24, 2021

It's needed to pass macOS specific flags. For example: -F/Library/Frameworks.

@alexcrichton
Copy link
Member

As-is this is passing flags for ar, not cc, so I don't think this may be what you're intending?

@x87-va
Copy link
Contributor Author

x87-va commented Nov 27, 2021

From documentation for ar_flag: "Add an arbitrary flag to the invocation of the compiler". For example: I need to expand some macros for framework located in /Library/Frameworks:

    let src = "expando.c";
    let mut gcc = cc::Build::new();
    gcc.ar_flag("-F/Library/Frameworks");
    let expanded = gcc.file(src).try_expand().expect("Expand");

@alexcrichton
Copy link
Member

I believe that's a copy/paste error on the ar_flag method, that only goes to the ar invocation, not the compiler itself.

@x87-va
Copy link
Contributor Author

x87-va commented Dec 6, 2021

Ok, I've fixed it.

@alexcrichton
Copy link
Member

Thanks for the doc update, but I don't think that the other changes are necessary here. The contents of self.flags should already be part of the command invocation of try_get_compiler.

@x87-va
Copy link
Contributor Author

x87-va commented Dec 13, 2021

Ok, I checked this. It's really unnecessary changes.

@alexcrichton
Copy link
Member

Thanks!

@alexcrichton alexcrichton merged commit 4ce8275 into rust-lang:main Dec 13, 2021
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants