CMakeLists.txt 3.4 KB
Newer Older
W
wangguibao 已提交
1 2 3 4 5 6
include(proto/CMakeLists.txt)

file(GLOB sdk_cpp_srcs ${CMAKE_SOURCE_DIR}/sdk-cpp/src/*.cpp)
list(APPEND elasticctr_srcs ${elastic_ctr_cpp_srcs})
list(APPEND elasticctr_srcs ${sdk_cpp_srcs})
list(APPEND elasticctr_srcs
W
wangguibao 已提交
7
        ${CMAKE_CURRENT_LIST_DIR}/api/elastic_ctr_api.cpp)
W
wangguibao 已提交
8

W
wangguibao 已提交
9
add_library(elasticctr SHARED ${elasticctr_srcs})
W
wangguibao 已提交
10
target_link_libraries(elasticctr brpc configure protobuf leveldb -lcrypto
W
wangguibao 已提交
11
        -lssl -lz -lrt)
W
wangguibao 已提交
12

W
wangguibao 已提交
13 14
set_target_properties(elasticctr PROPERTIES INTERFACE_LINK_LIBRARIES "")

W
wangguibao 已提交
15
add_executable(elastic_ctr_demo ${CMAKE_CURRENT_LIST_DIR}/demo/demo.cpp)
W
wangguibao 已提交
16
set_target_properties(elastic_ctr_demo PROPERTIES LINK_LIBRARIES "")
W
wangguibao 已提交
17
target_link_libraries(elastic_ctr_demo elasticctr -lpthread -lcrypto -lm -lrt
W
wangguibao 已提交
18
        -lssl -ldl -lz)
W
wangguibao 已提交
19 20

# install
W
wangguibao 已提交
21
install(TARGETS elasticctr elastic_ctr_demo
W
wangguibao 已提交
22
        RUNTIME DESTINATION
W
wangguibao 已提交
23 24
        ${PADDLE_SERVING_INSTALL_DIR}/elastic_ctr/client/bin
        LIBRARY DESTINATION
W
wangguibao 已提交
25 26 27 28 29
        ${PADDLE_SERVING_INSTALL_DIR}/elastic_ctr/client/bin)
install(DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/demo/conf DESTINATION
        ${PADDLE_SERVING_INSTALL_DIR}/elastic_ctr/client/)
install(DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/demo/data/ctr_prediction DESTINATION
        ${PADDLE_SERVING_INSTALL_DIR}/elastic_ctr/client/data)
W
wangguibao 已提交
30 31 32 33

install(TARGETS elasticctr
        LIBRARY DESTINATION
        ${PADDLE_SERVING_INSTALL_DIR}/elastic_ctr/api/lib)
W
wangguibao 已提交
34

W
wangguibao 已提交
35 36 37 38 39 40 41 42 43
install(FILES ${CMAKE_CURRENT_LIST_DIR}/api/elastic_ctr_api.h
        DESTINATION
        ${PADDLE_SERVING_INSTALL_DIR}/elastic_ctr/api/include/elastic-ctr/client/api/)
install(FILES
        ${CMAKE_BINARY_DIR}/elastic-ctr/client/elastic_ctr_prediction.pb.h
        ${CMAKE_BINARY_DIR}/elastic-ctr/client/pds_option.pb.h
        ${CMAKE_BINARY_DIR}/elastic-ctr/client/builtin_format.pb.h
        DESTINATION
        ${PADDLE_SERVING_INSTALL_DIR}/elastic_ctr/api/include/elastic-ctr/client/)
W
wangguibao 已提交
44 45
install(DIRECTORY
        ${CMAKE_SOURCE_DIR}/sdk-cpp/include
W
wangguibao 已提交
46 47
        DESTINATION
        ${PADDLE_SERVING_INSTALL_DIR}/elastic_ctr/api/include/sdk-cpp/)
W
wangguibao 已提交
48 49 50 51 52 53 54 55 56
install(DIRECTORY
        ${CMAKE_SOURCE_DIR}/configure/include
        DESTINATION
        ${PADDLE_SERVING_INSTALL_DIR}/elastic_ctr/api/include/configure)
install(FILES
        ${CMAKE_BINARY_DIR}/configure/sdk_configure.pb.h
        DESTINATION
        ${PADDLE_SERVING_INSTALL_DIR}/elastic_ctr/api/include/configure)

W
wangguibao 已提交
57 58 59 60 61
install(DIRECTORY
        ${CMAKE_BINARY_DIR}/third_party/install/protobuf/include/google
        ${CMAKE_BINARY_DIR}/third_party/install/brpc/include/brpc
        ${CMAKE_BINARY_DIR}/third_party/install/brpc/include/butil
        ${CMAKE_BINARY_DIR}/third_party/install/brpc/include/bthread
W
wangguibao 已提交
62 63
        ${CMAKE_BINARY_DIR}/third_party/install/brpc/include/bvar
        ${CMAKE_BINARY_DIR}/third_party/install/brpc/include/json2pb
W
wangguibao 已提交
64 65 66 67
        ${CMAKE_BINARY_DIR}/third_party/install/gflags/include/gflags
        ${CMAKE_BINARY_DIR}/third_party/install/glog/include/glog
        DESTINATION
        ${PADDLE_SERVING_INSTALL_DIR}/elastic_ctr/api/include)
W
wangguibao 已提交
68 69

# Python client API
W
wangguibao 已提交
70
install(FILES ${CMAKE_CURRENT_LIST_DIR}/api/python/elasticctr/elastic_ctr_api.py
W
wangguibao 已提交
71 72
        DESTINATION
        ${PADDLE_SERVING_INSTALL_DIR}/elastic_ctr/api/lib)
W
wangguibao 已提交
73 74 75 76

install(FILES ${CMAKE_CURRENT_LIST_DIR}/api/python/elasticctr/elastic_ctr_api.py
        DESTINATION
        ${PADDLE_SERVING_INSTALL_DIR}/elastic_ctr/client/bin)
W
wangguibao 已提交
77 78
install(FILES ${CMAKE_CURRENT_LIST_DIR}/demo/elastic_ctr.py
        DESTINATION ${PADDLE_SERVING_INSTALL_DIR}/elastic_ctr/client/bin)