4
4
# This source code is licensed under the BSD-style license found in the
5
5
# LICENSE file in the root directory of this source tree.
6
6
7
-
8
7
cmake_minimum_required (VERSION 3.19 )
9
8
10
9
set (CMAKE_EXPORT_COMPILE_COMMANDS ON )
@@ -44,7 +43,6 @@ include(${EXECUTORCH_SRCS_FILE})
44
43
# Let files say "include <executorch/path/to/header.h>".
45
44
set (_common_include_directories ${EXECUTORCH_ROOT} /.. )
46
45
47
-
48
46
# Custom op libraries
49
47
set (custom_ops_libs extension_module )
50
48
list (APPEND custom_ops_libs pthreadpool )
@@ -57,25 +55,34 @@ list(APPEND custom_ops_libs eigen_blas)
57
55
set (_yaml "${CMAKE_CURRENT_LIST_DIR} /custom_ops.yaml" )
58
56
gen_selected_ops ("${_yaml} " "" "" )
59
57
60
- generate_bindings_for_kernels (
61
- FUNCTIONS_YAML ${CMAKE_CURRENT_SOURCE_DIR} /custom_ops.yaml )
58
+ generate_bindings_for_kernels (FUNCTIONS_YAML
59
+ ${CMAKE_CURRENT_SOURCE_DIR} /custom_ops.yaml )
62
60
message ("Generated files ${gen_command_sources} " )
63
61
64
62
list (TRANSFORM _custom_ops__srcs PREPEND "${EXECUTORCH_ROOT} /" )
63
+
64
+ # TODO: Consider moving xnnpack/threadpool in a separate lib since it's now used
65
+ # by custom ops too.
66
+ if (NOT EXECUTORCH_BUILD_XNNPACK )
67
+ list (
68
+ APPEND
69
+ _custom_ops__srcs
70
+ "${CMAKE_CURRENT_SOURCE_DIR} /../../../../backends/xnnpack/threadpool/threadpool.cpp"
71
+ "${CMAKE_CURRENT_SOURCE_DIR} /../../../../backends/xnnpack/threadpool/threadpool_guard.cpp"
72
+ )
73
+ endif ()
74
+
65
75
add_library (custom_ops ${_custom_ops__srcs} )
66
76
67
77
target_include_directories (custom_ops PUBLIC "${_common_include_directories} " )
68
- target_include_directories (custom_ops PRIVATE
69
- "${CMAKE_CURRENT_BINARY_DIR} /../../../../include" )
78
+ target_include_directories (
79
+ custom_ops PRIVATE "${CMAKE_CURRENT_BINARY_DIR} /../../../../include" )
70
80
target_link_libraries (custom_ops PUBLIC ${custom_ops_libs} )
71
81
72
82
target_compile_options (custom_ops PUBLIC ${_common_compile_options}
73
- -DET_USE_THREADPOOL )
83
+ -DET_USE_THREADPOOL )
74
84
75
85
# Build a library for _custom_ops_srcs
76
86
#
77
87
# custom_ops_lib: Register optimized ops kernels into Executorch runtime
78
- gen_operators_lib (
79
- "custom_ops_lib"
80
- KERNEL_LIBS custom_ops
81
- DEPS executorch )
88
+ gen_operators_lib ("custom_ops_lib" KERNEL_LIBS custom_ops DEPS executorch )
0 commit comments