summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--caffe2/CMakeLists.txt9
-rw-r--r--caffe2/utils/CMakeLists.txt2
2 files changed, 8 insertions, 3 deletions
diff --git a/caffe2/CMakeLists.txt b/caffe2/CMakeLists.txt
index fa685376f7..8920f7ff8e 100644
--- a/caffe2/CMakeLists.txt
+++ b/caffe2/CMakeLists.txt
@@ -87,8 +87,13 @@ endif()
# 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 "")
@@ -659,7 +664,7 @@ elseif(USE_CUDA)
endif()
-if(NOT MSVC AND USE_XNNPACK)
+if(NOT MSVC AND NOT DISABLE_NNPACK_AND_FAMILY)
TARGET_LINK_LIBRARIES(torch_cpu PRIVATE fxdiv)
endif()
diff --git a/caffe2/utils/CMakeLists.txt b/caffe2/utils/CMakeLists.txt
index 2925f4145b..a59250638a 100644
--- a/caffe2/utils/CMakeLists.txt
+++ b/caffe2/utils/CMakeLists.txt
@@ -36,7 +36,7 @@ list(APPEND Caffe2_CPU_SRCS
# ---[ 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