CMakeLists.txt 2.3 KB
Newer Older
W
wangguibao 已提交
1
LIST(APPEND protofiles
W
wangguibao 已提交
2 3
        ${CMAKE_CURRENT_LIST_DIR}/proto/server_configure.proto
        ${CMAKE_CURRENT_LIST_DIR}/proto/sdk_configure.proto
4
        ${CMAKE_CURRENT_LIST_DIR}/proto/inferencer_configure.proto
G
guru4elephant 已提交
5
	${CMAKE_CURRENT_LIST_DIR}/proto/general_model_config.proto
W
wangguibao 已提交
6 7 8
)

PROTOBUF_GENERATE_CPP(configure_proto_srcs configure_proto_hdrs ${protofiles})
9
list(APPEND configure_srcs ${configure_proto_srcs})
W
wangguibao 已提交
10

11
list(APPEND configure_srcs ${CMAKE_CURRENT_LIST_DIR}/src/configure_parser.cpp)
W
wangguibao 已提交
12

13
add_library(configure ${configure_srcs})
W
wangguibao 已提交
14
add_dependencies(configure brpc)
W
wangguibao 已提交
15 16 17

add_executable(test_configure
        ${CMAKE_CURRENT_LIST_DIR}/tests/test_configure.cpp)
18
target_link_libraries(test_configure configure protobuf)
19 20 21 22

install(TARGETS configure 
        ARCHIVE DESTINATION ${PADDLE_SERVING_INSTALL_DIR}/lib
        )
G
guru4elephant 已提交
23

W
wangguibao 已提交
24 25 26 27
install(FILES ${CMAKE_CURRENT_LIST_DIR}/include/configure_parser.h
        DESTINATION ${PADDLE_SERVING_INSTALL_DIR}/include/configure/include)

FILE(GLOB inc ${CMAKE_CURRENT_BINARY_DIR}/*.pb.h)
G
guru4elephant 已提交
28

W
wangguibao 已提交
29 30
install(FILES ${inc}
        DESTINATION ${PADDLE_SERVING_INSTALL_DIR}/include/configure)
G
guru4elephant 已提交
31 32 33 34 35 36 37 38 39

py_proto_compile(sdk_configure_py_proto SRCS proto/sdk_configure.proto)
add_custom_target(sdk_configure_py_proto_init ALL COMMAND ${CMAKE_COMMAND} -E touch __init__.py)
add_dependencies(sdk_configure_py_proto sdk_configure_py_proto_init)
add_custom_command(TARGET sdk_configure_py_proto POST_BUILD
		COMMAND ${CMAKE_COMMAND} -E make_directory ${PADDLE_SERVING_BINARY_DIR}/python/paddle_serving/proto
		COMMAND cp *.py ${PADDLE_SERVING_BINARY_DIR}/python/paddle_serving/proto
		COMMENT "Copy generated python proto into directory paddle_serving/proto."
		WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
G
guru4elephant 已提交
40 41 42 43 44 45 46 47 48 49 50

if (NOT CLIENT_ONLY)
py_proto_compile(server_config_py_proto SRCS proto/server_configure.proto)
add_custom_target(server_config_py_proto_init ALL COMMAND ${CMAKE_COMMAND} -E touch __init__.py)
add_dependencies(server_config_py_proto server_config_py_proto_init)
add_custom_command(TARGET server_config_py_proto POST_BUILD
		COMMAND ${CMAKE_COMMAND} -E make_directory ${PADDLE_SERVING_BINARY_DIR}/python/paddle_serving/proto
		COMMAND cp *.py ${PADDLE_SERVING_BINARY_DIR}/python/paddle_serving/proto
		COMMENT "Copy generated python proto into directory paddle_serving/proto."
		WORKING_DIRECTORY ${CMAKE_CURRENT_BINRARY_DIR})
endif()