-
Notifications
You must be signed in to change notification settings - Fork 4.2k
158 lines (149 loc) · 5.45 KB
/
android.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
name: android
on:
push:
branches: [master]
paths:
- '.github/workflows/android.yml'
- 'CMakeLists.txt'
- 'cmake/**'
- 'src/*'
- 'src/layer/*'
- 'src/layer/arm/**'
- 'src/layer/riscv/**'
- 'src/layer/x86/**'
- 'src/layer/vulkan/**'
pull_request:
branches: [master]
paths:
- '.github/workflows/android.yml'
- 'CMakeLists.txt'
- 'cmake/**'
- 'src/*'
- 'src/layer/*'
- 'src/layer/arm/**'
- 'src/layer/riscv/**'
- 'src/layer/x86/**'
- 'src/layer/vulkan/**'
concurrency:
group: android-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
env:
NCNN_CMAKE_OPTIONS: |
-DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_LATEST_HOME/build/cmake/android.toolchain.cmake \
-DANDROID_PLATFORM=android-21 \
-DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON \
-DCMAKE_INSTALL_PREFIX=install \
-DCMAKE_BUILD_TYPE=Release \
-DNCNN_VULKAN=ON \
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: armeabi-v7a
run: |
mkdir build-armeabi-v7a && cd build-armeabi-v7a
cmake ${{ env.NCNN_CMAKE_OPTIONS }} -DANDROID_ABI="armeabi-v7a" -DANDROID_ARM_NEON=ON ..
cmake --build . -j $(nproc)
- name: arm64-v8a
run: |
mkdir build-arm64-v8a && cd build-arm64-v8a
cmake ${{ env.NCNN_CMAKE_OPTIONS }} -DANDROID_ABI="arm64-v8a" ..
cmake --build . -j $(nproc)
- name: x86
run: |
mkdir build-x86 && cd build-x86
cmake ${{ env.NCNN_CMAKE_OPTIONS }} -DANDROID_ABI="x86" ..
cmake --build . -j $(nproc)
- name: x86_64
run: |
mkdir build-x86_64 && cd build-x86_64
cmake ${{ env.NCNN_CMAKE_OPTIONS }} -DANDROID_ABI="x86_64" ..
cmake --build . -j $(nproc)
- name: riscv64
run: |
mkdir build-riscv64 && cd build-riscv64
cmake ${{ env.NCNN_CMAKE_OPTIONS }} -DANDROID_ABI="riscv64" ..
cmake --build . -j $(nproc)
- name: armeabi-v7a-shared
run: |
mkdir build-armeabi-v7a-shared && cd build-armeabi-v7a-shared
cmake ${{ env.NCNN_CMAKE_OPTIONS }} -DANDROID_ABI="armeabi-v7a" -DANDROID_ARM_NEON=ON -DNCNN_SHARED_LIB=ON ..
cmake --build . -j $(nproc)
- name: arm64-v8a-shared
run: |
mkdir build-arm64-v8a-shared && cd build-arm64-v8a-shared
cmake ${{ env.NCNN_CMAKE_OPTIONS }} -DANDROID_ABI="arm64-v8a" -DNCNN_SHARED_LIB=ON ..
cmake --build . -j $(nproc)
- name: x86-shared
run: |
mkdir build-x86-shared && cd build-x86-shared
cmake ${{ env.NCNN_CMAKE_OPTIONS }} -DANDROID_ABI="x86" -DNCNN_SHARED_LIB=ON ..
cmake --build . -j $(nproc)
- name: x86_64-shared
run: |
mkdir build-x86_64-shared && cd build-x86_64-shared
cmake ${{ env.NCNN_CMAKE_OPTIONS }} -DANDROID_ABI="x86_64" -DNCNN_SHARED_LIB=ON ..
cmake --build . -j $(nproc)
- name: riscv64-shared
run: |
mkdir build-riscv64-shared && cd build-riscv64-shared
cmake ${{ env.NCNN_CMAKE_OPTIONS }} -DANDROID_ABI="riscv64" -DNCNN_SHARED_LIB=ON ..
cmake --build . -j $(nproc)
ndk-r16b:
runs-on: ubuntu-latest
env:
NCNN_CMAKE_OPTIONS: |
-DCMAKE_TOOLCHAIN_FILE=$GITHUB_WORKSPACE/android-ndk-r16b/build/cmake/android.toolchain.cmake \
-DANDROID_PLATFORM=android-21 \
-DCMAKE_INSTALL_PREFIX=install \
-DCMAKE_BUILD_TYPE=Release \
-DNCNN_VULKAN=ON \
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: ndk-r16b
env:
DEBIAN_FRONTEND: noninteractive
run: |
pushd /usr/lib/x86_64-linux-gnu/
sudo ln -s libncurses.so.6 libncurses.so.5
sudo ln -s libtinfo.so.6 libtinfo.so.5
popd
wget -q https://dl.google.com/android/repository/android-ndk-r16b-linux-x86_64.zip -O $GITHUB_WORKSPACE/android-ndk-r16b-linux-x86_64.zip
cd $GITHUB_WORKSPACE && unzip -q android-ndk-r16b-linux-x86_64.zip
- name: armeabi-v7a
run: |
mkdir build-armeabi-v7a && cd build-armeabi-v7a
cmake ${{ env.NCNN_CMAKE_OPTIONS }} -DANDROID_ABI="armeabi-v7a" -DANDROID_ARM_NEON=ON ..
cmake --build . -j $(nproc)
- name: armeabi-v7a-no-neon
run: |
mkdir build-armeabi-v7a-no-neon && cd build-armeabi-v7a-no-neon
cmake ${{ env.NCNN_CMAKE_OPTIONS }} -DANDROID_ABI="armeabi-v7a" -DANDROID_ARM_NEON=OFF ..
cmake --build . -j $(nproc)
- name: arm64-v8a
run: |
mkdir build-arm64-v8a && cd build-arm64-v8a
cmake ${{ env.NCNN_CMAKE_OPTIONS }} -DANDROID_ABI="arm64-v8a" ..
cmake --build . -j $(nproc)
- name: armeabi-v7a-shared
run: |
mkdir build-armeabi-v7a-shared && cd build-armeabi-v7a-shared
cmake ${{ env.NCNN_CMAKE_OPTIONS }} -DANDROID_ABI="armeabi-v7a" -DANDROID_ARM_NEON=ON -DNCNN_SHARED_LIB=ON ..
cmake --build . -j $(nproc)
- name: armeabi-v7a-no-neon-shared
run: |
mkdir build-armeabi-v7a-no-neon-shared && cd build-armeabi-v7a-no-neon-shared
cmake ${{ env.NCNN_CMAKE_OPTIONS }} -DANDROID_ABI="armeabi-v7a" -DANDROID_ARM_NEON=OFF -DNCNN_SHARED_LIB=ON ..
cmake --build . -j $(nproc)
- name: arm64-v8a-shared
run: |
mkdir build-arm64-v8a-shared && cd build-arm64-v8a-shared
cmake ${{ env.NCNN_CMAKE_OPTIONS }} -DANDROID_ABI="arm64-v8a" -DNCNN_SHARED_LIB=ON ..
cmake --build . -j $(nproc)