Skip to content

Conversation

@bonzini
Copy link
Collaborator

@bonzini bonzini commented May 29, 2025

Without feature options there is no way for the superproject to reconcile differences between different invocations of dependency(). Until something along the lines of #14639 is completed, this makes it almost impossible to rely on Meson's Cargo interpreter when you have more than one dependency() using Cargo subprojects.

Reintroduce feature options as they were before afd8944 ("cargo: Fix feature resolution", Meson 1.7.0). However, the Cargo interpreter also "complete" the default_options provided by _do_subproject_cargo() with all the features that were enabled via Cargo.toml. This is also useful for the meson/meson.build files, which now have access to the set of enabled features.

Note however that the generated meson.build file is not independent of enabled features, because it still hardcodes the list of dependencies.

@bonzini bonzini added the dependencies:cargo Issues related to using cargo subprojects label May 29, 2025
@bonzini bonzini requested a review from xclaesse May 29, 2025 15:49
@xclaesse
Copy link
Member

My plan was to have a global option on the rust module in the same format as the cargo cli.

@xclaesse
Copy link
Member

@xclaesse
Copy link
Member

@bonzini what do you think about #14663

@bonzini
Copy link
Collaborator Author

bonzini commented May 31, 2025

Yep, looks good. The remaining bit is to introduce parsing of the user's Cargo.toml files as well and handling of more sections like [lints]. I have some code in QEMU that can be integrated in the Cargo interpreter.

EDIT: Hmm, not so good after thinking more about it. Left a lengthy comment there.

Without feature options there is no way for the superproject to reconcile differences
between different invocations of dependency().  Reintroduce options as they were
before afd8944 ("cargo: Fix feature resolution", Meson 1.7.0), but also "complete"
the default_options provided by _do_subproject_cargo() with all the features that
were enabled via Cargo.toml.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
@bonzini bonzini force-pushed the cargo-feature-options-again branch from 4cb1068 to 92c3754 Compare August 24, 2025 21:06
@bonzini bonzini closed this Sep 24, 2025
@bonzini bonzini deleted the cargo-feature-options-again branch October 14, 2025 16:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies:cargo Issues related to using cargo subprojects

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants