CMakeLists.txt 2.4 KB
Newer Older
1
if(APPLE)
2
  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error=pessimizing-move")
W
Wilber 已提交
3
endif()
4

Y
Yiqun Liu 已提交
5 6
add_subdirectory(details)

7
if(WITH_MKLDNN)
8
  set(mkldnn_quantizer_cfg mkldnn_quantizer_config)
9
  set(mkldnn_quantizer_src ${CMAKE_CURRENT_SOURCE_DIR}/mkldnn_quantizer.cc)
10 11 12 13 14 15 16
  cc_library(
    ${mkldnn_quantizer_cfg}
    SRCS mkldnn_quantizer_config.cc
    DEPS lod_tensor paddle_pass_builder)
  set(mkldnn_quantizer_cfg
      ${mkldnn_quantizer_cfg}
      PARENT_SCOPE)
17 18
endif()

19 20 21 22 23 24 25 26 27
cc_library(
  analysis_config
  SRCS analysis_config.cc
  DEPS ${mkldnn_quantizer_cfg} lod_tensor paddle_pass_builder table_printer
       utf8proc)
cc_library(
  paddle_infer_contrib
  SRCS paddle_infer_contrib.cc
  DEPS zero_copy_tensor)
28
cc_library(paddle_pass_builder SRCS paddle_pass_builder.cc)
29

30 31 32 33 34 35 36 37 38
set(paddle_inference_api_deps
    lod_tensor
    scope
    reset_tensor_array
    analysis_config
    paddle_infer_contrib
    zero_copy_tensor
    trainer_desc_proto
    custom_operator)
39

40
if(WITH_CRYPTO)
41
  list(APPEND paddle_inference_api_deps paddle_crypto)
42
endif()
43 44 45
if(WITH_CUSTOM_DEVICE)
  set(paddle_inference_api_deps ${paddle_inference_api_deps} phi_capi)
endif()
46

47 48 49 50
cc_library(
  paddle_inference_api
  SRCS api.cc api_impl.cc helper.cc
  DEPS ${paddle_inference_api_deps})
51

52
if(WIN32)
53
  target_link_libraries(paddle_inference_api gflags)
54 55
endif()

56 57
set(inference_deps ${analysis_deps} paddle_inference_api analysis
                   naive_executor ${GLOB_PASS_LIB})
58 59

if(WITH_GPU AND TENSORRT_FOUND)
60
  set(inference_deps ${inference_deps} tensorrt_engine tensorrt_converter)
61 62
endif()

63 64 65 66 67 68 69 70 71 72
if(WITH_ONNXRUNTIME)
  cc_library(
    analysis_predictor
    SRCS analysis_predictor.cc onnxruntime_predictor.cc resource_manager.cc
         infer_context.cc ${mkldnn_quantizer_src}
    DEPS ${inference_deps}
         zero_copy_tensor
         ir_pass_manager
         op_compatible_info
         infer_io_utils
73
         model_utils
74 75
         onnxruntime
         paddle2onnx)
W
Wilber 已提交
76
else()
77 78 79 80 81
  cc_library(
    analysis_predictor
    SRCS analysis_predictor.cc resource_manager.cc infer_context.cc
         ${mkldnn_quantizer_src}
    DEPS ${inference_deps} zero_copy_tensor ir_pass_manager op_compatible_info
82
         infer_io_utils model_utils)
W
Wilber 已提交
83
endif()
84

85 86 87 88 89
if(WITH_ONNXRUNTIME AND WIN32)
  # Copy onnxruntime for some c++ test in Windows, since the test will
  # be build only in CI, so suppose the generator in Windows is Ninja.
  copy_onnx(test_paddle_inference_api)
endif()