1#!/usr/bin/env bash 2# 3# Copyright 2022 Google LLC 4# 5# This source code is licensed under the BSD-style license found in the 6# LICENSE file in the root directory of this source tree. 7 8# GitHub Actions Windows runner will run this using Git Bash. 9set -e 10 11mkdir -p build/local 12 13CMAKE_ARGS=() 14 15# CMake-level configuration 16CMAKE_ARGS+=("-DCMAKE_BUILD_TYPE=Release") 17CMAKE_ARGS+=("-DCMAKE_POSITION_INDEPENDENT_CODE=ON") 18 19# If Ninja is installed, prefer it to Make 20if [ -x "$(command -v ninja)" ] 21then 22 CMAKE_ARGS+=("-GNinja") 23fi 24 25CMAKE_ARGS+=("-DXNNPACK_LIBRARY_TYPE=static") 26 27# We run out of disk space and timeout on Windows, so build less. 28CMAKE_ARGS+=("-DXNNPACK_BUILD_BENCHMARKS=OFF") 29CMAKE_ARGS+=("-DXNNPACK_BUILD_TESTS=OFF") 30 31# Use-specified CMake arguments go last to allow overridding defaults 32CMAKE_ARGS+=($@) 33 34cd build/local && cmake ../.. \ 35 "${CMAKE_ARGS[@]}" 36 37cmake --build . 38