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
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.8.3-py3-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 624b0e0fe5095a1fb67ed119dd1ccb9db8c24168a12b3ccb71bc0ae9bda4bf07 |
|
MD5 | 9a87f1656d96ef2ca07ad36a7c8d9f5b |
|
BLAKE2b-256 | cb787da707ac8967277e30f2cf5c08ed98cf7894c870aecdca084233a782580e |
Hashes for cargo_xwin-0.8.3-py3-none-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 16c1d42c07da357fc535189617e231b776434f161674f4607c68cf88cb2946e2 |
|
MD5 | 7f96e3e03e5763b9e77f17867cf33f98 |
|
BLAKE2b-256 | d6ba26934f2e23403d11461739877cfd546095d124177124cf79b8db4d976f6b |
Hashes for cargo_xwin-0.8.3-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0e9be8e9507b04186a613acc39ff3419f7efc5951091782b35a22b851cb39a0b |
|
MD5 | ddb32727a210a9b6f0a07e813c360e34 |
|
BLAKE2b-256 | d6f1b52e732be9e276eb6c9f7d0747695a5ec15f3967c8ccab446ea7ac031401 |
Hashes for cargo_xwin-0.8.3-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d5b74ccef3af58a66516f5cc17d772fe0a8b5ae30c9827c8d3e4ff91e143802f |
|
MD5 | 0f422143136bf55ee2220c582a362f25 |
|
BLAKE2b-256 | 4b2b819aa6be64b99838e4b244b6df8d0d5c9ed0926b527ae7722a1b1a1e6fc5 |
Hashes for cargo_xwin-0.8.3-py3-none-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 702574d7b1ec7e107b34b97f3a080e80d5e0713541331c758d896619f5a87a57 |
|
MD5 | a38e3340c0fbce7d2d2be2826df64aad |
|
BLAKE2b-256 | 02ba603dbc4947d0a0c3e362cc31fa5d78e2c16821c966f83493ff772e8f779e |
Hashes for cargo_xwin-0.8.3-py3-none-manylinux_2_5_i686.manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 361cfcdc08d28db7e3cb5b2a7e79503cbd518edce52fb1f25147c5c6bd91e581 |
|
MD5 | 0c8b2c473f093102354428874ec176e1 |
|
BLAKE2b-256 | f4399539d6aaf4ef507731dcc2859384cc22a8a550c487a907bf453e078a1374 |
Hashes for cargo_xwin-0.8.3-py3-none-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1db68c85a63fc7989c4a4f734470a80dab1ca3dd1a9c617a1ce93e6d0148cda5 |
|
MD5 | 4232e28e97ee62a461c48b0dc5ef389d |
|
BLAKE2b-256 | 71c30e38d8980764eea49a1a5d006b4352fc730e01387008a494f947cd5d0dc1 |