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-previewcomponent viarustup component add llvm-tools-previewor 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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cargo_xwin-0.10.4-py3-none-win_amd64.whl.
File metadata
- Download URL: cargo_xwin-0.10.4-py3-none-win_amd64.whl
- Upload date:
- Size: 2.4 MB
- Tags: Python 3, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/0.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e76116bc3481f9e584e8b21c1d0e08e47b5fc97bedb10628953e62e8db85557a
|
|
| MD5 |
ae8b145eecf3969a7cecad02b4e53a87
|
|
| BLAKE2b-256 |
36d721013ff7fbf475d977953b3364df19919058a60386211963e3b7730205d8
|
File details
Details for the file cargo_xwin-0.10.4-py3-none-win32.whl.
File metadata
- Download URL: cargo_xwin-0.10.4-py3-none-win32.whl
- Upload date:
- Size: 2.2 MB
- Tags: Python 3, Windows x86
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/0.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5971e10f733552f354e12acf6a6edd0f23e2330e746fdd1273beb6b803d2e3f8
|
|
| MD5 |
53a1744c36d5edc7db3c51f96539f6e6
|
|
| BLAKE2b-256 |
dbcf56d239bff1f98ff0d7d62cacafefdb5c34f1e586fee280ab7a515018eea1
|
File details
Details for the file cargo_xwin-0.10.4-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl.
File metadata
- Download URL: cargo_xwin-0.10.4-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
- Upload date:
- Size: 4.0 MB
- Tags: Python 3, manylinux: glibc 2.17+ ARMv7l
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/0.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
45b267f5d800e48bd322afde632120414ec8d03662df81fa7bd0d4ba76c7c000
|
|
| MD5 |
5716e2fdc7206a52eda87fc63f25c05e
|
|
| BLAKE2b-256 |
37082331707eee0cd1f7172b4b3749c343b57c24b226060c64885b970cdc1e3e
|
File details
Details for the file cargo_xwin-0.10.4-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: cargo_xwin-0.10.4-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 4.0 MB
- Tags: Python 3, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/0.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d3515ffe9a1a4a4a0fb219c7cba05a9740daa557e4de71a53c32688250565b8a
|
|
| MD5 |
b827b656b536763b57745dcecbb67860
|
|
| BLAKE2b-256 |
ff51f280d288d4f3f7e2306e20637adf7e0fdc65ebdc4a4443f66a6d7b9a9204
|
File details
Details for the file cargo_xwin-0.10.4-py3-none-manylinux_2_5_x86_64.manylinux1_x86_64.whl.
File metadata
- Download URL: cargo_xwin-0.10.4-py3-none-manylinux_2_5_x86_64.manylinux1_x86_64.whl
- Upload date:
- Size: 4.1 MB
- Tags: Python 3, manylinux: glibc 2.5+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/0.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4625e6d1281b1dd52773e1e073d187a7cbb36bf0d089cdb6787e79423bfd9661
|
|
| MD5 |
13e2edf513cd78feba1eb81143e59916
|
|
| BLAKE2b-256 |
79ff3b1c161648cd333bc4deecddea5f61310b8efce24f72a7b0bc5ea23f4d22
|
File details
Details for the file cargo_xwin-0.10.4-py3-none-manylinux_2_5_i686.manylinux1_i686.whl.
File metadata
- Download URL: cargo_xwin-0.10.4-py3-none-manylinux_2_5_i686.manylinux1_i686.whl
- Upload date:
- Size: 4.2 MB
- Tags: Python 3, manylinux: glibc 2.5+ i686
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/0.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b8217ee3de958c45d513f532a687a3a19357eb1add0c6c4c6ac583facef959aa
|
|
| MD5 |
b01b8acc1c99d44980c6a5094e2a5b4a
|
|
| BLAKE2b-256 |
66cd7b37aad4d6c8cc4c132e021e9aee00650968bf6baec9b9eb82592efa52b2
|
File details
Details for the file cargo_xwin-0.10.4-py3-none-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl.
File metadata
- Download URL: cargo_xwin-0.10.4-py3-none-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
- Upload date:
- Size: 5.4 MB
- Tags: Python 3, macOS 10.9+ universal2 (ARM64, x86-64), macOS 10.9+ x86-64, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/0.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6519e17dc5761a0b178ac0b5d1ea7ec91886d1109ef44eee57e6e13a96933e42
|
|
| MD5 |
457d7f73fc812ef506a7b19848003cf8
|
|
| BLAKE2b-256 |
0d50719f9a52e8d30c843d96d441425ef4d34a1b8082cd1344f37fcb9d4c9425
|