| name: Build using CMake | |
| on: | |
| push: | |
| paths: | |
| - '**.S' | |
| - '**.c' | |
| - '**.cc' | |
| - '**.h' | |
| - 'CMakeLists.txt' | |
| - 'cmake/**' | |
| - 'scripts/build-*.sh' | |
| - '.github/**/*.yml' | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| cmake-linux-local: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 60 | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Update apt | |
| run: sudo apt update | |
| - name: Install ninja | |
| run: sudo apt install ninja-build | |
| - name: Configure and build | |
| run: scripts/build-local.sh | |
| working-directory: ${{ github.workspace }} | |
| cmake-linux-aarch64: | |
| runs-on: ubuntu-22.04 | |
| timeout-minutes: 120 | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Update apt | |
| run: sudo apt update | |
| - name: Install ninja | |
| run: sudo apt install ninja-build | |
| - name: Install aarch64 cross-toolchain | |
| run: sudo apt install crossbuild-essential-arm64 | |
| - name: Install qemu-aarch64 | |
| run: sudo apt install qemu-user | |
| - name: Configure and build | |
| run: scripts/build-linux-aarch64.sh -DCMAKE_BUILD_TYPE=Release | |
| working-directory: ${{ github.workspace }} | |
| - name: Run tests | |
| run: ctest --output-on-failure --parallel $(nproc) | |
| working-directory: ${{ github.workspace }}/build/linux/aarch64 | |
| cmake-linux-armhf: | |
| runs-on: ubuntu-22.04 | |
| timeout-minutes: 90 | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Update apt | |
| run: sudo apt update | |
| - name: Install ninja | |
| run: sudo apt install ninja-build | |
| - name: Install armhf cross-toolchain | |
| run: sudo apt install crossbuild-essential-armhf | |
| - name: Install qemu-arm | |
| run: sudo apt install qemu-user | |
| - name: Configure and build | |
| run: scripts/build-linux-armhf.sh -DCMAKE_BUILD_TYPE=Release | |
| working-directory: ${{ github.workspace }} | |
| - name: Run tests | |
| run: ctest --output-on-failure --parallel $(nproc) | |
| working-directory: ${{ github.workspace }}/build/linux/armhf | |
| cmake-linux-riscv64: | |
| runs-on: ubuntu-22.04 | |
| timeout-minutes: 60 | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Update apt | |
| run: sudo apt update | |
| - name: Install ninja | |
| run: sudo apt install ninja-build | |
| - name: Install riscv64 cross-toolchain | |
| run: sudo apt install crossbuild-essential-riscv64 | |
| - name: Install qemu-riscv64 | |
| run: sudo apt install qemu-user | |
| - name: Configure and build | |
| run: scripts/build-linux-riscv64.sh -DCMAKE_BUILD_TYPE=Release -DXNNPACK_ENABLE_RISCV_VECTOR=OFF | |
| working-directory: ${{ github.workspace }} | |
| - name: Run tests | |
| run: ctest --output-on-failure --parallel $(nproc) | |
| working-directory: ${{ github.workspace }}/build/linux/riscv64 | |
| cmake-windows-arm64: | |
| runs-on: windows-latest | |
| timeout-minutes: 120 | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Configure and build | |
| run: scripts/build-windows-arm64.cmd | |
| shell: cmd | |
| working-directory: ${{ github.workspace }} | |
| cmake-windows-x64: | |
| runs-on: windows-latest | |
| timeout-minutes: 120 | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Configure and build | |
| run: scripts/build-windows-x64.cmd | |
| shell: cmd | |
| working-directory: ${{ github.workspace }} | |
| env: | |
| CFLAGS: "/UNDEBUG" | |
| CXXFLAGS: "/UNDEBUG" | |
| - name: Run tests | |
| run: ctest -C Release --output-on-failure --parallel %NUMBER_OF_PROCESSORS% | |
| working-directory: ${{ github.workspace }}/build/windows/x64 | |
| cmake-windows-x86: | |
| runs-on: windows-latest | |
| timeout-minutes: 120 | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Configure and build | |
| run: scripts/build-windows-x86.cmd | |
| shell: cmd | |
| working-directory: ${{ github.workspace }} | |
| env: | |
| CFLAGS: "/UNDEBUG" | |
| CXXFLAGS: "/UNDEBUG" | |
| - name: Run tests | |
| run: ctest -C Release --output-on-failure --parallel %NUMBER_OF_PROCESSORS% | |
| working-directory: ${{ github.workspace }}/build/windows/x86 | |
| cmake-macos-arm64: | |
| runs-on: macos-latest | |
| timeout-minutes: 60 | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Create output directory | |
| run: mkdir -p build/macos/arm64 | |
| working-directory: ${{ github.workspace }} | |
| - name: Generate CMake project | |
| run: cmake -G Xcode -DCMAKE_OSX_ARCHITECTURES=arm64 -DHAVE_STD_REGEX=TRUE ../../.. | |
| working-directory: ${{ github.workspace }}/build/macos/arm64 | |
| - name: Build with Xcode | |
| run: cmake --build build/macos/arm64 --parallel $(sysctl -n hw.ncpu) -- -quiet | |
| working-directory: ${{ github.workspace }} | |
| cmake-macos-x86_64: | |
| runs-on: macos-latest | |
| timeout-minutes: 90 | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Create output directory | |
| run: mkdir -p build/macos/x86_64 | |
| working-directory: ${{ github.workspace }} | |
| - name: Generate CMake project | |
| run: cmake -G Xcode -DCMAKE_OSX_ARCHITECTURES=x86_64 -DHAVE_STD_REGEX=TRUE ../../.. | |
| working-directory: ${{ github.workspace }}/build/macos/x86_64 | |
| - name: Build with Xcode | |
| run: cmake --build build/macos/x86_64 --parallel $(sysctl -n hw.ncpu) -- -quiet | |
| working-directory: ${{ github.workspace }} | |
| - name: Run tests | |
| run: ctest --build-config Debug --output-on-failure --parallel $(sysctl -n hw.ncpu) | |
| working-directory: ${{ github.workspace }}/build/macos/x86_64 | |
| cmake-android: | |
| strategy: | |
| matrix: | |
| script: [build-android-arm64.sh, build-android-armv7.sh, build-android-x86.sh] | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 40 | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Update apt | |
| run: sudo apt update | |
| - name: Install ninja | |
| run: sudo apt install ninja-build | |
| - name: Setup Android NDK | |
| id: setup-ndk | |
| uses: nttld/setup-ndk@v1 | |
| with: | |
| ndk-version: r23b | |
| add-to-path: false | |
| - name: Configure and build | |
| run: scripts/${{ matrix.script }} | |
| working-directory: ${{ github.workspace }} | |
| env: | |
| ANDROID_NDK: ${{ steps.setup-ndk.outputs.ndk-path }} | |
| cmake-ios-arm64: | |
| runs-on: macos-latest | |
| timeout-minutes: 60 | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Create output directory | |
| run: mkdir -p build/ios/arm64 | |
| working-directory: ${{ github.workspace }} | |
| - name: Generate CMake project | |
| run: cmake -G Xcode -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_ARCHITECTURES=arm64 -DXNNPACK_BUILD_BENCHMARKS=OFF -DXNNPACK_BUILD_TESTS=OFF ../../.. | |
| working-directory: ${{ github.workspace }}/build/ios/arm64 | |
| - name: Build with Xcode | |
| run: cmake --build build/ios/arm64 --parallel $(sysctl -n hw.ncpu) -- -quiet | |
| working-directory: ${{ github.workspace }} | |
| cmake-ios-x86_64: | |
| runs-on: macos-latest | |
| timeout-minutes: 60 | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Create output directory | |
| run: mkdir -p build/ios/x86_64 | |
| working-directory: ${{ github.workspace }} | |
| - name: Generate CMake project | |
| run: cmake -G Xcode -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_ARCHITECTURES=x86_64 -DXNNPACK_BUILD_BENCHMARKS=OFF -DXNNPACK_BUILD_TESTS=OFF ../../.. | |
| working-directory: ${{ github.workspace }}/build/ios/x86_64 | |
| - name: Build with Xcode | |
| run: cmake --build build/ios/x86_64 --parallel $(sysctl -n hw.ncpu) -- -sdk iphonesimulator -quiet | |
| working-directory: ${{ github.workspace }} | |