@@ -34,7 +34,6 @@ cmake_dependent_option(
3434cmake_dependent_option(EXECUTORCH_BUILD_CPUINFO "Build cpuinfo library." ON
3535 "NOT EXECUTORCH_BUILD_ARM_BAREMETAL" OFF )
3636
37-
3837if (NOT PYTHON_EXECUTABLE)
3938 set (PYTHON_EXECUTABLE python3)
4039endif ()
@@ -111,32 +110,26 @@ if(EXECUTORCH_BUILD_CUSTOM)
111110 list (APPEND link_libraries custom_ops_lib)
112111endif ()
113112
113+ set (XNNPACK_ROOT ${CMAKE_CURRENT_SOURCE_DIR} /../../../backends/xnnpack)
114114# Extra compile option and include dir for pthreadpool
115115if (EXECUTORCH_BUILD_PTHREADPOOL)
116116 list (APPEND _common_compile_options -DET_USE_THREADPOOL)
117117 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 )
125125endif ()
126126
127127# Extra sources for cpuinfo
128128if (EXECUTORCH_BUILD_CPUINFO)
129129 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 )
140133endif ()
141134
142135# XNNPACK
0 commit comments