CMakeLists.txt 4.0 KB
Newer Older
W
wangguibao 已提交
1 2 3 4 5 6 7
if (NOT EXISTS
                ${CMAKE_CURRENT_LIST_DIR}/data/model/paddle/fluid/text_classification_lstm)
        execute_process(COMMAND wget
                --no-check-certificate https://paddle-serving.bj.bcebos.com/data/text_classification/text_classification_lstm.tar.gz
                --output-document
                ${CMAKE_CURRENT_LIST_DIR}/data/model/paddle/fluid/text_classification_lstm.tar.gz)

W
wangguibao 已提交
8
        execute_process(COMMAND ${CMAKE_COMMAND} -E tar xzf
W
wangguibao 已提交
9 10 11 12 13 14
                "${CMAKE_CURRENT_LIST_DIR}/data/model/paddle/fluid/text_classification_lstm.tar.gz"
                WORKING_DIRECTORY
                ${CMAKE_CURRENT_LIST_DIR}/data/model/paddle/fluid
                )
endif()

W
wangguibao 已提交
15 16 17 18 19 20 21 22 23 24 25 26
if (NOT EXISTS
                ${CMAKE_CURRENT_LIST_DIR}/data/model/paddle/fluid/ctr_prediction)
        execute_process(COMMAND wget --no-check-certificate
                https://paddle-serving.bj.bcebos.com/data/ctr_prediction/ctr_prediction.tar.gz
                --output-document
                ${CMAKE_CURRENT_LIST_DIR}/data/model/paddle/fluid/ctr_prediction.tar.gz)
        execute_process(COMMAND ${CMAKE_COMMAND} -E tar xzf
                "${CMAKE_CURRENT_LIST_DIR}/data/model/paddle/fluid/ctr_prediction.tar.gz"
                WORKING_DIRECTORY
                ${CMAKE_CURRENT_LIST_DIR}/data/model/paddle/fluid)
endif()

X
xulongteng 已提交
27 28 29 30 31 32 33 34 35 36 37 38
if (NOT EXISTS
                ${CMAKE_CURRENT_LIST_DIR}/data/model/paddle/fluid/bert_cased_L-12_H-768_A-12)
        execute_process(COMMAND wget --no-check-certificate
                https://paddle-serving.bj.bcebos.com/data/bert/bert_cased_L-12_H-768_A-12.tar.gz
                --output-document
                ${CMAKE_CURRENT_LIST_DIR}/data/model/paddle/fluid/bert_cased_L-12_H-768_A-12.tar.gz)
        execute_process(COMMAND ${CMAKE_COMMAND} -E tar xzf
            "${CMAKE_CURRENT_LIST_DIR}/data/model/paddle/fluid/bert_cased_L-12_H-768_A-12.tar.gz"
                WORKING_DIRECTORY
                ${CMAKE_CURRENT_LIST_DIR}/data/model/paddle/fluid)
endif()

39
include_directories(SYSTEM  ${CMAKE_CURRENT_LIST_DIR}/../kvdb/include)
W
wangguibao 已提交
40

W
serving  
wangguibao 已提交
41 42
include(op/CMakeLists.txt)
include(proto/CMakeLists.txt)
W
wangguibao 已提交
43 44
add_executable(serving ${serving_srcs})
add_dependencies(serving pdcodegen fluid_cpu_engine pdserving paddle_fluid
W
wangguibao 已提交
45
        opencv_imgcodecs cube-api)
W
wangguibao 已提交
46 47 48
if (WITH_GPU)
    add_dependencies(serving fluid_gpu_engine)
endif()
W
wangguibao 已提交
49
target_include_directories(serving PUBLIC
G
guru4elephant 已提交
50
        ${CMAKE_CURRENT_BINARY_DIR}/../../core/predictor
W
sdk-cpp  
wangguibao 已提交
51
        )
W
wangguibao 已提交
52 53

if(WITH_GPU)
54
    target_link_libraries(serving -Wl,--whole-archive fluid_gpu_engine
W
wangguibao 已提交
55 56
            -Wl,--no-whole-archive)
endif()
57 58 59 60 61 62

target_link_libraries(serving -Wl,--whole-archive fluid_cpu_engine
        -Wl,--no-whole-archive)

target_link_libraries(serving paddle_fluid ${paddle_depend_libs})

W
wangguibao 已提交
63
target_link_libraries(serving opencv_imgcodecs
64 65 66
        ${opencv_depend_libs})

target_link_libraries(serving pdserving)
W
wangguibao 已提交
67
target_link_libraries(serving cube-api)
68 69 70 71 72 73

target_link_libraries(serving kvdb rocksdb)

if(WITH_GPU)
    target_link_libraries(serving ${CUDA_LIBRARIES})
endif()
G
guru4elephant 已提交
74 75 76 77 78 79 80 81

if(WITH_MKL)
    message("lalalala: " ${WITH_MKL})
    target_link_libraries(serving -liomp5 -lmklml_intel -lmkldnn -lpthread -lcrypto -lm -lrt -lssl -ldl -lz -lbz2)
else()
    message("hehehehe: " ${WITH_MKL})
    target_link_libraries(serving openblas -lpthread -lcrypto -lm -lrt -lssl -ldl -lz -lbz2)
endif()
82

W
wangguibao 已提交
83 84 85
install(TARGETS serving
        RUNTIME DESTINATION
        ${PADDLE_SERVING_INSTALL_DIR}/demo/serving/bin)
86 87
install(DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/conf DESTINATION
        ${PADDLE_SERVING_INSTALL_DIR}/demo/serving/)
W
wangguibao 已提交
88 89 90 91 92

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

W
wangguibao 已提交
93
if (${WITH_MKL})
G
guru4elephant 已提交
94 95 96 97 98 99
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
        DESTINATION
        ${PADDLE_SERVING_INSTALL_DIR}/demo/serving/bin)
W
wangguibao 已提交
100
endif()