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

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

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

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

17 18 19
install(TARGETS configure 
        ARCHIVE DESTINATION ${PADDLE_SERVING_INSTALL_DIR}/lib
        )
G
guru4elephant 已提交
20

W
wangguibao 已提交
21 22 23 24
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 已提交
25

W
wangguibao 已提交
26 27
install(FILES ${inc}
        DESTINATION ${PADDLE_SERVING_INSTALL_DIR}/include/configure)
D
dongdaxiang 已提交
28
endif()
G
guru4elephant 已提交
29

Z
zhangjun 已提交
30 31
if (WITH_PYTHON)

32 33 34 35
py_proto_compile(general_model_config_py_proto SRCS proto/general_model_config.proto)
add_custom_target(general_model_config_py_proto_init ALL COMMAND ${CMAKE_COMMAND} -E touch __init__.py)
add_dependencies(general_model_config_py_proto general_model_config_py_proto_init)

B
barrierye 已提交
36 37 38 39
py_grpc_proto_compile(multi_lang_general_model_service_py_proto SRCS proto/multi_lang_general_model_service.proto)
add_custom_target(multi_lang_general_model_service_py_proto_init ALL COMMAND ${CMAKE_COMMAND} -E touch __init__.py)
add_dependencies(multi_lang_general_model_service_py_proto multi_lang_general_model_service_py_proto_init)

40
if (CLIENT)
G
guru4elephant 已提交
41 42 43 44
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
G
guru4elephant 已提交
45
		COMMAND ${CMAKE_COMMAND} -E make_directory ${PADDLE_SERVING_BINARY_DIR}/python/paddle_serving_client/proto
W
wangjiawei04 已提交
46
		COMMAND cp -f *.py ${PADDLE_SERVING_BINARY_DIR}/python/paddle_serving_client/proto
G
guru4elephant 已提交
47
		COMMENT "Copy generated python proto into directory paddle_serving_client/proto."
G
guru4elephant 已提交
48
		WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
49 50 51

add_custom_command(TARGET general_model_config_py_proto POST_BUILD
                COMMAND ${CMAKE_COMMAND} -E make_directory ${PADDLE_SERVING_BINARY_DIR}/python/paddle_serving_client/proto
W
wangjiawei04 已提交
52
                COMMAND cp -f *.py ${PADDLE_SERVING_BINARY_DIR}/python/paddle_serving_client/proto
53 54 55
                COMMENT "Copy generated general_model_config proto file into directory paddle_serving_client/proto."
                WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})

B
barrierye 已提交
56 57
add_custom_command(TARGET multi_lang_general_model_service_py_proto POST_BUILD
                COMMAND ${CMAKE_COMMAND} -E make_directory ${PADDLE_SERVING_BINARY_DIR}/python/paddle_serving_client/proto
W
wangjiawei04 已提交
58
                COMMAND cp -f *.py ${PADDLE_SERVING_BINARY_DIR}/python/paddle_serving_client/proto
B
barrierye 已提交
59 60
                COMMENT "Copy generated multi_lang_general_model_service proto file into directory paddle_serving_client/proto."
                WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
G
guru4elephant 已提交
61
endif()
G
guru4elephant 已提交
62

D
dongdaxiang 已提交
63 64 65
if (APP)
add_custom_command(TARGET general_model_config_py_proto POST_BUILD
                COMMAND ${CMAKE_COMMAND} -E make_directory ${PADDLE_SERVING_BINARY_DIR}/python/paddle_serving_app/proto
W
wangjiawei04 已提交
66
                COMMAND cp -f *.py ${PADDLE_SERVING_BINARY_DIR}/python/paddle_serving_app/proto
D
dongdaxiang 已提交
67 68 69 70
                COMMENT "Copy generated general_model_config proto file into directory paddle_serving_app/proto."
                WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
endif()

71
if (SERVER)
G
guru4elephant 已提交
72 73 74
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)
Z
zhangjun 已提交
75
if (NOT WITH_GPU AND NOT WITH_LITE)
G
guru4elephant 已提交
76
add_custom_command(TARGET server_config_py_proto POST_BUILD
G
guru4elephant 已提交
77
		COMMAND ${CMAKE_COMMAND} -E make_directory ${PADDLE_SERVING_BINARY_DIR}/python/paddle_serving_server/proto
W
wangjiawei04 已提交
78
		COMMAND cp -f *.py ${PADDLE_SERVING_BINARY_DIR}/python/paddle_serving_server/proto
G
guru4elephant 已提交
79
		COMMENT "Copy generated python proto into directory paddle_serving_server/proto."
G
guru4elephant 已提交
80
		WORKING_DIRECTORY ${CMAKE_CURRENT_BINRARY_DIR})
81 82 83

add_custom_command(TARGET general_model_config_py_proto POST_BUILD
		COMMAND ${CMAKE_COMMAND} -E make_directory ${PADDLE_SERVING_BINARY_DIR}/python/paddle_serving_server/proto
W
wangjiawei04 已提交
84
		COMMAND cp -f *.py ${PADDLE_SERVING_BINARY_DIR}/python/paddle_serving_server/proto
85 86
		COMMENT "Copy generated general_model_config proto file into directory paddle_serving_server/proto."
		WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
B
barrierye 已提交
87

B
barrierye 已提交
88 89
add_custom_command(TARGET multi_lang_general_model_service_py_proto POST_BUILD
                COMMAND ${CMAKE_COMMAND} -E make_directory ${PADDLE_SERVING_BINARY_DIR}/python/paddle_serving_server/proto
W
wangjiawei04 已提交
90
                COMMAND cp -f *.py ${PADDLE_SERVING_BINARY_DIR}/python/paddle_serving_server/proto
B
barrierye 已提交
91 92
                COMMENT "Copy generated multi_lang_general_model_service proto file into directory paddle_serving_server/proto."
                WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
M
MRXLT 已提交
93 94 95 96
else()
add_custom_command(TARGET server_config_py_proto POST_BUILD
		COMMAND ${CMAKE_COMMAND} -E make_directory
        ${PADDLE_SERVING_BINARY_DIR}/python/paddle_serving_server_gpu/proto
W
wangjiawei04 已提交
97
		COMMAND cp -f *.py
M
MRXLT 已提交
98 99 100 101
        ${PADDLE_SERVING_BINARY_DIR}/python/paddle_serving_server_gpu/proto
		COMMENT "Copy generated python proto into directory
        paddle_serving_server_gpu/proto."
		WORKING_DIRECTORY ${CMAKE_CURRENT_BINRARY_DIR})
102

M
MRXLT 已提交
103 104 105
add_custom_command(TARGET general_model_config_py_proto POST_BUILD
		COMMAND ${CMAKE_COMMAND} -E make_directory
        ${PADDLE_SERVING_BINARY_DIR}/python/paddle_serving_server_gpu/proto
W
wangjiawei04 已提交
106
		COMMAND cp -f *.py
M
MRXLT 已提交
107 108 109 110
        ${PADDLE_SERVING_BINARY_DIR}/python/paddle_serving_server_gpu/proto
		COMMENT "Copy generated general_model_config proto file into directory
        paddle_serving_server_gpu/proto."
		WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
B
barrierye 已提交
111

B
barrierye 已提交
112 113
add_custom_command(TARGET multi_lang_general_model_service_py_proto POST_BUILD
                COMMAND ${CMAKE_COMMAND} -E make_directory ${PADDLE_SERVING_BINARY_DIR}/python/paddle_serving_server_gpu/proto
W
wangjiawei04 已提交
114
                COMMAND cp -f *.py ${PADDLE_SERVING_BINARY_DIR}/python/paddle_serving_server_gpu/proto
B
barrierye 已提交
115 116
                COMMENT "Copy generated multi_lang_general_model_service proto file into directory paddle_serving_server_gpu/proto."
                WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
M
MRXLT 已提交
117
endif()
G
guru4elephant 已提交
118
endif()
Z
zhangjun 已提交
119 120

endif()