1# 2# Copyright 2020 The TensorFlow Authors. All Rights Reserved. 3# 4# Licensed under the Apache License, Version 2.0 (the "License"); 5# you may not use this file except in compliance with the License. 6# You may obtain a copy of the License at 7# 8# https://www.apache.org/licenses/LICENSE-2.0 9# 10# Unless required by applicable law or agreed to in writing, software 11# distributed under the License is distributed on an "AS IS" BASIS, 12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13# See the License for the specific language governing permissions and 14# limitations under the License. 15 16if(TARGET xnnpack OR xnnpack_POPULATED) 17 return() 18endif() 19 20include(FetchContent) 21 22OverridableFetchContent_Declare( 23 xnnpack 24 GIT_REPOSITORY https://github.com/google/XNNPACK 25 # Sync with tensorflow/workspace2.bzl 26 GIT_TAG 8e3d3359f9bec608e09fac1f7054a2a14b1bd73c 27 GIT_PROGRESS TRUE 28 PREFIX "${CMAKE_BINARY_DIR}" 29 SOURCE_DIR "${CMAKE_BINARY_DIR}/xnnpack" 30) 31OverridableFetchContent_GetProperties(xnnpack) 32if(NOT xnnpack_POPULATED) 33 OverridableFetchContent_Populate(xnnpack) 34endif() 35 36# May consider setting XNNPACK_USE_SYSTEM_LIBS if we want to control all 37# dependencies by TFLite. 38set(XNNPACK_BUILD_TESTS OFF CACHE BOOL "Disable XNNPACK test.") 39set(XNNPACK_BUILD_BENCHMARKS OFF CACHE BOOL "Disable XNNPACK benchmarks.") 40 41# The following line adds project of PTHREADPOOL, FP16 and XNNPACK which are 42# needed to compile XNNPACK delegate of TFLite. 43add_subdirectory( 44 "${xnnpack_SOURCE_DIR}" 45 "${xnnpack_BINARY_DIR}" 46) 47 48include_directories( 49 AFTER 50 "${PTHREADPOOL_SOURCE_DIR}/include" 51 "${FP16_SOURCE_DIR}/include" 52 "${XNNPACK_SOURCE_DIR}/include" 53 "${CPUINFO_SOURCE_DIR}/" 54) 55