diff --git a/.github/workflows/cd.yaml b/.github/workflows/cd.yaml index d73d04bd..c3de3dea 100644 --- a/.github/workflows/cd.yaml +++ b/.github/workflows/cd.yaml @@ -27,6 +27,9 @@ jobs: target: aarch64-unknown-linux-gnu - os: macos-latest target: aarch64-apple-darwin + - os: windows-11-arm + target: aarch64-pc-windows-msvc + binary-postfix: ".exe" steps: - name: Checkout repository uses: actions/checkout@v7 @@ -47,10 +50,10 @@ jobs: if: matrix.job.target != 'aarch64-unknown-linux-gnu' run: cargo build --release --target ${{ matrix.job.target }} - name: Compress (Unix) - if: ${{ matrix.job.os != 'windows-latest' }} + if: runner.os != 'Windows' run: zip -j espup-${{ matrix.job.target }}.zip target/${{ matrix.job.target }}/release/espup${{ matrix.job.binary-postfix }} - name: Compress (Windows) - if: ${{ matrix.job.os == 'windows-latest' }} + if: runner.os == 'Windows' run: Compress-Archive target/${{ matrix.job.target }}/release/espup${{ matrix.job.binary-postfix }} espup-${{ matrix.job.target }}.zip - name: Upload compressed artifact uses: svenstaro/upload-release-action@v2 diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index f9de03f0..3e7004ac 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -35,6 +35,8 @@ jobs: os-name: linux - os: windows-latest os-name: windows + - os: windows-11-arm + os-name: windows-arm action: - command: check - command: test diff --git a/CHANGELOG.md b/CHANGELOG.md index e5a18d97..4954cded 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] ### Added +- Add support for `aarch64-pc-windows-msvc` hosts (#601) ### Fixed - Fix `File exists (os error 17)` when `~/.espup/esp-clang` is a dangling symlink (#581) diff --git a/README.md b/README.md index fec11f00..0d4f2da7 100644 --- a/README.md +++ b/README.md @@ -67,6 +67,10 @@ It's also possible to use [cargo-binstall](https://github.com/cargo-bins/cargo-b ```powershell Invoke-WebRequest 'https://github.com/esp-rs/espup/releases/latest/download/espup-x86_64-pc-windows-msvc.exe' -OutFile .\espup.exe ``` +- Windows MSVC aarch64 + ```powershell + Invoke-WebRequest 'https://github.com/esp-rs/espup/releases/latest/download/espup-aarch64-pc-windows-msvc.exe' -OutFile .\espup.exe + ``` @@ -145,7 +149,7 @@ Options: -d, --default-host Target triple of the host - [possible values: x86_64-unknown-linux-gnu, aarch64-unknown-linux-gnu, x86_64-pc-windows-msvc, x86_64-pc-windows-gnu, x86_64-apple-darwin, aarch64-apple-darwin] + [possible values: x86_64-unknown-linux-gnu, aarch64-unknown-linux-gnu, x86_64-pc-windows-msvc, aarch64-pc-windows-msvc, x86_64-pc-windows-gnu, x86_64-apple-darwin, aarch64-apple-darwin] -r, --esp-riscv-gcc Install Espressif RISC-V toolchain built with croostool-ng @@ -225,7 +229,7 @@ Options: -d, --default-host Target triple of the host - [possible values: x86_64-unknown-linux-gnu, aarch64-unknown-linux-gnu, x86_64-pc-windows-msvc, x86_64-pc-windows-gnu, x86_64-apple-darwin, aarch64-apple-darwin] + [possible values: x86_64-unknown-linux-gnu, aarch64-unknown-linux-gnu, x86_64-pc-windows-msvc, aarch64-pc-windows-msvc, x86_64-pc-windows-gnu, x86_64-apple-darwin, aarch64-apple-darwin] -f, --export-file Relative or full path for the export file that will be generated. If no path is provided, the file will be generated under home directory (https://docs.rs/dirs/latest/dirs/fn.home_dir.html) diff --git a/src/cli.rs b/src/cli.rs index 30402ad0..f4decc45 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -18,7 +18,7 @@ pub struct CompletionsOpts { #[derive(Debug, Parser)] pub struct InstallOpts { /// Target triple of the host. - #[arg(short = 'd', long, value_parser = ["x86_64-unknown-linux-gnu", "aarch64-unknown-linux-gnu", "x86_64-pc-windows-msvc", "x86_64-pc-windows-gnu" , "x86_64-apple-darwin" , "aarch64-apple-darwin"])] + #[arg(short = 'd', long, value_parser = ["x86_64-unknown-linux-gnu", "aarch64-unknown-linux-gnu", "x86_64-pc-windows-msvc", "aarch64-pc-windows-msvc", "x86_64-pc-windows-gnu" , "x86_64-apple-darwin" , "aarch64-apple-darwin"])] pub default_host: Option, /// Install Espressif RISC-V toolchain built with croostool-ng /// diff --git a/src/host_triple.rs b/src/host_triple.rs index 99440676..28630e3b 100644 --- a/src/host_triple.rs +++ b/src/host_triple.rs @@ -18,6 +18,9 @@ pub enum HostTriple { /// 64-bit MSVC #[strum(serialize = "x86_64-pc-windows-msvc")] X86_64PcWindowsMsvc, + /// ARM64 MSVC + #[strum(serialize = "aarch64-pc-windows-msvc")] + Aarch64PcWindowsMsvc, /// 64-bit MinGW #[strum(serialize = "x86_64-pc-windows-gnu")] X86_64PcWindowsGnu, @@ -58,6 +61,10 @@ mod tests { get_host_triple(Some("x86_64-pc-windows-msvc".to_string())), Ok(HostTriple::X86_64PcWindowsMsvc) )); + assert!(matches!( + get_host_triple(Some("aarch64-pc-windows-msvc".to_string())), + Ok(HostTriple::Aarch64PcWindowsMsvc) + )); assert!(matches!( get_host_triple(Some("x86_64-pc-windows-gnu".to_string())), Ok(HostTriple::X86_64PcWindowsGnu) @@ -89,6 +96,11 @@ mod tests { get_host_triple(None), Ok(HostTriple::X86_64PcWindowsMsvc) )); + #[cfg(all(target_os = "windows", target_arch = "aarch64"))] + assert!(matches!( + get_host_triple(None), + Ok(HostTriple::Aarch64PcWindowsMsvc) + )); #[cfg(all(target_os = "windows", target_arch = "x86_64", target_env = "gnu"))] assert!(matches!( get_host_triple(None), diff --git a/src/toolchain/gcc.rs b/src/toolchain/gcc.rs index 48ff4ce3..3db24fd5 100644 --- a/src/toolchain/gcc.rs +++ b/src/toolchain/gcc.rs @@ -209,13 +209,16 @@ fn get_arch(host_triple: &HostTriple) -> Result<&str> { HostTriple::X86_64PcWindowsMsvc | HostTriple::X86_64PcWindowsGnu => { Ok("x86_64-w64-mingw32") } + HostTriple::Aarch64PcWindowsMsvc => Ok("aarch64-w64-mingw32"), } } /// Gets the artifact extension based on the host triple. fn get_artifact_extension(host_triple: &HostTriple) -> &str { match host_triple { - HostTriple::X86_64PcWindowsMsvc | HostTriple::X86_64PcWindowsGnu => "zip", + HostTriple::X86_64PcWindowsMsvc + | HostTriple::X86_64PcWindowsGnu + | HostTriple::Aarch64PcWindowsMsvc => "zip", _ => "tar.xz", } } diff --git a/src/toolchain/llvm.rs b/src/toolchain/llvm.rs index 88f56b50..79ca3e5c 100644 --- a/src/toolchain/llvm.rs +++ b/src/toolchain/llvm.rs @@ -99,9 +99,10 @@ impl Llvm { HostTriple::X86_64AppleDarwin => "x86_64-apple-darwin", HostTriple::X86_64UnknownLinuxGnu => "x86_64-linux-gnu", HostTriple::Aarch64UnknownLinuxGnu => "aarch64-linux-gnu", - HostTriple::X86_64PcWindowsMsvc | HostTriple::X86_64PcWindowsGnu => { - "x86_64-w64-mingw32" - } + // There is no ARM64 Windows build; ARM64 Windows runs the x86_64 one emulated. + HostTriple::X86_64PcWindowsMsvc + | HostTriple::X86_64PcWindowsGnu + | HostTriple::Aarch64PcWindowsMsvc => "x86_64-w64-mingw32", }; arch.to_string() } else { @@ -110,7 +111,9 @@ impl Llvm { HostTriple::X86_64AppleDarwin => "macos", HostTriple::X86_64UnknownLinuxGnu => "linux-amd64", HostTriple::Aarch64UnknownLinuxGnu => "linux-arm64", - HostTriple::X86_64PcWindowsMsvc | HostTriple::X86_64PcWindowsGnu => "win64", + HostTriple::X86_64PcWindowsMsvc + | HostTriple::X86_64PcWindowsGnu + | HostTriple::Aarch64PcWindowsMsvc => "win64", }; arch.to_string() } diff --git a/src/toolchain/rust.rs b/src/toolchain/rust.rs index 9a429e54..9cca8be1 100644 --- a/src/toolchain/rust.rs +++ b/src/toolchain/rust.rs @@ -440,7 +440,9 @@ impl Installable for RiscVTarget { /// Gets the artifact extension based on the host architecture. fn get_artifact_extension(host_triple: &HostTriple) -> &str { match host_triple { - HostTriple::X86_64PcWindowsMsvc | HostTriple::X86_64PcWindowsGnu => "zip", + HostTriple::X86_64PcWindowsMsvc + | HostTriple::X86_64PcWindowsGnu + | HostTriple::Aarch64PcWindowsMsvc => "zip", _ => "tar.xz", } }