提交 456f9cc8 编写于 作者: Y Yu Yang

Remove Python protobuf function

上级 64b78b16
...@@ -357,26 +357,3 @@ function(pb_cc_library TARGET_NAME) ...@@ -357,26 +357,3 @@ function(pb_cc_library TARGET_NAME)
include_directories(${CMAKE_CURRENT_BINARY_DIR}) include_directories(${CMAKE_CURRENT_BINARY_DIR})
cc_library(${TARGET_NAME} SRCS ${proto_srcs}) cc_library(${TARGET_NAME} SRCS ${proto_srcs})
endfunction() endfunction()
function(pb_py_library TARGET_NAME)
set(oneValueArgs TARGET_DIR)
set(multiValueArgs SRCS)
cmake_parse_arguments(pb_py_library "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
if (NOT pb_py_library_TARGET_DIR)
set(pb_py_library_TARGET_DIR ${CMAKE_CURRENT_BINARY_DIR})
endif()
set(py_srcs)
foreach(FIL ${pb_py_library_SRCS})
get_filename_component(ABS_FIL ${FIL} ABSOLUTE)
get_filename_component(FIL_WE ${FIL} NAME_WE)
set(cur_py_src ${pb_py_library_TARGET_DIR}/${FIL_WE}_pb2.py)
list(APPEND py_srcs "${cur_py_src}")
add_custom_command(OUTPUT ${cur_py_src}
COMMAND ${PROTOBUF_PROTOC_EXECUTABLE}
ARGS "--python_out=${pb_py_library_TARGET_DIR}" "-I" ${CMAKE_CURRENT_SOURCE_DIR} ${ABS_FIL}
DEPENDS ${ABS_FIL} protoc
COMMENT "Running Python protocol buffer compiler on ${FIL}")
endforeach()
add_custom_target(${TARGET_NAME} ALL DEPENDS ${py_srcs})
endfunction()
\ No newline at end of file
file(GLOB proto_filenames . *.proto) file(GLOB proto_filenames . *.proto)
pb_cc_library(paddle_proto SRCS ${proto_filenames}) pb_cc_library(paddle_proto SRCS ${proto_filenames})
pb_py_library(gen_proto_py SRCS ${proto_filenames} TARGET_DIR ${PROJ_ROOT}/python/paddle/proto)
set(PROTO_GEN)
set(PROTO_GEN_PY)
foreach(filename ${proto_filenames})
get_filename_component(base_filename ${filename} NAME_WE)
set(CUR_PROTO_GEN_PY
${PROJ_ROOT}/paddle/python/paddle/proto/${base_filename}_pb2.py)
set(PROTO_GEN_PY
${CUR_PROTO_GEN_PY}
${PROTO_GEN_PY})
add_custom_command(OUTPUT ${CUR_PROTO_GEN_PY}
COMMAND env ${py_env} ${PROTOBUF_PROTOC_EXECUTABLE} --python_out ${PROJ_ROOT}/python/paddle/proto
--proto_path ${PROJ_ROOT}/proto ${PROJ_ROOT}/proto/${filename}
DEPENDS ${filename} ${external_project_dependencies})
endforeach()
add_custom_target(gen_proto_py ALL DEPENDS ${PROTO_GEN_PY})
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册