summaryrefslogtreecommitdiff
path: root/modules/detectron
diff options
context:
space:
mode:
authorOrion Reblitz-Richardson <orionr@gmail.com>2018-09-18 14:00:52 -0700
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>2018-09-18 14:09:33 -0700
commit8ad846fda55f8cd04e832440c794ace04daf40fa (patch)
tree88f8efd89bdf3d6d0c14a2b5204f3a8d8a2f23de /modules/detectron
parentd4e1fa45d055a1b00e8b7cfefa5c9f5db9ae6160 (diff)
downloadpytorch-8ad846fda55f8cd04e832440c794ace04daf40fa.tar.gz
pytorch-8ad846fda55f8cd04e832440c794ace04daf40fa.tar.bz2
pytorch-8ad846fda55f8cd04e832440c794ace04daf40fa.zip
Don't build Detectron ops with NO_CAFFE2_OPS=1 (#11799)
Summary: cc apaszke Pull Request resolved: https://github.com/pytorch/pytorch/pull/11799 Differential Revision: D9922745 Pulled By: orionr fbshipit-source-id: b88724b7c2919aabc00d98658e8e563233e01c85
Diffstat (limited to 'modules/detectron')
-rw-r--r--modules/detectron/CMakeLists.txt28
1 files changed, 15 insertions, 13 deletions
diff --git a/modules/detectron/CMakeLists.txt b/modules/detectron/CMakeLists.txt
index 1791ca27a9..971baa41ad 100644
--- a/modules/detectron/CMakeLists.txt
+++ b/modules/detectron/CMakeLists.txt
@@ -1,18 +1,20 @@
file(GLOB Detectron_CPU_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/*.cc)
file(GLOB Detectron_GPU_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/*.cu)
-# Note(ilijar): Since Detectron ops currently have no
-# CPU implementation, we only build GPU ops for now.
-if (USE_CUDA)
- CUDA_ADD_LIBRARY(
- caffe2_detectron_ops_gpu SHARED
- ${Detectron_CPU_SRCS}
- ${Detectron_GPU_SRCS})
+if (BUILD_CAFFE2_OPS)
+ # Note(ilijar): Since Detectron ops currently have no
+ # CPU implementation, we only build GPU ops for now.
+ if (USE_CUDA)
+ CUDA_ADD_LIBRARY(
+ caffe2_detectron_ops_gpu SHARED
+ ${Detectron_CPU_SRCS}
+ ${Detectron_GPU_SRCS})
- target_link_libraries(caffe2_detectron_ops_gpu caffe2_gpu)
- install(TARGETS caffe2_detectron_ops_gpu DESTINATION lib)
-elseif(NOT IOS_PLATFORM)
- add_library(caffe2_detectron_ops SHARED ${Detectron_CPU_SRCS})
- target_link_libraries(caffe2_detectron_ops caffe2)
- install(TARGETS caffe2_detectron_ops DESTINATION lib)
+ target_link_libraries(caffe2_detectron_ops_gpu caffe2_gpu)
+ install(TARGETS caffe2_detectron_ops_gpu DESTINATION lib)
+ elseif(NOT IOS_PLATFORM)
+ add_library(caffe2_detectron_ops SHARED ${Detectron_CPU_SRCS})
+ target_link_libraries(caffe2_detectron_ops caffe2)
+ install(TARGETS caffe2_detectron_ops DESTINATION lib)
+ endif()
endif()