CMakeLists.txt 2.2 KB
Newer Older
W
wangjiawei04 已提交
1
include_directories(SYSTEM  ${CMAKE_CURRENT_LIST_DIR}/../../)
2 3
include(op/CMakeLists.txt)
include(proto/CMakeLists.txt)
H
HexToString 已提交
4

5
add_executable(serving ${serving_srcs})
6
add_dependencies(serving pdcodegen paddle_inference_engine pdserving paddle_inference cube-api utils utf8proc)
Z
zhangjun 已提交
7

8
if (WITH_GPU)
Z
zhangjun 已提交
9
    add_dependencies(serving paddle_inference_engine)
10
endif()
Z
zhangjun 已提交
11 12

if (WITH_LITE)
Z
zhangjun 已提交
13
    add_dependencies(serving paddle_inference_engine)
Z
zhangjun 已提交
14 15
endif()

16 17
target_include_directories(serving PUBLIC
        ${CMAKE_CURRENT_BINARY_DIR}/../../core/predictor
Z
zhangjun 已提交
18 19
)
include_directories(${CUDNN_ROOT}/include/)
Z
zhangjun 已提交
20

Z
zhangjun 已提交
21
target_link_libraries(serving -Wl,--whole-archive paddle_inference_engine
22 23
        -Wl,--no-whole-archive)

H
HexToString 已提交
24 25 26
if(WITH_OPENCV)
    target_link_libraries(serving ${OpenCV_LIBS})
endif()
Z
zhangjun 已提交
27
target_link_libraries(serving paddle_inference ${paddle_depend_libs})
W
wangjiawei04 已提交
28 29
target_link_libraries(serving brpc)
target_link_libraries(serving protobuf)
30 31
target_link_libraries(serving pdserving)
target_link_libraries(serving cube-api)
32
target_link_libraries(serving utils)
33
target_link_libraries(serving utf8proc)
H
HexToString 已提交
34

35 36 37 38
if(WITH_GPU)
    target_link_libraries(serving ${CUDA_LIBRARIES})
endif()

M
MRXLT 已提交
39
if(WITH_MKL OR WITH_GPU)
M
MRXLT 已提交
40
    if (WITH_TRT)
W
wangjiawei04 已提交
41
    target_link_libraries(serving -liomp5 -lmklml_intel -lpthread -lcrypto -lm -lrt -lssl -ldl -lz -lbz2 -ldnnl)
M
MRXLT 已提交
42
    else()
43
    target_link_libraries(serving -liomp5 -lmklml_intel -lmkldnn -lpthread -lcrypto -lm -lrt -lssl -ldl -lz -lbz2)
M
MRXLT 已提交
44
endif()
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
else()
    target_link_libraries(serving openblas -lpthread -lcrypto -lm -lrt -lssl -ldl -lz -lbz2)
endif()

install(TARGETS serving
        RUNTIME DESTINATION
        ${PADDLE_SERVING_INSTALL_DIR}/demo/serving/bin)

FILE(GLOB inc ${CMAKE_CURRENT_BINARY_DIR}/*.pb.h)
install(FILES ${inc}
        DESTINATION ${PADDLE_SERVING_INSTALL_DIR}/include/serving)

if (${WITH_MKL})
install(FILES
        ${CMAKE_BINARY_DIR}/third_party/install/Paddle/third_party/install/mklml/lib/libmklml_intel.so
        ${CMAKE_BINARY_DIR}/third_party/install/Paddle/third_party/install/mklml/lib/libiomp5.so
        ${CMAKE_BINARY_DIR}/third_party/install/Paddle/third_party/install/mkldnn/lib/libmkldnn.so.0
W
wangjiawei04 已提交
62
        ${CMAKE_BINARY_DIR}/third_party/install/Paddle/third_party/install/mkldnn/lib/libdnnl.so.1
63 64 65
        DESTINATION
        ${PADDLE_SERVING_INSTALL_DIR}/demo/serving/bin)
endif()