fix compile for android
All checks were successful
android / build (arm64-v8a) (push) Successful in 4m40s
android / build (armeabi-v7a) (push) Successful in 5m6s
android / build (x86) (push) Successful in 8m29s
android / build (x86_64) (push) Successful in 4m34s
linux-aarch64-cpu-gcc / linux-gcc-aarch64 (Debug) (push) Successful in 12m23s
linux-aarch64-cpu-gcc / linux-gcc-aarch64 (Release) (push) Successful in 13m2s
linux-mips-gcc / linux-gcc-mipsel (Debug) (push) Successful in 11m58s
linux-mips-gcc / linux-gcc-mipsel (Release) (push) Successful in 13m51s
linux-mips64-gcc / linux-gcc-mips64el (Debug) (push) Successful in 11m19s
linux-mips64-gcc / linux-gcc-mips64el (Release) (push) Successful in 11m1s
linux-riscv64-gcc / linux-gcc-riscv64 (Debug) (push) Successful in 14m44s
linux-riscv64-gcc / linux-gcc-riscv64 (Release) (push) Successful in 12m2s
linux-x64-clang / linux-clang (Debug) (push) Successful in 10m46s
linux-x64-clang / linux-clang (Release) (push) Successful in 8m55s
linux-x86-gcc / linux-gcc (Debug) (push) Successful in 12m26s
linux-x86-gcc / linux-gcc (Release) (push) Successful in 12m17s
linux-arm-gcc / linux-gcc-arm (Debug) (push) Successful in 11m5s
linux-arm-gcc / linux-gcc-arm (Release) (push) Successful in 13m30s
linux-arm-gcc / linux-gcc-armhf (Debug) (push) Successful in 11m4s
linux-arm-gcc / linux-gcc-armhf (Release) (push) Successful in 11m42s
linux-x64-gcc / linux-gcc (Debug) (push) Successful in 7m48s
linux-x64-gcc / linux-gcc (Release) (push) Successful in 8m31s

This commit is contained in:
tqcq 2024-12-19 14:52:43 +08:00
parent 7d7845acb5
commit 6a719f0cb1
2 changed files with 10 additions and 30 deletions

View File

@ -23,6 +23,9 @@ concurrency:
jobs: jobs:
build: build:
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
strategy:
matrix:
build_arch: ["armeabi-v7a", "arm64-v8a", "x86", "x86_64"]
env: env:
TILE_CMAKE_OPTIONS: | TILE_CMAKE_OPTIONS: |
-DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_LATEST_HOME/build/cmake/android.toolchain.cmake \ -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_LATEST_HOME/build/cmake/android.toolchain.cmake \
@ -31,7 +34,6 @@ jobs:
-DCMAKE_BUILD_TYPE=Release \ -DCMAKE_BUILD_TYPE=Release \
-DNCNN_VULKAN=ON \ -DNCNN_VULKAN=ON \
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with: with:
@ -41,32 +43,8 @@ jobs:
apt-get update -y apt-get update -y
apt-get install -y ninja-build apt-get install -y ninja-build
- name: armeabi-v7a - name: ${{matrix.build_arch}}
run: | run: |
mkdir build-armeabi-v7a && cd build-armeabi-v7a mkdir build && cd build
cmake -GNinja .. ${{ env.TILE_CMAKE_OPTIONS}} -DCMAKE_ABI="armeabi-v7a" -DANDROID_ARM_NEON=ON cmake -GNinja .. ${{ env.TILE_CMAKE_OPTIONS}} -DCMAKE_ABI="${{matrix.build_arch}}" -DANDROID_ARM_NEON=ON
cmake --build . -j $(nproc) cmake --build . -j $(nproc)
- name: arm64-v8a
run: |
mkdir build-arm64-v8a && cd build-arm64-v8a
cmake -GNinja .. ${{ env.TILE_CMAKE_OPTIONS}} -DCMAKE_ABI="arm64-v8a"
cmake --build . -j $(nproc)
- name: x86
run: |
mkdir build-x86 && cd build-x86
cmake -GNinja .. ${{ env.TILE_CMAKE_OPTIONS}} -DCMAKE_ABI="x86"
cmake --build . -j $(nproc)
- name: x86_64
run: |
mkdir build-x86_64 && cd build-x86_64
cmake -GNinja .. ${{ env.TILE_CMAKE_OPTIONS}} -DCMAKE_ABI="x86_64"
cmake --build . -j $(nproc)

View File

@ -32,9 +32,11 @@ option(TILE_BUILD_SHARED "Build shared library" ON)
option(TILE_WITH_MIMALLOC "Build with mimalloc" OFF) option(TILE_WITH_MIMALLOC "Build with mimalloc" OFF)
if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR) if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
if(NOT CMAKE_SYSTEM_NAME STREQUAL "Android")
set(TILE_BUILD_TESTS ON) set(TILE_BUILD_TESTS ON)
set(TILE_BUILD_BENCHMARKS ON) set(TILE_BUILD_BENCHMARKS ON)
endif() endif()
endif()
if(NOT CMAKE_BUILD_TYPE) if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release") set(CMAKE_BUILD_TYPE "Release")