Skip to content

Commit 6836ce9

Browse files
README: mention that we can use package.metadata to select CPUs
1 parent 8418dde commit 6836ce9

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

README.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,20 @@ Cargo subcommand to build multiple versions of the same binary, each with a diff
1111

1212
`cargo-multivers` builds multiple versions of the binary of a Rust package.
1313
Each version is built with a set of CPU features (e.g., `+cmpxchg16b,+fxsr,+sse,+sse2,+sse3`) from a CPU (e.g., `ivybridge`) supported by the target (e.g., `x86_64-pc-windows-msvc`).
14-
It does not build the powerset of the CPU features, but only a subset: from the list of CPU known to `rustc` for a given target, it fetches each set of CPU features and filters out
14+
15+
By default, it lists the CPUs known to `rustc` for a given target, then it fetches each set of CPU features and filters out
1516
the duplicates.
17+
You can also add a section to your `Cargo.toml` to set the allowed list of CPUs for your package.
18+
For example, for `x86_64` you could add:
19+
20+
```toml
21+
[package.metadata.multivers.x86_64]
22+
cpus = ["generic", "alderlake", "skylake", "sandybridge", "ivybridge"]
23+
```
24+
1625
After building the different versions, it computes a hash of each version and it filters out the duplicates.
1726
Finally, it builds a runner that embeds one version compressed (the source) and the others as compressed binary patches to the source.
18-
For instance, when building for the target `x86_64-pc-windows-msvc`, 37 different versions
27+
For instance, when building for the target `x86_64-pc-windows-msvc`, by default 37 different versions
1928
will be built, filtered, compressed, and merged into a single portable binary.
2029

2130
When executed, the runner uncompresses and executes the version that matches the CPU features

0 commit comments

Comments
 (0)