cargo-multivers

![Latest Version] MSRV CI status Apache 2.0 OR MIT licensed

Cargo subcommand to build multiple versions of the same binary, each with a different CPU features set, merged into a single portable optimized binary.

Overview

cargo-multivers builds multiple versions of the binary of a Rust package. 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). 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 the duplicates. Each version built is then compressed. Finally, it builds a runner that contains all the compressed versions. For instance, when building for the target x86_64-pc-windows-msvc, 37 different versions will be built, compressed, and merged into a single portable binary.

When executed, the runner uncompresses and executes the build that matches the CPU features of the host.

Intended Use

While cargo-multivers could be used to build any kind of binary from a Rust package, it is mostly intended for the following use cases:

Installation

bash cargo install --locked cargo-multivers

Usage

bash cargo +nightly multivers

Related Work

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.