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 (On macOS run
brew install llvm
and you're good to go). - For assembly dependencies, install
llvm-tools-preview
component viarustup component add llvm-tools-preview
or install llvm.
Installation
cargo install --locked 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 |
XWIN_INCLUDE_DEBUG_LIBS |
--xwin-include-debug-libs |
Whether or not to include debug libs in installation (default false). |
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
File details
Details for the file cargo_xwin-0.17.3-py3-none-win_amd64.whl
.
File metadata
- Download URL: cargo_xwin-0.17.3-py3-none-win_amd64.whl
- Upload date:
- Size: 3.6 MB
- Tags: Python 3, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.7.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4c2496e49e9fcd471c69c72113f31ca0ea8c11c0be3b89c2597fb68bf196ce5a |
|
MD5 | 3b0ae1d92020e802d49ffcb7631a7586 |
|
BLAKE2b-256 | 574420ca715bcf2d5142d6eac2d6aff341e4e77d6e7710c027a974af380538dc |
File details
Details for the file cargo_xwin-0.17.3-py3-none-win32.whl
.
File metadata
- Download URL: cargo_xwin-0.17.3-py3-none-win32.whl
- Upload date:
- Size: 3.1 MB
- Tags: Python 3, Windows x86
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.7.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fad1831cae03f6a771db4b31d344fb87f0ca5b2899a72f8af91acc42b8b8a0af |
|
MD5 | 49d395bd1a75971f4edc2d33f3cbe7a5 |
|
BLAKE2b-256 | 05e1728465a73963beb9e0019bdf6321f8be30b20a2a6c4e8caf53d3c7a5fe4a |
File details
Details for the file cargo_xwin-0.17.3-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
.
File metadata
- Download URL: cargo_xwin-0.17.3-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/1.7.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0f65c1dc6a307c700d3bf54a66dfab3ae758f5ce6863293b5d470cf158ae53f4 |
|
MD5 | fafa7b895253190f6bbe1a22405e81f2 |
|
BLAKE2b-256 | ac97f8df0015aa53c9c072b4a5d43e4002813327518f371a640bfe3cd9ca7d92 |
File details
Details for the file cargo_xwin-0.17.3-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
.
File metadata
- Download URL: cargo_xwin-0.17.3-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 4.3 MB
- Tags: Python 3, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.7.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 86c8800205c5c4db9ae6b5714d318067ca5c1180e94acfc92bdfd26450352134 |
|
MD5 | d165b83942f0278e5c8250c4e4d8e53f |
|
BLAKE2b-256 | 759174cfb3c33ada76b5a35589eec4e7e4385366031004acd5f192efb2ee394a |
File details
Details for the file cargo_xwin-0.17.3-py3-none-manylinux_2_5_x86_64.manylinux1_x86_64.whl
.
File metadata
- Download URL: cargo_xwin-0.17.3-py3-none-manylinux_2_5_x86_64.manylinux1_x86_64.whl
- Upload date:
- Size: 4.5 MB
- Tags: Python 3, manylinux: glibc 2.5+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.7.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7f0cce07ac4efd4c148d9b77a083679351ea1a8d228fbe117e2bac93ae68d532 |
|
MD5 | 4ab5be7e2de1d095fa6e804f2f42b454 |
|
BLAKE2b-256 | 17974dcac19befdc7d3f9faaeee8e9af714d3a379d5e9b0c90a6950a24e11ba4 |
File details
Details for the file cargo_xwin-0.17.3-py3-none-manylinux_2_5_i686.manylinux1_i686.whl
.
File metadata
- Download URL: cargo_xwin-0.17.3-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/1.7.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3f246cb10177a0e5993abbc75139aecfb394642e4d1b4d58d19a5e606e252d8b |
|
MD5 | 79218318e8c70fa8c82499ec424ce496 |
|
BLAKE2b-256 | 3ee019bef868b98e596e86dafd021fd77194aff75cadafa740222b55c2230cbb |
File details
Details for the file cargo_xwin-0.17.3-py3-none-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
.
File metadata
- Download URL: cargo_xwin-0.17.3-py3-none-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
- Upload date:
- Size: 7.9 MB
- Tags: Python 3, macOS 10.12+ universal2 (ARM64, x86-64), macOS 10.12+ x86-64, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.7.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6813b7747c12b490303fda35aaaba96d4dedbd644459d288e0807f8a7a3929b3 |
|
MD5 | 44918683eff2db0f0b48e8bf76188266 |
|
BLAKE2b-256 | d59959aa0fb1f5094d27e1eca5d2bb69e6a8e1fb960c6099a3d99163e1a362bf |