!23516 [MS][LITE]Fix converter parser build

Merge pull request !23516 from gongdaguo/fix_parser_build
This commit is contained in:
i-robot 2021-09-16 01:46:43 +00:00 committed by Gitee
commit 0f85e02b91
6 changed files with 28 additions and 9 deletions

View File

@ -0,0 +1,15 @@
function(merge_parser CL_SRC_DIR OUT_FILE_NAME)
message(STATUS "Merge parser from ${CL_SRC_DIR} to ${OUT_FILE_NAME}")
if(NOT EXISTS ${CL_SRC_DIR})
return()
endif()
file(GLOB_RECURSE CL_LIST ${CL_SRC_DIR}/*.cc)
list(SORT CL_LIST)
set(out_file ${OUT_FILE_NAME})
file(REMOVE ${out_file})
file(WRITE ${out_file} "")
foreach(file_path ${CL_LIST})
file(STRINGS ${file_path} READ_CC_CONTEXT NEWLINE_CONSUME NO_HEX_CONVERSION)
file(APPEND ${out_file} ${READ_CC_CONTEXT})
endforeach()
endfunction()

View File

@ -71,9 +71,6 @@ if(MSLITE_ENABLE_CONVERTER)
${LITE_DIR}/tools/benchmark/benchmark_unified_api.cc
${LITE_DIR}/tools/benchmark/benchmark.cc
)
if(NOT MSLITE_ENABLE_CONVERTER)
list(APPEND TEST_LITE_SRC ${LITE_DIR}/tools/common/flag_parser.cc)
endif()
endif()
add_definitions(-DPRIMITIVE_WRITEABLE)
add_definitions(-DUSE_GLOG)

View File

@ -1,4 +1,6 @@
file(GLOB_RECURSE CAFFE_SRC_LIST ${CMAKE_CURRENT_SOURCE_DIR}/*.cc)
include(${TOP_DIR}/mindspore/lite/cmake/merge.cmake)
merge_parser(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_BINARY_DIR}/tools/converter/parser/caffe/caffe_op_parser.cc)
file(GLOB_RECURSE CAFFE_SRC_LIST ${CMAKE_BINARY_DIR}/tools/converter/parser/caffe/caffe_op_parser.cc)
set_property(SOURCE ${CAFFE_SRC_LIST} PROPERTY COMPILE_DEFINITIONS SUBMODULE_ID=mindspore::SubModuleId::SM_LITE)

View File

@ -1,4 +1,6 @@
file(GLOB_RECURSE ONNX_SRC_LIST ${CMAKE_CURRENT_SOURCE_DIR}/*.cc)
include(${TOP_DIR}/mindspore/lite/cmake/merge.cmake)
merge_parser(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_BINARY_DIR}/tools/converter/parser/onnx/onnx_op_parser.cc)
file(GLOB_RECURSE ONNX_SRC_LIST ${CMAKE_BINARY_DIR}/tools/converter/parser/onnx/onnx_op_parser.cc)
set_property(SOURCE ${ONNX_SRC_LIST} PROPERTY COMPILE_DEFINITIONS SUBMODULE_ID=mindspore::SubModuleId::SM_LITE)
add_library(onnx_parser_mid OBJECT
${ONNX_SRC_LIST}

View File

@ -1,4 +1,6 @@
file(GLOB_RECURSE TF_SRC_LIST ${CMAKE_CURRENT_SOURCE_DIR}/*.cc)
include(${TOP_DIR}/mindspore/lite/cmake/merge.cmake)
merge_parser(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_BINARY_DIR}/tools/converter/parser/tf/tf_op_parser.cc)
file(GLOB_RECURSE TF_SRC_LIST ${CMAKE_BINARY_DIR}/tools/converter/parser/tf/tf_op_parser.cc)
set_property(SOURCE ${TF_SRC_LIST} PROPERTY COMPILE_DEFINITIONS SUBMODULE_ID=mindspore::SubModuleId::SM_LITE)

View File

@ -1,6 +1,7 @@
file(GLOB_RECURSE TFLITE_SRC_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
*.cc
)
include(${TOP_DIR}/mindspore/lite/cmake/merge.cmake)
merge_parser(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_BINARY_DIR}/tools/converter/parser/tflite/tflite_op_parser.cc)
file(GLOB_RECURSE TFLITE_SRC_LIST ${CMAKE_BINARY_DIR}/tools/converter/parser/tflite/tflite_op_parser.cc)
set_property(SOURCE ${TFLITE_SRC_LIST} PROPERTY COMPILE_DEFINITIONS SUBMODULE_ID=mindspore::SubModuleId::SM_LITE)
add_library(tflite_parser_mid OBJECT
${TFLITE_SRC_LIST}