CMakeLists.txt 2.6 KB
Newer Older
W
wangguibao 已提交
1 2 3
if (NOT EXISTS
                ${CMAKE_CURRENT_LIST_DIR}/data/model/paddle/fluid/ctr_prediction)
        execute_process(COMMAND wget --no-check-certificate
W
wangguibao 已提交
4
                https://paddle-serving.bj.bcebos.com/data/ctr_prediction/elastic_ctr_model.tar.gz
W
wangguibao 已提交
5
                --output-document
W
wangguibao 已提交
6
                ${CMAKE_CURRENT_LIST_DIR}/data/model/paddle/fluid/elastic_ctr_model.tar.gz)
W
wangguibao 已提交
7
        execute_process(COMMAND ${CMAKE_COMMAND} -E tar xzf
W
wangguibao 已提交
8 9 10 11
                "${CMAKE_CURRENT_LIST_DIR}/data/model/paddle/fluid/elastic_ctr_model.tar.gz"
                WORKING_DIRECTORY
                ${CMAKE_CURRENT_LIST_DIR}/data/model/paddle/fluid)
        execute_process(COMMAND ${CMAKE_COMMAND} -E rename inference_only ctr_prediction
W
wangguibao 已提交
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
                WORKING_DIRECTORY
                ${CMAKE_CURRENT_LIST_DIR}/data/model/paddle/fluid)
endif()

include_directories(SYSTEM  ${CMAKE_CURRENT_LIST_DIR}/../kvdb/include)

include(op/CMakeLists.txt)
include(proto/CMakeLists.txt)
add_executable(elastic_serving ${serving_srcs})
add_dependencies(elastic_serving pdcodegen fluid_cpu_engine pdserving paddle_fluid cube-api)

target_include_directories(elastic_serving PUBLIC
        ${CMAKE_CURRENT_BINARY_DIR}/../../predictor
        )

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

target_link_libraries(elastic_serving paddle_fluid ${paddle_depend_libs})

target_link_libraries(elastic_serving pdserving)
target_link_libraries(elastic_serving cube-api)

target_link_libraries(elastic_serving kvdb rocksdb)

target_link_libraries(elastic_serving -liomp5 -lmklml_intel -lmkldnn -lpthread
        -lcrypto -lm -lrt -lssl -ldl -lz -lbz2)

install(TARGETS elastic_serving
        RUNTIME DESTINATION
        ${PADDLE_SERVING_INSTALL_DIR}/elastic_ctr/serving/bin)
install(DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/conf DESTINATION
        ${PADDLE_SERVING_INSTALL_DIR}/elastic_ctr/serving/)
install(DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/data DESTINATION
        ${PADDLE_SERVING_INSTALL_DIR}/elastic_ctr/serving/)

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
W
wangguibao 已提交
56
                ${CMAKE_BINARY_DIR}/third_party/install/Paddle/third_party/install/mkldnn/lib/libmkldnn.so.1
W
wangguibao 已提交
57 58 59
                DESTINATION
                ${PADDLE_SERVING_INSTALL_DIR}/elastic_ctr/serving/bin)
endif()