# Note: the folders that are being commented out have not been properly
# addressed yet.
+set(DISABLE_NNPACK_AND_FAMILY OFF)
+if(NOT (USE_NNPACK OR USE_QNNPACK OR USE_PYTORCH_QNNPACK OR USE_XNNPACK))
+ set(DISABLE_NNPACK_AND_FAMILY ON)
+endif()
+
# For pthreadpool_new_if_impl. TODO: Remove when threadpools are unitied.
-if(NOT MSVC AND USE_XNNPACK)
+if(NOT MSVC AND NOT DISABLE_NNPACK_AND_FAMILY)
if(NOT TARGET fxdiv)
set(FXDIV_BUILD_TESTS OFF CACHE BOOL "")
set(FXDIV_BUILD_BENCHMARKS OFF CACHE BOOL "")
endif()
-if(NOT MSVC AND USE_XNNPACK)
+if(NOT MSVC AND NOT DISABLE_NNPACK_AND_FAMILY)
TARGET_LINK_LIBRARIES(torch_cpu PRIVATE fxdiv)
endif()
# ---[ threadpool/pthreadpool* is a local modification of the NNPACK
# pthreadpool with a very similar interface. Neither NNPACK, nor this
# thread pool supports Windows.
-if(NOT MSVC AND USE_XNNPACK)
+if(NOT MSVC AND NOT DISABLE_NNPACK_AND_FAMILY)
add_definitions(-DUSE_INTERNAL_THREADPOOL_IMPL)
set(Caffe2_CPU_SRCS ${Caffe2_CPU_SRCS}
utils/threadpool/pthreadpool.cc