CMakeLists.txt 5.2 KB
Newer Older
B
baiyf 已提交
1 2 3
set(LOCAL_DETECTION_LIBS)

function(detection_library TARGET_NAME)
4 5 6 7 8 9 10 11 12 13 14 15
  set(oneValueArgs "")
  set(multiValueArgs SRCS DEPS)
  set(options "")
  set(common_deps op_registry)
  set(pybind_flag 0)
  cmake_parse_arguments(detection_library "${options}" "${oneValueArgs}"
                        "${multiValueArgs}" ${ARGN})
  set(srcs)
  # filter cuda source file when not build with cuda/rocm
  foreach(src ${detection_library_SRCS})
    if(NOT WITH_GPU AND NOT WITH_ROCM)
      if(${src} MATCHES ".*\\.cc$")
16 17
        list(APPEND srcs ${src})
      endif()
18 19 20 21 22 23 24
    else()
      list(APPEND srcs ${src})
    endif()
  endforeach()

  op_library(${TARGET_NAME} SRCS ${srcs} DEPS ${common_deps}
             ${detection_library_DEPS})
25

26 27 28
  set(LOCAL_DETECTION_LIBS
      ${TARGET_NAME} ${LOCAL_DETECTION_LIBS}
      PARENT_SCOPE)
B
baiyf 已提交
29 30
endfunction()

31 32 33 34 35
if(WITH_ASCEND_CL)
  detection_library(box_coder_op SRCS box_coder_op.cc box_coder_op.cu
                    box_coder_op_npu.cc)
  detection_library(density_prior_box_op SRCS density_prior_box_op.cc
                    density_prior_box_op.cu density_prior_box_op_npu.cc)
Z
zhulei 已提交
36
else()
37 38 39
  detection_library(box_coder_op SRCS box_coder_op.cc box_coder_op.cu)
  detection_library(density_prior_box_op SRCS density_prior_box_op.cc
                    density_prior_box_op.cu)
T
TTerror 已提交
40 41 42
endif()

if(WITH_XPU)
43 44
  detection_library(iou_similarity_op SRCS iou_similarity_op.cc
                    iou_similarity_op_xpu.cc)
T
TTerror 已提交
45
  detection_library(prior_box_op SRCS prior_box_op.cc prior_box_op_xpu.cc)
46 47
  detection_library(generate_proposals_v2_op SRCS generate_proposals_v2_op.cc
                    generate_proposals_v2_op_xpu.cc)
48 49 50
elseif(WITH_MLU)
  detection_library(iou_similarity_op SRCS iou_similarity_op.cc
                    iou_similarity_op_mlu.cc)
T
TTerror 已提交
51
elseif(WITH_ASCEND_CL)
52 53 54 55
  detection_library(iou_similarity_op SRCS iou_similarity_op.cc
                    iou_similarity_op_npu.cc)
  detection_library(prior_box_op SRCS prior_box_op.cc prior_box_op.cu
                    prior_box_op_npu.cc)
T
TTerror 已提交
56
else()
57 58
  detection_library(iou_similarity_op SRCS iou_similarity_op.cc
                    iou_similarity_op.cu)
T
TTerror 已提交
59
  detection_library(prior_box_op SRCS prior_box_op.cc prior_box_op.cu)
60
  # detection_library(generate_proposals_v2_op SRCS generate_proposals_v2_op.cc)
Z
zhulei 已提交
61 62
endif()

B
baiyf 已提交
63 64
detection_library(bipartite_match_op SRCS bipartite_match_op.cc)
detection_library(mine_hard_examples_op SRCS mine_hard_examples_op.cc)
65
detection_library(anchor_generator_op SRCS anchor_generator_op.cc
66 67
                  anchor_generator_op.cu)
detection_library(target_assign_op SRCS target_assign_op.cc target_assign_op.cu)
68
detection_library(polygon_box_transform_op SRCS polygon_box_transform_op.cc
69
                  polygon_box_transform_op.cu)
Y
Yuan Gao 已提交
70
detection_library(rpn_target_assign_op SRCS rpn_target_assign_op.cc)
71 72
detection_library(generate_proposal_labels_op SRCS
                  generate_proposal_labels_op.cc)
73 74
detection_library(multiclass_nms_op SRCS multiclass_nms_op.cc DEPS gpc)
detection_library(locality_aware_nms_op SRCS locality_aware_nms_op.cc DEPS gpc)
Y
Yang Zhang 已提交
75
detection_library(matrix_nms_op SRCS matrix_nms_op.cc DEPS gpc)
76
detection_library(box_clip_op SRCS box_clip_op.cc box_clip_op.cu)
77
detection_library(yolov3_loss_op SRCS yolov3_loss_op.cc)
H
hong 已提交
78
detection_library(yolo_box_op SRCS yolo_box_op.cc)
79 80 81 82 83 84
detection_library(box_decoder_and_assign_op SRCS box_decoder_and_assign_op.cc
                  box_decoder_and_assign_op.cu)
detection_library(sigmoid_focal_loss_op SRCS sigmoid_focal_loss_op.cc
                  sigmoid_focal_loss_op.cu)
detection_library(retinanet_detection_output_op SRCS
                  retinanet_detection_output_op.cc)
85
detection_library(nms_op SRCS nms_op.cc nms_op.cu)
86

87
if(WITH_GPU OR WITH_ROCM)
88
  set(TMPDEPS memory)
89
  if(WITH_GPU)
90 91
    if(${CMAKE_CUDA_COMPILER_VERSION} LESS 11.0)
      set(TMPDEPS memory cub)
92
    endif()
93
  endif()
94 95 96 97 98 99 100 101 102
  detection_library(generate_proposals_op SRCS generate_proposals_op.cc
                    generate_proposals_op.cu DEPS ${TMPDEPS})
  detection_library(generate_proposals_v2_op SRCS generate_proposals_v2_op.cc
                    generate_proposals_v2_op.cu DEPS ${TMPDEPS})
  detection_library(
    distribute_fpn_proposals_op SRCS distribute_fpn_proposals_op.cc
    distribute_fpn_proposals_op.cu DEPS ${TMPDEPS})
  detection_library(collect_fpn_proposals_op SRCS collect_fpn_proposals_op.cc
                    collect_fpn_proposals_op.cu DEPS ${TMPDEPS})
103 104
else()
  detection_library(generate_proposals_op SRCS generate_proposals_op.cc)
105 106 107
  if(NOT WITH_XPU)
    detection_library(generate_proposals_v2_op SRCS generate_proposals_v2_op.cc)
  endif()
108 109
  detection_library(distribute_fpn_proposals_op SRCS
                    distribute_fpn_proposals_op.cc)
110
  detection_library(collect_fpn_proposals_op SRCS collect_fpn_proposals_op.cc)
111 112
endif()

113 114 115
detection_library(
  roi_perspective_transform_op SRCS roi_perspective_transform_op.cc
  roi_perspective_transform_op.cu)
116
#Export local libraries to parent
W
Wu Yi 已提交
117 118
# set(DETECTION_LIBRARY ${LOCAL_DETECTION_LIBS} PARENT_SCOPE)

119 120 121 122 123 124 125 126 127 128 129 130 131 132
cc_library(
  mask_util
  SRCS mask_util.cc
  DEPS memory)
cc_test(
  mask_util_test
  SRCS mask_util_test.cc
  DEPS memory mask_util)
cc_library(
  gpc
  SRCS gpc.cc
  DEPS op_registry)
detection_library(generate_mask_labels_op SRCS generate_mask_labels_op.cc DEPS
                  mask_util)