Cross compile Cargo project to Windows MSVC target with ease
Project description
cargo-xwin
formerly cargo-xwinbuild
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, it needs
llvm-lib
, install llvm.
On macOS, run brew install llvm
then you are good to go.
Installation
cargo install cargo-xwin
You can also install it using pip:
pip install cargo-xwin
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.8.0-py3-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e9ed9681c4b61fde4bf9b64be8fb3a49e4922a09a2776d839e73314b274a5b43 |
|
MD5 | 4940179b630b3e16f15deffa7f624e34 |
|
BLAKE2b-256 | ea261f78619f77375b5c3234744e1809bd329fc728439bc74bf96770931977b5 |
Hashes for cargo_xwin-0.8.0-py3-none-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a567945efdb89b988cbd39648b16b2a8ea9040532b4fc21f60ce07d1deb0bd81 |
|
MD5 | 661ae775dc6f84c427605038949ebb73 |
|
BLAKE2b-256 | fa587506a9660b0b739b7ddecfc2974654b29f83376e3b9dbab5705f08f4a8c1 |
Hashes for cargo_xwin-0.8.0-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 210233b8453ba2ee3f52f8ce22ac45faff99611d7eb91e2ac4fd71bb48cf90b3 |
|
MD5 | a00cd4c35f36cdc3b6874f408f811c6f |
|
BLAKE2b-256 | da4f4b706d27468d9976522e0c195834717f11d6eae157d9e764de2c37afe138 |
Hashes for cargo_xwin-0.8.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6483601d5c85e9f65cfcba485169fa73964a9f460e394b60814b7561f63e0ffa |
|
MD5 | c9e3e93a535daa61e7b802fd841fa3a5 |
|
BLAKE2b-256 | 4caaad33401d5b73a37c4e9d3ad6e3f849bff220c0c11444fd8feb40fc8936dc |
Hashes for cargo_xwin-0.8.0-py3-none-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 123f145e03d83eb2b3619158d414991e792b8c2d9c2d81d8437a72e2e25ebb06 |
|
MD5 | d8bbc533ff373d9b780a9b062417092f |
|
BLAKE2b-256 | ef27ab83158662d6c96368264acdaca5b8fc4c37be200a99eb198538f2df4dbf |
Hashes for cargo_xwin-0.8.0-py3-none-manylinux_2_5_i686.manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | adec210fe780a9b3fb926f04ebc3c878c5f59a1c5146a829d6e76d1d8914873b |
|
MD5 | b443ea07b01f0f769e322f57cd44162b |
|
BLAKE2b-256 | df51c9d058b4273d59504b1b12f199b98d40f6e3f9cfaf070fb12d3b5fccdc25 |
Hashes for cargo_xwin-0.8.0-py3-none-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0d9abf1f22b593c12f98fea67ee507fe2eec3c3a93429a2950ce1ca0a5d2bd61 |
|
MD5 | 10816fdb76b14ab2c2c1e6cbf482cbfb |
|
BLAKE2b-256 | 8546e4c67ef9af570d14065d88a0ad45b7bb4066af2f13fb1791cbf8c623ba58 |