-
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
Passing more flags to rustc #544
Comments
As I mentioned in #60, it's unlikely that
Also as mentioned in #60, the plan is have fine-grained subcommands which you can script yourself. The idea is that |
I'm unclear on the subcommands. Last comment in #60 mentions no arbitrary flags in the manifest/
(or whatever syntax will be for subcommands) will be fine. Am I right? If so, I'm perfectly happy with subcommands and closing this issue. As for the flags. No, |
By subcommands, I mean where the cargo commands themselves are all built on a common set of primitive commands. You wouldn't personally use the subcommands that often as they'll be fairly restrictive and may not do much, but they're available to you whenever you need to configure your workflow. So, for example, Does that make sense? |
Yes, it does. |
#595 is an example of a subcommand which may help here, I'm curious about opinions on it! |
Slightly related to this is the issue of finding system libraries. As an example, my libcurl require a |
I'm curious about this as well since I'd like to sometimes pass the -g option to run the application through gdb. |
Cargo passes If you wanted to include debugging symbols in a release build, you could set |
I'd like to control optimization in
|
FYI, |
It seems that cargo either passes Personally, I'd really like my release build to have both It seems that I cannot do this with the current cargo manifest format, but if I could control which options to pass to rustc, then I could easily do it. |
Unless something like this is implemented, starting in beta it will probably become impossible to use Cargo to compile a program with -mwindows, at least without using the Currently you can use the #[link_args] attribute for this, but I'm pretty sure it'll stop working in beta (since it's behind a feature gate). Without Cargo support for link_args, you'll have to run |
@nstoddard using |
@alexcrichton could you expand on this? I would like to have different features compile with different --cfg options enabled, but it doesn't seem possible now |
@deontologician for each activated feature |
@alexcrichton you'd still want to pass other kinds of cfgs to e.g. disable logging with |
Ah yes good point, features certainly don't cover all the use cases, just some :) |
We have a few additional scenarios from Servo:
Note that those are off the top of my head, just things we've wanted to do in the last couple of weeks. I would much rather see you prohibit the specific rustc flags that you don't want people to pass through rather than one-by-one enable subsets from the vast array of flags that do not jeapordize your platform-independent compilation goals. |
cc me |
and me |
I've always thought of features as a subset of cfg, not the same thing. There could be some cfg options that aren't declared as features in a Cargo.toml file. |
Interested in this. |
Should this be closed now that #595 is implemented? |
Why can't cargo just have an option for setting the subsystem and providing resource files, if uninterested in allowing arbitrary linker flags to be passed? Is there an ideological preference against platform-specific options in Cargo.toml?
Currently, setting the subsystem is usually attained by creating a custom script which wraps the linker, and then telling cargo to use that linker with Cargo could do something like this instead:
|
Yeah there's a number of locations where that kind of configuration can be located, and some of those actually seem like they'd be more applicable as crate attributes rather than Cargo options (e.g. you'd want them even if you were running |
This was referred in https://www.reddit.com/r/rust/comments/40l6t8/windowed_applications_with_rust/ |
@gsingh93 @alexcrichton as I understand it #595 implements the |
@dhardy oh to do that you can do:
|
@alexcrichton this still doesn't run tests though, and due to the hashes in the binary names finding the binaries to run is not trivial. Is there an easy solution to build and run all integration tests? |
Well for that you may be able to use |
This is kind of a followup to #60. I've been eyeing cargo integration with Visual Studio and after asking on IRC I want to propose more flags for inclusion in Cargo.toml:
--cfg
, it's a commonly used rustc feature--C
or at least--C link-args
. It's required for passing -mwindows (compile as a Windows Desktop app, no console output) and for passing resources (icons, executable manifests) to the gcc.-W
,-A
,-D
,-F
, four lint control flags, projects will want to set stricter/more relaxed baselines across code-base.The text was updated successfully, but these errors were encountered: