CMakeLists.txt 2.6 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
cc_library(
  paddle_infer_contrib
  SRCS paddle_infer_contrib.cc
  DEPS zero_copy_tensor)
23
cc_library(paddle_pass_builder SRCS paddle_pass_builder.cc)
24

25 26 27
set(paddle_inference_api_deps
    reset_tensor_array
    paddle_infer_contrib
28
    paddle_pass_builder
29 30
    zero_copy_tensor
    trainer_desc_proto
R
risemeup1 已提交
31 32 33
    custom_operator
    lod_tensor
    scope)
34

35
if(WITH_CRYPTO)
36
  list(APPEND paddle_inference_api_deps paddle_crypto)
37
endif()
38
if(WITH_CUSTOM_DEVICE)
39
  set(paddle_inference_api_deps ${paddle_inference_api_deps} phi)
40
endif()
41

R
risemeup1 已提交
42 43 44 45 46 47 48 49 50 51 52
if(WIN32)
  cc_library(
    paddle_inference_api
    SRCS api.cc api_impl.cc helper.cc
    DEPS executor ${paddle_inference_api_deps})
else()
  cc_library(
    paddle_inference_api
    SRCS api.cc api_impl.cc helper.cc
    DEPS executor paddle_inference_io ${paddle_inference_api_deps})
endif()
53

54 55 56 57 58 59
cc_library(
  analysis_config
  SRCS analysis_config.cc
  DEPS ${mkldnn_quantizer_cfg} paddle_inference_api lod_tensor
       paddle_pass_builder table_printer utf8proc)

60
if(WIN32)
61
  target_link_libraries(paddle_inference_api phi)
62 63
endif()

64
set(inference_deps ${analysis_deps} paddle_inference_api analysis
65
                   analysis_config naive_executor ${GLOB_PASS_LIB})
66 67

if(WITH_GPU AND TENSORRT_FOUND)
68
  set(inference_deps ${inference_deps} tensorrt_engine tensorrt_converter)
69 70
endif()

71 72 73 74 75 76 77 78 79 80
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
81
         model_utils
82
         onnxruntime
83
         paddle2onnx)
W
Wilber 已提交
84
else()
85 86 87 88
  cc_library(
    analysis_predictor
    SRCS analysis_predictor.cc resource_manager.cc infer_context.cc
         ${mkldnn_quantizer_src}
89 90
    DEPS ${inference_deps} zero_copy_tensor ir_pass_manager op_compatible_info
         infer_io_utils model_utils)
W
Wilber 已提交
91
endif()
92

93 94 95 96 97
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()