@@ -34,7 +34,6 @@ cmake_dependent_option(
34
34
cmake_dependent_option (EXECUTORCH_BUILD_CPUINFO "Build cpuinfo library." ON
35
35
"NOT EXECUTORCH_BUILD_ARM_BAREMETAL" OFF )
36
36
37
-
38
37
if (NOT PYTHON_EXECUTABLE )
39
38
set (PYTHON_EXECUTABLE python3 )
40
39
endif ()
@@ -111,32 +110,26 @@ if(EXECUTORCH_BUILD_CUSTOM)
111
110
list (APPEND link_libraries custom_ops_lib )
112
111
endif ()
113
112
113
+ set (XNNPACK_ROOT ${CMAKE_CURRENT_SOURCE_DIR} /../../../backends/xnnpack )
114
114
# Extra compile option and include dir for pthreadpool
115
115
if (EXECUTORCH_BUILD_PTHREADPOOL )
116
116
list (APPEND _common_compile_options -DET_USE_THREADPOOL )
117
117
list (APPEND link_libraries pthreadpool )
118
- list (
119
- APPEND
120
- _srcs
121
- ${CMAKE_CURRENT_SOURCE_DIR} /../../../backends/xnnpack/ threadpool/threadpool .cpp
122
- ${CMAKE_CURRENT_SOURCE_DIR} /../../../backends/xnnpack/threadpool/threadpool_guard.cpp
123
- )
124
- list ( APPEND _common_include_directories ${CMAKE_CURRENT_SOURCE_DIR} /../../../backends/xnnpack /third-party/pthreadpool/include )
118
+ # These 2 source files are included in xnnpack_backend
119
+ if ( NOT TARGET xnnpack_backend )
120
+ list ( APPEND _srcs ${XNNPACK_ROOT} /threadpool/threadpool.cpp
121
+ ${XNNPACK_ROOT} / threadpool/threadpool_guard .cpp)
122
+ endif ()
123
+ list ( APPEND _common_include_directories
124
+ ${XNNPACK_ROOT} /third-party/pthreadpool/include )
125
125
endif ()
126
126
127
127
# Extra sources for cpuinfo
128
128
if (EXECUTORCH_BUILD_CPUINFO )
129
129
list (APPEND link_libraries cpuinfo )
130
- list (
131
- APPEND
132
- _srcs
133
- ${CMAKE_CURRENT_SOURCE_DIR} /../../../backends/xnnpack/threadpool/cpuinfo_utils.cpp
134
- )
135
- list (
136
- APPEND
137
- _common_include_directories
138
- ${CMAKE_CURRENT_SOURCE_DIR} /../../../backends/xnnpack/third-party/cpuinfo/include
139
- )
130
+ list (APPEND _srcs ${XNNPACK_ROOT} /threadpool/cpuinfo_utils.cpp )
131
+ list (APPEND _common_include_directories
132
+ ${XNNPACK_ROOT} /third-party/cpuinfo/include )
140
133
endif ()
141
134
142
135
# XNNPACK
0 commit comments