-
Notifications
You must be signed in to change notification settings - Fork 2
57 lines (47 loc) · 1.89 KB
/
Android-cmake.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
name: Android Build
on:
push:
branches:
- master
paths-ignore:
- "README.md"
- ".github/workflows/**"
- ".gitignore"
pull_request:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
env:
ANDROID_NDK_HOME: ${{github.workspace}}/android-ndk/android-ndk-r25b
ANDROID_TOOLCHAIN: ${{github.workspace}}/android-ndk/android-ndk-r25b/toolchains/llvm/prebuilt/linux-x86_64/bin
NDK_URL: "https://dl.google.com/android/repository/android-ndk-r25b-linux.zip"
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: "recursive"
- name: Set clang as the default compiler
run: |
sudo update-alternatives --install /usr/bin/cc cc $(which clang) 100
sudo update-alternatives --install /usr/bin/c++ c++ $(which clang++) 100
sudo update-alternatives --set cc $(which clang)
sudo update-alternatives --set c++ $(which clang++)
- name: Download Android NDK
run: |
mkdir -p "${{github.workspace}}/android-ndk"
cd "${{github.workspace}}/android-ndk"
curl -o ndk.zip ${{ env.NDK_URL }}
unzip ndk.zip
rm ndk.zip
echo "$ANDROID_TOOLCHAIN" >> $GITHUB_PATH
- name: Add Rust targets
run: rustup target add aarch64-linux-android armv7-linux-androideabi x86_64-linux-android i686-linux-android
- name: Install bindgen
run: cargo install cbindgen
- name: Install Ninja
run: sudo apt install ninja-build -y
- name: Configure CMake
run: cmake -S build/Android/ -DANDROID_ABI="arm64-v8a" -B build/Android/Release -DCMAKE_ANDROID_NDK=$ANDROID_NDK -DANDROID_TOOLCHAIN=clang -DCMAKE_BUILD_TYPE=Release -G Ninja
- name: Build project
run: cmake --build build/Android/Release --config Release -j