xref: /aosp_15_r20/external/executorch/extension/threadpool/CMakeLists.txt (revision 523fa7a60841cd1ecfb9cc4201f1ca8b03ed023a)
1# Copyright (c) Meta Platforms, Inc. and affiliates.
2# All rights reserved.
3#
4# This source code is licensed under the BSD-style license found in the
5# LICENSE file in the root directory of this source tree.
6
7# Please this file formatted by running:
8# ~~~
9# cmake-format -i CMakeLists.txt
10# ~~~
11
12cmake_minimum_required(VERSION 3.19)
13
14# Source root directory for executorch.
15if(NOT EXECUTORCH_ROOT)
16  set(EXECUTORCH_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/../..)
17endif()
18
19if(NOT CMAKE_CXX_STANDARD)
20  set(CMAKE_CXX_STANDARD 17)
21endif()
22
23add_library(
24  extension_threadpool threadpool.cpp threadpool_guard.cpp cpuinfo_utils.cpp
25)
26target_link_libraries(
27  extension_threadpool PUBLIC executorch_core cpuinfo pthreadpool
28)
29target_include_directories(extension_threadpool PUBLIC ${EXECUTORCH_ROOT}/..)
30target_include_directories(
31  extension_threadpool
32  PUBLIC ${EXECUTORCH_ROOT}/backends/xnnpack/third-party/cpuinfo/include
33         ${EXECUTORCH_ROOT}/backends/xnnpack/third-party/pthreadpool/include
34)
35target_compile_options(extension_threadpool PUBLIC ${_common_compile_options})
36
37# Install libraries
38install(
39  TARGETS extension_threadpool
40  DESTINATION lib
41  INCLUDES
42  DESTINATION ${_common_include_directories}
43)
44