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.10.1-py3-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3deeb2488da2840ea935e1dc856c733a0ea0be7a639c0c23142f9684e4953e07 |
|
MD5 | 094f445459bd76ddf507383dfbdb6c75 |
|
BLAKE2b-256 | da3643dd9849ce9e0f10fce7289ef4c38d97a74ef3afa6b36056624f660d9834 |
Hashes for cargo_xwin-0.10.1-py3-none-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3bc8e30a67219e2095557785ddae95f04a4f6fae2c859f486048e6aa028a23f8 |
|
MD5 | 86b50436244aabe2fd52c910ae30b16b |
|
BLAKE2b-256 | f129e81cd74a3ec0fc4d4163cc6a2784cfcff94450dfc0bd637ccbc75df29015 |
Hashes for cargo_xwin-0.10.1-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7fb18619549e5317a755e450e8d11a67fa1b95cde2d8fc5ceb58f9f8e53f23e5 |
|
MD5 | d4f509a611776fde7b16c9a60237b1ef |
|
BLAKE2b-256 | 6e10dc6d0faf019b406adfb6e9442d69bb50fcae745848c652aa7d35b6a8de0d |
Hashes for cargo_xwin-0.10.1-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ae2dff0f2fc668b55fcba901952d5bf3c36c9b0ad08c661b1ac5eb6f7ea56e95 |
|
MD5 | 5bfba4ff6f7b6c71bc1e6526c813a1a6 |
|
BLAKE2b-256 | c5eb650405872decb4e9c0873dd0c0017b76846d9a5c3b58623208226f8cc7ab |
Hashes for cargo_xwin-0.10.1-py3-none-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b0560e6916badb66fb21461412325dac69370142283144df33532273bb001fa3 |
|
MD5 | 06263dc1a8ede3558b6bf8887870d202 |
|
BLAKE2b-256 | 41a5114f3987df80fa610fc2075b0735fb587de29d4b9dbc427d94099f409d43 |
Hashes for cargo_xwin-0.10.1-py3-none-manylinux_2_5_i686.manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ad5e4f83d66563726e655a295abb09a15ec561fb012f5e4332bb0a80d7e34223 |
|
MD5 | 36bf8b4b84fecd8b1e4efcce21911757 |
|
BLAKE2b-256 | 5c2818bab9c12a1455f16bc71688b231674a8327755d93654fa1035435e782ac |
Hashes for cargo_xwin-0.10.1-py3-none-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1977a95997db298a0b21531556c5d316c162007571343943221ec16cbed62112 |
|
MD5 | 880b3521c7d72b8d3a28273d1ec6a120 |
|
BLAKE2b-256 | 7ed9366bb6f1fdf557712c0ad28ff2283fd106eb0138d55a91b9fd33562918c7 |