diff options
Diffstat (limited to 'docs/markdown')
| -rw-r--r-- | docs/markdown/Wrap-dependency-system-manual.md | 21 | ||||
| -rw-r--r-- | docs/markdown/snippets/cargo_features.md | 14 |
2 files changed, 14 insertions, 21 deletions
diff --git a/docs/markdown/Wrap-dependency-system-manual.md b/docs/markdown/Wrap-dependency-system-manual.md index d84e4aa18..c1652c1c3 100644 --- a/docs/markdown/Wrap-dependency-system-manual.md +++ b/docs/markdown/Wrap-dependency-system-manual.md @@ -354,27 +354,6 @@ method = cargo dependency_names = foo-bar-0.1-rs ``` -Cargo features are exposed as Meson boolean options, with the `feature-` prefix. -For example the `default` feature is named `feature-default` and can be set from -the command line with `-Dfoo-1-rs:feature-default=false`. When a cargo subproject -depends on another cargo subproject, it will automatically enable features it -needs using the `dependency('foo-1-rs', default_options: ...)` mechanism. However, -unlike Cargo, the set of enabled features is not managed globally. Let's assume -the main project depends on `foo-1-rs` and `bar-1-rs`, and they both depend on -`common-1-rs`. The main project will first look up `foo-1-rs` which itself will -configure `common-rs` with a set of features. Later, when `bar-1-rs` does a lookup -for `common-1-rs` it has already been configured and the set of features cannot be -changed. If `bar-1-rs` wants extra features from `common-1-rs`, Meson will error out. -It is currently the responsibility of the main project to resolve those -issues by enabling extra features on each subproject: -```meson -project(..., - default_options: { - 'common-1-rs:feature-something': true, - }, -) -``` - In addition, if the file `meson/meson.build` exists, Meson will call `subdir('meson')` where the project can add manual logic that would usually be part of `build.rs`. Some naming conventions need to be respected: diff --git a/docs/markdown/snippets/cargo_features.md b/docs/markdown/snippets/cargo_features.md new file mode 100644 index 000000000..26f1bff95 --- /dev/null +++ b/docs/markdown/snippets/cargo_features.md @@ -0,0 +1,14 @@ +## Cargo features are resolved globally + +When configuring a Cargo dependency, Meson will now resolve its complete +dependency tree and feature set before generating the subproject AST. +This solves many cases of Cargo subprojects being configured with missing +features that the main project had to enable by hand using e.g. +`default_options: ['foo-rs:feature-default=true']`. + +Note that there could still be issues in the case there are multiple Cargo +entry points. That happens if the main Meson project makes multiple `dependency()` +calls for different Cargo crates that have common dependencies. + +Breaks: This change removes per feature Meson options that were previously +possible to set as shown above or from command line `-Dfoo-rs:feature-foo=true`. |
