Browse Source

fixed compile issue

pull/302/head
李磊 4 years ago
parent
commit
94b298f088
6 changed files with 150 additions and 28 deletions
  1. +129
    -1
      CMakeLists.txt
  2. +1
    -1
      metadef
  3. +6
    -9
      parser/CMakeLists.txt
  4. +5
    -1
      parser/common/CMakeLists.txt
  5. +6
    -9
      parser/onnx/CMakeLists.txt
  6. +3
    -7
      parser/proto/caffe/CMakeLists.txt

+ 129
- 1
CMakeLists.txt View File

@@ -67,8 +67,136 @@ else()

endif()

set(PARSER_PROTO_LIST
"${METADEF_DIR}/proto/onnx/ge_onnx.proto"
"${METADEF_DIR}/proto/om.proto"
"${METADEF_DIR}/proto/caffe/caffe.proto"
"${METADEF_DIR}/proto/tensorflow/graph_library.proto"
"${METADEF_DIR}/proto/tensorflow/graph.proto"
"${METADEF_DIR}/proto/tensorflow/node_def.proto"
"${METADEF_DIR}/proto/tensorflow/function.proto"
"${METADEF_DIR}/proto/tensorflow/versions.proto"
"${METADEF_DIR}/proto/tensorflow/attr_value.proto"
"${METADEF_DIR}/proto/tensorflow/op_def.proto"
"${METADEF_DIR}/proto/tensorflow/tensor.proto"
"${METADEF_DIR}/proto/tensorflow/tensor_shape.proto"
"${METADEF_DIR}/proto/tensorflow/types.proto"
"${METADEF_DIR}/proto/tensorflow/resource_handle.proto"
)

protobuf_generate(parser_protos PARSER_PROTO_SRCS PARSER_PROTO_HDRS ${PARSER_PROTO_LIST} TARGET)

set(PARSER_GRAPH_LIBRARY_PROTO_SRC
"${CMAKE_BINARY_DIR}/proto/parser_protos/proto/tensorflow/graph_library.pb.cc"
)

set(PARSER_TENSORFLOW_PROTO_SRCS
"${CMAKE_BINARY_DIR}/proto/parser_protos/proto/tensorflow/graph.pb.cc"
"${CMAKE_BINARY_DIR}/proto/parser_protos/proto/tensorflow/node_def.pb.cc"
"${CMAKE_BINARY_DIR}/proto/parser_protos/proto/tensorflow/function.pb.cc"
"${CMAKE_BINARY_DIR}/proto/parser_protos/proto/tensorflow/versions.pb.cc"
"${CMAKE_BINARY_DIR}/proto/parser_protos/proto/tensorflow/attr_value.pb.cc"
"${CMAKE_BINARY_DIR}/proto/parser_protos/proto/tensorflow/op_def.pb.cc"
"${CMAKE_BINARY_DIR}/proto/parser_protos/proto/tensorflow/tensor.pb.cc"
"${CMAKE_BINARY_DIR}/proto/parser_protos/proto/tensorflow/tensor_shape.pb.cc"
"${CMAKE_BINARY_DIR}/proto/parser_protos/proto/tensorflow/types.pb.cc"
"${CMAKE_BINARY_DIR}/proto/parser_protos/proto/tensorflow/resource_handle.pb.cc"
)

set(PARSER_ONNX_PROTO_SRCS
"${CMAKE_BINARY_DIR}/proto/parser_protos/proto/onnx/ge_onnx.pb.cc"
"${CMAKE_BINARY_DIR}/proto/parser_protos/proto/om.pb.cc"
)

set(PARSER_CAFFE_PROTO_SRC
"${CMAKE_BINARY_DIR}/proto/parser_protos/proto/caffe/caffe.pb.cc"
)

add_library(parser_graph_library_proto_obj OBJECT ${PARSER_GRAPH_LIBRARY_PROTO_SRC})
add_dependencies(parser_graph_library_proto_obj parser_protos)
target_include_directories(parser_graph_library_proto_obj PRIVATE
#### blue zone ####
${PROTOBUF_SHARED_PKG_DIR}/include
#### yellow zone ####
${ASCEND_PROTOBUF_SHARED_PKG_DIR}/include
)
target_compile_definitions(parser_graph_library_proto_obj PRIVATE
google=ascend_private
)
target_link_libraries(parser_graph_library_proto_obj PRIVATE ascend_protobuf $<BUILD_INTERFACE:intf_pub>)
target_compile_options(parser_graph_library_proto_obj PRIVATE
$<$<STREQUAL:${TARGET_SYSTEM_NAME},Linux>:-O2 -fPIC>
$<$<OR:$<STREQUAL:${PRODUCT_SIDE},host>,$<STREQUAL:${ENABLE_OPEN_SRC},True>>:-fexceptions>
$<$<OR:$<STREQUAL:${TARGET_SYSTEM_NAME},Linux>,$<STREQUAL:${TARGET_SYSTEM_NAME},Android>>: -Wno-deprecated-declarations -fno-common>
$<$<AND:$<STREQUAL:${TARGET_SYSTEM_NAME},Windows>,$<STREQUAL:${CMAKE_CONFIGURATION_TYPES},Debug>>:/MTd>
$<$<AND:$<STREQUAL:${TARGET_SYSTEM_NAME},Windows>,$<STREQUAL:${CMAKE_CONFIGURATION_TYPES},Release>>:/MT>
)


add_library(parser_tensorflow_protos_obj OBJECT ${PARSER_TENSORFLOW_PROTO_SRCS})
add_dependencies(parser_tensorflow_protos_obj parser_protos)
target_include_directories(parser_tensorflow_protos_obj PRIVATE
#### blue zone ####
${PROTOBUF_SHARED_PKG_DIR}/include
#### yellow zone ####
${ASCEND_PROTOBUF_SHARED_PKG_DIR}/include
)
target_compile_definitions(parser_tensorflow_protos_obj PRIVATE
google=ascend_private
)
target_link_libraries(parser_tensorflow_protos_obj PRIVATE ascend_protobuf $<BUILD_INTERFACE:intf_pub>)
target_compile_options(parser_tensorflow_protos_obj PRIVATE
$<$<STREQUAL:${TARGET_SYSTEM_NAME},Linux>:-O2 -fPIC>
$<$<OR:$<STREQUAL:${PRODUCT_SIDE},host>,$<STREQUAL:${ENABLE_OPEN_SRC},True>>:-fexceptions>
$<$<OR:$<STREQUAL:${TARGET_SYSTEM_NAME},Linux>,$<STREQUAL:${TARGET_SYSTEM_NAME},Android>>: -Wno-deprecated-declarations -fno-common>
$<$<AND:$<STREQUAL:${TARGET_SYSTEM_NAME},Windows>,$<STREQUAL:${CMAKE_CONFIGURATION_TYPES},Debug>>:/MTd>
$<$<AND:$<STREQUAL:${TARGET_SYSTEM_NAME},Windows>,$<STREQUAL:${CMAKE_CONFIGURATION_TYPES},Release>>:/MT>
)


add_library(parser_onnx_protos_obj OBJECT ${PARSER_ONNX_PROTO_SRCS})
add_dependencies(parser_onnx_protos_obj parser_protos)
target_include_directories(parser_onnx_protos_obj PRIVATE
#### blue zone ####
${PROTOBUF_SHARED_PKG_DIR}/include
#### yellow zone ####
${ASCEND_PROTOBUF_SHARED_PKG_DIR}/include
)
target_compile_definitions(parser_onnx_protos_obj PRIVATE
google=ascend_private
)
target_link_libraries(parser_onnx_protos_obj PRIVATE ascend_protobuf $<BUILD_INTERFACE:intf_pub>)
target_compile_options(parser_onnx_protos_obj PRIVATE
$<$<STREQUAL:${TARGET_SYSTEM_NAME},Linux>:-O2 -fPIC>
$<$<OR:$<STREQUAL:${PRODUCT_SIDE},host>,$<STREQUAL:${ENABLE_OPEN_SRC},True>>:-fexceptions>
$<$<OR:$<STREQUAL:${TARGET_SYSTEM_NAME},Linux>,$<STREQUAL:${TARGET_SYSTEM_NAME},Android>>: -Wno-deprecated-declarations -fno-common>
$<$<AND:$<STREQUAL:${TARGET_SYSTEM_NAME},Windows>,$<STREQUAL:${CMAKE_CONFIGURATION_TYPES},Debug>>:/MTd>
$<$<AND:$<STREQUAL:${TARGET_SYSTEM_NAME},Windows>,$<STREQUAL:${CMAKE_CONFIGURATION_TYPES},Release>>:/MT>
)


add_library(parser_caffe_proto_obj OBJECT ${PARSER_CAFFE_PROTO_SRC})
add_dependencies(parser_caffe_proto_obj parser_protos)
target_include_directories(parser_caffe_proto_obj PRIVATE
#### blue zone ####
${PROTOBUF_SHARED_PKG_DIR}/include
#### yellow zone ####
${ASCEND_PROTOBUF_SHARED_PKG_DIR}/include
)
target_compile_definitions(parser_caffe_proto_obj PRIVATE
google=ascend_private
)
target_link_libraries(parser_caffe_proto_obj PRIVATE ascend_protobuf $<BUILD_INTERFACE:intf_pub>)
target_compile_options(parser_caffe_proto_obj PRIVATE
$<$<STREQUAL:${TARGET_SYSTEM_NAME},Linux>:-O2 -fPIC>
$<$<OR:$<STREQUAL:${PRODUCT_SIDE},host>,$<STREQUAL:${ENABLE_OPEN_SRC},True>>:-fexceptions>
$<$<OR:$<STREQUAL:${TARGET_SYSTEM_NAME},Linux>,$<STREQUAL:${TARGET_SYSTEM_NAME},Android>>: -Wno-deprecated-declarations -fno-common>
$<$<AND:$<STREQUAL:${TARGET_SYSTEM_NAME},Windows>,$<STREQUAL:${CMAKE_CONFIGURATION_TYPES},Debug>>:/MTd>
$<$<AND:$<STREQUAL:${TARGET_SYSTEM_NAME},Windows>,$<STREQUAL:${CMAKE_CONFIGURATION_TYPES},Release>>:/MT>
)

add_subdirectory(parser)
add_subdirectory(parser/common)
add_subdirectory(parser/func_to_graph)
add_subdirectory(parser/onnx)
add_subdirectory(parser/proto/caffe)
add_subdirectory(parser/proto/caffe)

+ 1
- 1
metadef

@@ -1 +1 @@
Subproject commit 567381faaff179106abafb264ba696f45c4d2b43
Subproject commit 15a2b9d6ce4375f69655e62e516373934cae36a8

+ 6
- 9
parser/CMakeLists.txt View File

@@ -1,7 +1,3 @@
set(PROTO_LIST
"${METADEF_DIR}/proto/tensorflow/graph_library.proto"
)

set(SRC_LIST
"tensorflow/tensorflow_arg_parser.cc"
"tensorflow/tensorflow_auto_mapping_parser_adapter.cc"
@@ -41,10 +37,11 @@ set(SRC_LIST
"common/op_def/variable_op.cc"
)

protobuf_generate(ge PROTO_SRCS PROTO_HDRS ${PROTO_LIST})

############ libfmk_parser.so ############
add_library(fmk_parser SHARED ${SRC_LIST} ${PROTO_SRCS})
add_library(fmk_parser SHARED
${SRC_LIST}
$<TARGET_OBJECTS:parser_graph_library_proto_obj>
)

target_compile_options(fmk_parser PRIVATE
-Werror
@@ -78,7 +75,7 @@ target_include_directories(fmk_parser PRIVATE
${PARSER_DIR}/../graphengine/inc
${PARSER_DIR}/../graphengine/ge
${CMAKE_BINARY_DIR}
${CMAKE_BINARY_DIR}/proto/ge
${CMAKE_BINARY_DIR}/proto/parser_protos
#### blue zone compile #####
${PARSER_DIR}/../ge
${PARSER_DIR}/../inc
@@ -178,7 +175,7 @@ target_link_libraries(fmk_parser_stub PRIVATE

set_target_properties(fmk_parser_stub PROPERTIES
OUTPUT_NAME fmk_parser
LIBRARY_OUTPUT_DIRECTORY stub
LIBRARY_OUTPUT_DIRECTORY stub
)

############ install ############


+ 5
- 1
parser/common/CMakeLists.txt View File

@@ -32,6 +32,10 @@ set(SRC_LIST
############ libparser_common.so ############
add_library(parser_common SHARED ${SRC_LIST})

add_dependencies(parser_common
parser_protos
)

target_compile_options(parser_common PRIVATE
-Werror
-Wno-deprecated-declarations
@@ -61,7 +65,7 @@ target_include_directories(parser_common PRIVATE
${PARSER_DIR}/../graphengine/inc
${PARSER_DIR}/../graphengine/ge
${CMAKE_BINARY_DIR}
${CMAKE_BINARY_DIR}/proto/ge
${CMAKE_BINARY_DIR}/proto/parser_protos
#### blue zone compile #####
${PARSER_DIR}/../ge
${PARSER_DIR}/../inc


+ 6
- 9
parser/onnx/CMakeLists.txt View File

@@ -1,8 +1,3 @@
set(PROTO_LIST
"${METADEF_DIR}/proto/onnx/ge_onnx.proto"
"${METADEF_DIR}/proto/om.proto"
)

set(SRC_LIST
"onnx_custom_parser_adapter.cc"
"onnx_parser.cc"
@@ -13,10 +8,12 @@ set(SRC_LIST
"subgraph_adapter/subgraph_adapter_factory.cc"
)

protobuf_generate(ge PROTO_SRCS PROTO_HDRS ${PROTO_LIST})

############ libfmk_onnx_parser.so ############
add_library(fmk_onnx_parser SHARED ${SRC_LIST} ${PROTO_HDRS})
add_library(fmk_onnx_parser SHARED ${SRC_LIST})

add_dependencies(fmk_onnx_parser
parser_protos
)

target_compile_options(fmk_onnx_parser PRIVATE
-Werror
@@ -51,7 +48,7 @@ target_include_directories(fmk_onnx_parser PRIVATE
${PARSER_DIR}/../graphengine/inc
${PARSER_DIR}/../graphengine/ge
${CMAKE_BINARY_DIR}
${CMAKE_BINARY_DIR}/proto/ge
${CMAKE_BINARY_DIR}/proto/parser_protos
#### blue zone compile #####
${PARSER_DIR}/../ge
${PARSER_DIR}/../inc


+ 3
- 7
parser/proto/caffe/CMakeLists.txt View File

@@ -1,11 +1,7 @@
set(PROTO_LIST
"${METADEF_DIR}/proto/caffe/caffe.proto"
)

protobuf_generate(ge PROTO_SRCS PROTO_HDRS ${PROTO_LIST})

############ lib_caffe_parser.so ############
add_library(_caffe_parser SHARED ${PROTO_SRCS})
add_library(_caffe_parser SHARED
$<TARGET_OBJECTS:parser_caffe_proto_obj>
)

target_compile_definitions(_caffe_parser PRIVATE
google=ascend_private


Loading…
Cancel
Save