From 5f84c18b394f093ee8e4bb5109d3de2b34932d4c Mon Sep 17 00:00:00 2001 From: Logan McNaughton <848146+loganmc10@users.noreply.github.com> Date: Sun, 12 Jan 2025 18:20:42 +0100 Subject: [PATCH] Build aarch64 for Linux (#129) * linux aarch * more * more * more * more * more * more * more * more * more * more * more --- .cargo/config.toml | 3 +++ .github/workflows/build.yml | 49 ++++++++++++++++++++++++++++++++++--- build.rs | 1 + 3 files changed, 49 insertions(+), 4 deletions(-) diff --git a/.cargo/config.toml b/.cargo/config.toml index 40eddf62..25c2c32c 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -3,3 +3,6 @@ rustflags = ["-C", "target-cpu=x86-64-v3"] [target.'cfg(target_arch = "aarch64")'] rustflags = ["-C", "target-cpu=cortex-a76"] + +[target.aarch64-unknown-linux-gnu] +linker = "aarch64-linux-gnu-gcc" diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 68762750..73e1f271 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,18 +14,59 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - target: [x86_64-unknown-linux-gnu] + target: [x86_64-unknown-linux-gnu, aarch64-unknown-linux-gnu] steps: - uses: actions/checkout@v4 with: submodules: recursive - - name: Install sdl2 headers - run: | - sudo apt -y install libsdl2-dev - uses: actions-rust-lang/setup-rust-toolchain@v1 with: target: ${{ matrix.target }} rustflags: "" + - name: Install SDL2 + if: matrix.target == 'aarch64-unknown-linux-gnu' + run: | + cat < deb822sources + Types: deb + URIs: http://archive.ubuntu.com/ubuntu/ + Suites: noble + Components: main restricted universe + Architectures: amd64 + + Types: deb + URIs: http://security.ubuntu.com/ubuntu/ + Suites: noble-security + Components: main restricted universe + Architectures: amd64 + + Types: deb + URIs: http://archive.ubuntu.com/ubuntu/ + Suites: noble-updates + Components: main restricted universe + Architectures: amd64 + + Types: deb + URIs: http://azure.ports.ubuntu.com/ubuntu-ports/ + Suites: noble + Components: main restricted multiverse universe + Architectures: arm64 + + Types: deb + URIs: http://azure.ports.ubuntu.com/ubuntu-ports/ + Suites: noble-updates + Components: main restricted multiverse universe + Architectures: arm64 + EOF + + sudo mv deb822sources /etc/apt/sources.list.d/ubuntu.sources + sudo dpkg --add-architecture arm64 + sudo apt update + sudo apt -y install libsdl2-dev:arm64 g++-aarch64-linux-gnu + - name: Install SDL2 + if: matrix.target == 'x86_64-unknown-linux-gnu' + run: | + sudo apt update + sudo apt -y install libsdl2-dev - name: Build run: | cargo build --release -v --target=${{ matrix.target }} diff --git a/build.rs b/build.rs index 726ecdb4..5764fa7f 100644 --- a/build.rs +++ b/build.rs @@ -143,6 +143,7 @@ fn main() { .allowlist_function("_mm_subs_epu16") .allowlist_function("_mm_set1_epi32") .blocklist_type("__m128i") + .blocklist_type("int64x2_t") .wrap_static_fns(true) .parse_callbacks(Box::new(bindgen::CargoCallbacks::new())) .generate()