Skip to content

Support building for Android on aarch64 macOS hosts #846

Support building for Android on aarch64 macOS hosts

Support building for Android on aarch64 macOS hosts #846

Workflow file for this run

on:
push:
branches:
- main
tags:
- "*"
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
name: CI
jobs:
lint:
name: Lint
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
with:
submodules: true
- uses: dtolnay/rust-toolchain@stable
with:
components: "clippy, rustfmt"
- uses: Swatinem/rust-cache@v2
# make sure all code has been formatted with rustfmt
- run: cargo fmt -- --check --color always
# run clippy to verify we have no warnings
- run: cargo clippy --all-features --all-targets -- -D warnings
cargo-deny:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: EmbarkStudios/cargo-deny-action@v1
test_debug:
name: Test (Debug)
strategy:
matrix:
include:
- os: ubuntu-22.04
target: x86_64-unknown-linux-gnu
- os: ubuntu-22.04
target: aarch64-unknown-linux-gnu
container: ghcr.io/cross-rs/aarch64-unknown-linux-gnu:edge
- os: windows-2022
target: x86_64-pc-windows-msvc
- os: macOS-12
target: x86_64-apple-darwin
runs-on: ${{ matrix.os }}
container: ${{ matrix.container }}
env:
TARGET_CXX: "${{ matrix.target == 'aarch64-unknown-linux-gnu' && 'g++' || 'clang++' }}"
steps:
- uses: actions/checkout@v3
with:
submodules: true
- uses: dtolnay/rust-toolchain@stable
with:
target: ${{ matrix.target }}
- uses: Swatinem/rust-cache@v2
- run: cargo fetch --target ${{ matrix.target }}
- name: test - no features
run: cargo test --workspace --exclude pxbind
- name: test - all features
run: cargo test --all-features --workspace --exclude pxbind
- name: ball all features
run: cargo run --example ball --all-features
- name: ball no features
run: cargo run --example ball
- name: ball just structgen
run: cargo run -p physx --example ball_physx --features structgen
build_debug_aarch64_apple_darwin:
name: Build aarch64-apple-darwin
strategy:
matrix:
include:
- os: macOS-12
target: aarch64-apple-darwin
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
with:
submodules: true
- uses: dtolnay/rust-toolchain@stable
with:
target: ${{ matrix.target }}
- uses: Swatinem/rust-cache@v2
- run: cargo fetch --target ${{ matrix.target }}
- name: build
run: cargo build -p physx
package:
name: Package
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
with:
submodules: true
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- run: cargo package --manifest-path ./physx-sys/Cargo.toml
build_android_release:
name: Build (Release) (aarch64-linux-android)
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Set up NDK 21.4.7075529
run: |
ANDROID_ROOT=/usr/local/lib/android
ANDROID_SDK_ROOT=${ANDROID_ROOT}/sdk
ANDROID_NDK_ROOT=${ANDROID_SDK_ROOT}/ndk-bundle
SDKMANAGER=${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin/sdkmanager
echo "y" | $SDKMANAGER "ndk;21.4.7075529"
ln -sfn ${ANDROID_SDK_ROOT}/ndk/21.4.7075529 ${ANDROID_NDK_ROOT}
echo "ANDROID_NDK_HOME=${ANDROID_NDK_ROOT}" >> $GITHUB_ENV
- uses: actions/checkout@v3
with:
submodules: true
- uses: dtolnay/rust-toolchain@stable
with:
target: aarch64-linux-android
- uses: Swatinem/rust-cache@v2
- run: cargo fetch --target aarch64-linux-android --manifest-path physx/Cargo.toml
- name: build - no features
env:
LD_aarch64_linux_android: ${{env.ANDROID_NDK_HOME }}/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android-ld
CC_aarch64_linux_android: ${{env.ANDROID_NDK_HOME }}/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android21-clang
CXX_aarch64_linux_android: ${{env.ANDROID_NDK_HOME }}/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android21-clang++
AR_aarch64_linux_android: ${{env.ANDROID_NDK_HOME }}/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-ar
run: cargo build --target aarch64-linux-android --release -p physx