diff --git a/.github/workflows/check-full.yaml b/.github/workflows/check-full.yaml index 6b9bbc4..552f035 100644 --- a/.github/workflows/check-full.yaml +++ b/.github/workflows/check-full.yaml @@ -16,20 +16,22 @@ jobs: fail-fast: false matrix: config: - - {os: windows-latest, r: 'release', rust: 'stable-msvc'} - - {os: macOS-latest, r: 'release', rust: 'stable' } - - {os: macos-15-intel, r: 'release', rust: 'stable' } - - {os: ubuntu-latest, r: 'release', rust: 'stable' } - - {os: ubuntu-latest, r: 'devel', rust: 'stable' } - - {os: ubuntu-latest, r: 'release', rust: 'nightly' } + - { os: "windows-latest", r: "release", rust: "stable-msvc" } + - { os: "windows-11-arm", r: "release", rust: "stable-msvc", rust_target: "aarch64-pc-windows-gnullvm"} + - { os: "macOS-latest", r: "release", rust: "stable" } + - { os: "macos-15-intel", r: "release", rust: "stable" } + - { os: "ubuntu-latest", r: "release", rust: "stable" } + - { os: "ubuntu-latest", r: "devel", rust: "stable" } + - { os: "ubuntu-latest", r: "release", rust: "nightly" } steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@v7 - name: Set up Rust uses: dtolnay/rust-toolchain@master with: toolchain: ${{ matrix.config.rust }} + targets: ${{ matrix.config.rust_target }} # - name: Run cargo test # run: cargo test --manifest-path ./src/rust/Cargo.toml @@ -49,8 +51,8 @@ jobs: - uses: r-lib/actions/check-r-package@v2 env: - MAKEFLAGS: -j2 # cf. https://github.com/yutannihilation/string2path/pull/149 + MAKEFLAGS: -j2 # cf. https://github.com/yutannihilation/string2path/pull/149 - name: debug run: cat ./check/*.Rcheck/00install.out - if: ${{ always() }} \ No newline at end of file + if: ${{ always() }} diff --git a/NEWS.md b/NEWS.md index 0502209..c29bba6 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,7 @@ # string2path (development version) +* Support ARM64 Windows (#212). + # string2path 0.3.1 * Fix Intel macOS build (#209). diff --git a/configure.win b/configure.win index c410d52..01f6978 100755 --- a/configure.win +++ b/configure.win @@ -4,6 +4,9 @@ BEFORE_CARGO_BUILD='' # Check the Rust installation, and abort if not available "${R_HOME}/bin${R_ARCH_BIN}/Rscript.exe" "./tools/configure.R" +# choose the appropriate target +TARGET="$("${R_HOME}/bin${R_ARCH_BIN}/Rscript" "tools/rustarch.R")" + ret=$? if [ $ret -ne 0 ]; then @@ -30,6 +33,7 @@ else fi sed \ + -e "s|@TARGET@|${TARGET}|" \ -e "s|@BEFORE_CARGO_BUILD@|${BEFORE_CARGO_BUILD}|" \ -e "s|@VENDORING@|${VENDORING}|" \ -e "s|@OFFLINE_OPTION@|${OFFLINE_OPTION}|" \ diff --git a/src/Makevars.win.in b/src/Makevars.win.in index b7add1b..9ae460f 100644 --- a/src/Makevars.win.in +++ b/src/Makevars.win.in @@ -1,4 +1,4 @@ -TARGET = x86_64-pc-windows-gnu +TARGET = @TARGET@ # Rtools42 doesn't have the linker in the location that cargo expects, so we # need to overwrite it via configuration. diff --git a/tools/rustarch.R b/tools/rustarch.R new file mode 100644 index 0000000..d9f01f0 --- /dev/null +++ b/tools/rustarch.R @@ -0,0 +1,11 @@ +# The original file is in the hellorust pacakge by Jeroen Ooms, which is under the MIT license. +# cf. https://github.com/r-rust/hellorust/blob/master/tools/rustarch.R +arch <- if(grepl("aarch", R.version$platform)){ + "aarch64-pc-windows-gnullvm" +} else if(grepl("clang", Sys.getenv('R_COMPILED_BY'))){ + "x86_64-pc-windows-gnullvm" +} else { + "x86_64-pc-windows-gnu" +} + +cat(arch)