@@ -98,14 +98,21 @@ add_subdirectory(runner)
9898set (link_libraries gflags)
9999set (_srcs main.cpp)
100100
101+ # in Windows, cpublas and extension_threadpool have duplicated symbols
102+ if (WIN32 AND TARGET xnnpack_backend)
103+ set (CPUBLAS "" )
104+ else ()
105+ set (CPUBLAS "cpublas" )
106+ endif ()
107+
101108if (EXECUTORCH_BUILD_KERNELS_OPTIMIZED)
102109 list (
103110 APPEND
104111 link_libraries
105112 optimized_native_cpu_ops_lib
106113 optimized_kernels
107114 portable_kernels
108- cpublas
115+ ${CPUBLAS}
109116 eigen_blas
110117 )
111118 target_link_options_shared_lib(optimized_native_cpu_ops_lib)
@@ -131,18 +138,26 @@ if(EXECUTORCH_BUILD_TORCHAO)
131138endif ()
132139
133140set (XNNPACK_ROOT ${CMAKE_CURRENT_SOURCE_DIR} /../../../backends/xnnpack)
141+
142+ # in Windows, xnnpack_backend and extension_threadpool have duplicated symbols
143+ if (WIN32 AND TARGET xnnpack_backend)
144+ set (EXTENSION_THREADPOOL "" )
145+ else ()
146+ set (EXTENSION_THREADPOOL "extension_threadpool" )
147+ endif ()
148+
134149# Extra compile option and include dir for pthreadpool
135150if (EXECUTORCH_BUILD_PTHREADPOOL)
136151 list (APPEND _common_compile_options -DET_USE_THREADPOOL)
137- list (APPEND link_libraries extension_threadpool pthreadpool)
152+ list (APPEND link_libraries ${EXTENSION_THREADPOOL} pthreadpool)
138153 list (APPEND _common_include_directories
139154 ${XNNPACK_ROOT} /third-party/pthreadpool/include
140155 )
141156endif ()
142157
143158# Extra sources for cpuinfo
144159if (EXECUTORCH_BUILD_CPUINFO)
145- list (APPEND link_libraries extension_threadpool cpuinfo)
160+ list (APPEND link_libraries ${EXTENSION_THREADPOOL} cpuinfo)
146161 list (APPEND _common_include_directories
147162 ${XNNPACK_ROOT} /third-party/cpuinfo/include
148163 )
0 commit comments