Cross compile Cargo project to Windows MSVC target with ease
Project description
cargo-xwin
formerly cargo-xwinbuild
🚀 Help me to become a full-time open-source developer by sponsoring me on GitHub
Cross compile Cargo project to Windows msvc target with ease.
By using this software you are consented to accept the license at https://go.microsoft.com/fwlink/?LinkId=2086102
Prerequisite
- For pure Rust project, no prerequisites needed.
- For C/C++ dependencies, install clang.
- For assembly dependencies, install
llvm-tools-preview
component viarustup component add llvm-tools-preview
or install llvm.
Installation
cargo install cargo-xwin
You can also install it using pip:
pip install cargo-xwin
We also provide a Docker image which has wine pre-installed in addition to cargo-xwin and Rust, for example to build for x86_64 Windows:
docker run --rm -it -v $(pwd):/io -w /io messense/cargo-xwin \
cargo xwin build --release --target x86_64-pc-windows-msvc
Usage
- Install Rust Windows msvc target via rustup, for example,
rustup target add x86_64-pc-windows-msvc
- Run
cargo xwin build
, for example,cargo xwin build --target x86_64-pc-windows-msvc
Run tests with wine
With wine installed, you can run tests with the cargo xwin test
command,
for example, cargo xwin test --target x86_64-pc-windows-msvc
Customization
The Microsoft CRT and Windows SDK can be customized using the following environment variables or CLI options.
Environment Variable | CLI option | Description |
---|---|---|
XWIN_ARCH |
--xwin-arch |
The architectures to include, defaults to x86_64,aarch64 , possible values: x86, x86_64, aarch, aarch64 |
XWIN_VARIANT |
--xwin-variant |
The variants to include, defaults to desktop , possible values: desktop, onecore, spectre |
XWIN_VERSION |
--xwin-version |
The version to retrieve, defaults to 16, can either be a major version of 15 or 16, or a <major>.<minor> version |
XWIN_CACHE_DIR |
--xwin-cache-dir |
xwin cache directory to put CRT and SDK files |
CMake Support
Some Rust crates use the cmake crate to build C/C++ dependencies, cargo-xwin will generate a CMake toolchain file automatically to make cross compilation work out of the box.
ninja is required to enable CMake support.
License
This work is released under the MIT license. A copy of the license is provided in the LICENSE file.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Hashes for cargo_xwin-0.11.0-py3-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ca1871cbf0d56cebe03c457f4b6463b98089f069af9f6d5f496795132aa83ae5 |
|
MD5 | 5ee8a9274f816d8b95396aa0f792e47a |
|
BLAKE2b-256 | 791b5f4e8cdaaabe4febae9a94df83daabf2dffea4fda5b21ae60ddb76719559 |
Hashes for cargo_xwin-0.11.0-py3-none-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 025a994736d19acb25c8c8e33232643fdab2ddc1cc8610685e2a0f6a72437ace |
|
MD5 | 7a86b3f74e4536a58417115184c76e80 |
|
BLAKE2b-256 | 0768a923679333c9fbc9ca234913e1ec57d8cf38d31776fbd0e31a10b0452cfd |
Hashes for cargo_xwin-0.11.0-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 27a14566a53160706b9b3edf5eb00f5f2344117ad733ce6487f3b9bc74df7049 |
|
MD5 | bf14ecb259b3ce93aece6b7a82f06803 |
|
BLAKE2b-256 | dbd66196984229ce1d5e5ef59d1410f91b329197ad944debdc24e526c8eab7fa |
Hashes for cargo_xwin-0.11.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7d534e05feec5bc39a456b24262efc2e9a036e142745f89b4537d0098cf5fbaa |
|
MD5 | 8584846f68ddc083598dad07556e7060 |
|
BLAKE2b-256 | 66562635efdafc8f0769f70a685d486c1f702ec8db1b1cc7450bd68895ff0771 |
Hashes for cargo_xwin-0.11.0-py3-none-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3baca2aee559149e291f9893f087a4be14929727ac93dca873ffccc1c172549f |
|
MD5 | cb65319b979374f8a937d6ed54d817bd |
|
BLAKE2b-256 | 9ce2b505ba3c88e8e029cddee59d6d2bb521ec63ca01637f8a939a7b85e1d09f |
Hashes for cargo_xwin-0.11.0-py3-none-manylinux_2_5_i686.manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e51ce6c2075750091115136fb4cebb93f72a939a846c33ab4827e52fe43b916b |
|
MD5 | 26c7d8f7568b1f2ceb677d82447e0c5e |
|
BLAKE2b-256 | ab30594a1ea5b991b7f85858874e33e2df2bbe8d0654cb5c94d9c397196d3b67 |
Hashes for cargo_xwin-0.11.0-py3-none-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8f595bafcba1ec63f8050d8e7b5177d4a70bf3ffcc6a430f70dccaee6ee89463 |
|
MD5 | 122cb7aea7c72a1d4c4510cd049a8f01 |
|
BLAKE2b-256 | 222b97bed06c61375f3a697232c6d965ce99ebf5feb26454c3d9ebf30e2e35eb |