Add aarch64 and riscv64 cross compilation targets (#1334)

This commit is contained in:
yubiuser 2024-09-14 18:46:14 +02:00 committed by GitHub
parent 8fab3d66e2
commit 0be490f58d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -199,7 +199,7 @@ jobs:
- run: cargo check --no-default-features - run: cargo check --no-default-features
- run: cargo check - run: cargo check
test-cross-arm: test-cross-linux:
name: cross +${{ matrix.toolchain }} build ${{ matrix.target }} name: cross +${{ matrix.toolchain }} build ${{ matrix.target }}
needs: clippy needs: clippy
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
@ -208,7 +208,10 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
os: [ubuntu-latest] os: [ubuntu-latest]
target: [armv7-unknown-linux-gnueabihf] target:
- armv7-unknown-linux-gnueabihf
- aarch64-unknown-linux-gnu
- riscv64gc-unknown-linux-gnu
toolchain: toolchain:
- "1.74" # MSRV (Minimum supported rust version) - "1.74" # MSRV (Minimum supported rust version)
- stable - stable
@ -242,6 +245,12 @@ jobs:
if [ ${{ matrix.target }} = "armv7-unknown-linux-gnueabihf" ]; then if [ ${{ matrix.target }} = "armv7-unknown-linux-gnueabihf" ]; then
sudo apt-get install -y gcc-arm-linux-gnueabihf sudo apt-get install -y gcc-arm-linux-gnueabihf
fi fi
if [ ${{ matrix.target }} = "aarch64-unknown-linux-gnu" ]; then
sudo apt-get install -y gcc-aarch64-linux-gnu
fi
if [ ${{ matrix.target }} = "riscv64gc-unknown-linux-gnu" ]; then
sudo apt-get install -y gcc-riscv64-linux-gnu
fi
- name: Set target link compiler - name: Set target link compiler
run: | run: |
@ -252,6 +261,12 @@ jobs:
if [ ${{ matrix.target }} = "armv7-unknown-linux-gnueabihf" ]; then if [ ${{ matrix.target }} = "armv7-unknown-linux-gnueabihf" ]; then
echo "CARGO_TARGET_${target}_LINKER=arm-linux-gnueabihf-gcc" >> $GITHUB_ENV echo "CARGO_TARGET_${target}_LINKER=arm-linux-gnueabihf-gcc" >> $GITHUB_ENV
fi fi
if [ ${{ matrix.target }} = "aarch64-unknown-linux-gnu" ]; then
echo "CARGO_TARGET_${target}_LINKER=aarch64-linux-gnu-gcc" >> $GITHUB_ENV
fi
if [ ${{ matrix.target }} = "riscv64gc-unknown-linux-gnu" ]; then
echo "CARGO_TARGET_${target}_LINKER=riscv64-linux-gnu-gcc" >> $GITHUB_ENV
fi
- name: Build - name: Build
run: cargo build --verbose --target ${{ matrix.target }} --no-default-features run: cargo build --verbose --target ${{ matrix.target }} --no-default-features