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, 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
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.1-py3-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 016a9eb718a7c859a8bb679bd17e99a6d5e2e0ffdf6bcd6f8bddcc1ab79d6472 |
|
MD5 | a13c71f231b18022424677dd18cea652 |
|
BLAKE2b-256 | e4500cfcffd5b9fcec4c99e6276ddf98640b7186583bcee831823ee3e11e0b20 |
Hashes for cargo_xwin-0.8.1-py3-none-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3b0c4e643ad9538bcae25ac102d9d4fd3aa1432730eb08f5e09bb1bf426be416 |
|
MD5 | ca4d505aa02c3c3abc4e6a90b75f16a0 |
|
BLAKE2b-256 | ca7ee2e956b0a2a99b382ec02451025e5023c98bfeaa084d4ae1ec5723541455 |
Hashes for cargo_xwin-0.8.1-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 63cecc1bcda09912973520fcc4548d5a532c4e13f66e2814dbaf4cc1c11f06cb |
|
MD5 | 03e5c1cf48a034bed0bee3473d772e37 |
|
BLAKE2b-256 | c30c7489b20662ddb395ec83f0bffba5aa9896640d27a79ac01c394198704761 |
Hashes for cargo_xwin-0.8.1-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d56b89cdcf259407db2e5b4817fbe1800e918e61fdd903e93c01d2ba123918b5 |
|
MD5 | 85a8cd98f3180e69b767e473bea79fb3 |
|
BLAKE2b-256 | 15fb88ee745e33073c9c84e3f4a6615501c04ea8e327cffb686b29c1976d8e6f |
Hashes for cargo_xwin-0.8.1-py3-none-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2186bb15b3f0f72d34e566450e8cc1fe886d88cb71db5cc807c8072fa0f3466f |
|
MD5 | cf99633dcef24c84ff14ab51cdde3f3c |
|
BLAKE2b-256 | 204a0d0b2ef5d80265718ea911c7844b3ae999d45644f632ebca077ac0d83e37 |
Hashes for cargo_xwin-0.8.1-py3-none-manylinux_2_5_i686.manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a7f817fb3cc2a75a2b290a7f1b9faee13a6c7d4300285422e1cdda973357da1b |
|
MD5 | 2da43cd9e8b81e4a68b45ff3a2ee90ba |
|
BLAKE2b-256 | 2f0caa6857dfa881e7ee073dff40cd8b967d5efba339f297bbf3559755012d6d |
Hashes for cargo_xwin-0.8.1-py3-none-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | eac3753199904b7a30107f43810313e0f3ac59c0b1c953cf1a6eb832f5022dc9 |
|
MD5 | 2cc28a828eb2d0a517cd8d73fc1e2cda |
|
BLAKE2b-256 | 8fc5da198768858485e31196ca3a94a1da8b23e51df836a2f7073a9a9879ae77 |