Skip to content

Commit

Permalink
Merge pull request #2835 from Alovchin91/alovchin91/win-arm64
Browse files Browse the repository at this point in the history
Support building rustup for Windows arm64
  • Loading branch information
kinnison authored Sep 4, 2021
2 parents 38f4479 + e2a3e12 commit 52376ff
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 7 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/windows-builds-on-master.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ jobs:
matrix:
target:
- x86_64-pc-windows-msvc
- aarch64-pc-windows-msvc # skip-pr skip-stable
- x86_64-pc-windows-gnu # skip-pr
include:
- target: x86_64-pc-windows-gnu
Expand All @@ -29,6 +30,8 @@ jobs:
- target: i686-pc-windows-gnu
mingwdir: mingw32
mingw: https://ci-mirrors.rust-lang.org/rustc/i686-6.3.0-release-posix-dwarf-rt_v5-rev2.7z
- target: aarch64-pc-windows-msvc # skip-pr skip-stable
skip_tests: yes # skip-pr skip-stable
steps:
- uses: actions/checkout@v2
# v2 defaults to a shallow checkout, but we need at least to the previous tag
Expand Down Expand Up @@ -62,7 +65,7 @@ jobs:
run: |
echo "%USERPROFILE%\.cargo\bin" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8
echo "TARGET=${{ matrix.target }}" | Out-File -Append -FilePath $env:GITHUB_ENV -Encoding utf8
echo "SKIP_TESTS=" | Out-File -Append -FilePath $env:GITHUB_ENV -Encoding utf8
echo "SKIP_TESTS=${{ matrix.skip_tests }}" | Out-File -Append -FilePath $env:GITHUB_ENV -Encoding utf8
- name: Cache cargo registry and git trees
uses: actions/cache@v2
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/windows-builds-on-pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:
run: |
echo "%USERPROFILE%\.cargo\bin" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8
echo "TARGET=${{ matrix.target }}" | Out-File -Append -FilePath $env:GITHUB_ENV -Encoding utf8
echo "SKIP_TESTS=" | Out-File -Append -FilePath $env:GITHUB_ENV -Encoding utf8
echo "SKIP_TESTS=${{ matrix.skip_tests }}" | Out-File -Append -FilePath $env:GITHUB_ENV -Encoding utf8
- name: Cache cargo registry and git trees
uses: actions/cache@v2
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/windows-builds-on-stable.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ jobs:
run: |
echo "%USERPROFILE%\.cargo\bin" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8
echo "TARGET=${{ matrix.target }}" | Out-File -Append -FilePath $env:GITHUB_ENV -Encoding utf8
echo "SKIP_TESTS=" | Out-File -Append -FilePath $env:GITHUB_ENV -Encoding utf8
echo "SKIP_TESTS=${{ matrix.skip_tests }}" | Out-File -Append -FilePath $env:GITHUB_ENV -Encoding utf8
- name: Cache cargo registry and git trees
uses: actions/cache@v2
with:
Expand Down
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions ci/actions-templates/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ system.
| x86_64-pc-windows-gnu | No | One | No | Yes |
| i686-pc-windows-msvc | No | One | No | No |
| i686-pc-windows-gnu | No | One | No | No |
| aarch64-pc-windows-msvc | Yes | Two | No | Yes |

We also have a clippy/shellcheck target which runs on x86_64 linux and is
run in all cases. It does a `cargo fmt` check, a `cargo clippy` check on the
Expand Down
5 changes: 4 additions & 1 deletion ci/actions-templates/windows-builds-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ jobs:
target:
- x86_64-pc-windows-msvc
- i686-pc-windows-msvc # skip-pr skip-master
- aarch64-pc-windows-msvc # skip-pr skip-stable
- x86_64-pc-windows-gnu # skip-pr
- i686-pc-windows-gnu # skip-pr skip-master
include:
Expand All @@ -37,6 +38,8 @@ jobs:
- target: i686-pc-windows-gnu
mingwdir: mingw32
mingw: https://ci-mirrors.rust-lang.org/rustc/i686-6.3.0-release-posix-dwarf-rt_v5-rev2.7z
- target: aarch64-pc-windows-msvc # skip-pr skip-stable
skip_tests: yes # skip-pr skip-stable
steps:
- uses: actions/checkout@v2
# v2 defaults to a shallow checkout, but we need at least to the previous tag
Expand Down Expand Up @@ -70,7 +73,7 @@ jobs:
run: |
echo "%USERPROFILE%\.cargo\bin" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8
echo "TARGET=${{ matrix.target }}" | Out-File -Append -FilePath $env:GITHUB_ENV -Encoding utf8
echo "SKIP_TESTS=" | Out-File -Append -FilePath $env:GITHUB_ENV -Encoding utf8
echo "SKIP_TESTS=${{ matrix.skip_tests }}" | Out-File -Append -FilePath $env:GITHUB_ENV -Encoding utf8
- name: Cache cargo registry and git trees
uses: actions/cache@v2
with:
Expand Down
1 change: 1 addition & 0 deletions ci/run.bash
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ case "$TARGET" in
mips* ) ;;
riscv* ) ;;
s390x* ) ;;
aarch64-pc-windows-msvc ) ;;
# default case, build with rustls enabled
* ) FEATURES+=('--features' 'reqwest-rustls-tls') ;;
esac
Expand Down
2 changes: 1 addition & 1 deletion doc/src/installation/windows.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ tools" and "Windows 10 SDK" option. No additional software installation is
necessary for basic use of the GNU build.

By default `rustup` on Windows configures Rust to target the MSVC ABI, that is
a target triple of either `i686-pc-windows-msvc` or `x86_64-pc-windows-msvc`
a target triple of either `i686-pc-windows-msvc`, `x86_64-pc-windows-msvc`, or `aarch64-pc-windows-msvc`
depending on the CPU architecture of the host Windows OS. The toolchains that
`rustup` chooses to install, unless told otherwise through the [toolchain
specification], will be compiled to run on that target triple host and will
Expand Down
2 changes: 2 additions & 0 deletions src/dist/dist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ impl TargetTriple {
// First detect architecture
const PROCESSOR_ARCHITECTURE_AMD64: u16 = 9;
const PROCESSOR_ARCHITECTURE_INTEL: u16 = 0;
const PROCESSOR_ARCHITECTURE_ARM64: u16 = 12;

let mut sys_info;
unsafe {
Expand All @@ -244,6 +245,7 @@ impl TargetTriple {
let arch = match unsafe { sys_info.u.s() }.wProcessorArchitecture {
PROCESSOR_ARCHITECTURE_AMD64 => "x86_64",
PROCESSOR_ARCHITECTURE_INTEL => "i686",
PROCESSOR_ARCHITECTURE_ARM64 => "aarch64",
_ => return None,
};

Expand Down

0 comments on commit 52376ff

Please sign in to comment.