From 39b02af4e4861bb051bd8c0a0742300218d371c1 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 16 Apr 2021 11:32:42 +0800 Subject: [PATCH 1/3] Change dump.proto to .a --- ge/executor/CMakeLists.txt | 37 +++++++++++++++++++++++++++++++++---- 1 file changed, 33 insertions(+), 4 deletions(-) diff --git a/ge/executor/CMakeLists.txt b/ge/executor/CMakeLists.txt index 3094429f..7a2eacb8 100644 --- a/ge/executor/CMakeLists.txt +++ b/ge/executor/CMakeLists.txt @@ -12,8 +12,33 @@ set(DUMP_PROTO_LIST protobuf_generate(ge PROTO_SRCS PROTO_HDRS ${PROTO_LIST}) protobuf_generate(ge_static PROTO_STATIC_SRCS PROTO_STATIC_HDRS ${PROTO_LIST}) -protobuf_generate(ge DUMP_PROTO_SRCS DUMP_PROTO_HDRS ${DUMP_PROTO_LIST}) -protobuf_generate(ge_static DUMP_PROTO_STATIC_SRCS DUMP_PROTO_STATIC_HDRS ${DUMP_PROTO_LIST}) +protobuf_generate(ge_dump DUMP_PROTO_SRCS DUMP_PROTO_HDRS ${DUMP_PROTO_LIST}) + +############ libge_proto_dump.a ############ +add_library(ge_proto_dump STATIC + ${DUMP_PROTO_SRCS} +) + +target_compile_definitions(ge_proto_dump PRIVATE + PROTOBUF_INLINE_NOT_IN_HEADERS=0 + google=ascend_private +) + +target_compile_options(ge_proto_dump PRIVATE + -O2 + -fno-common + -fvisibility=hidden +) + +target_link_libraries(ge_proto_dump PRIVATE + $ + ascend_protobuf +) + +target_link_options(ge_proto_dump PRIVATE + -Wl,-Bsymbolic +) +################################################################## set(SRC_LIST "ge_executor.cc" @@ -169,7 +194,7 @@ set(SRC_LIST ) ######## libge_executor.a ######## -add_library(ge_executor STATIC ${SRC_LIST} ${PROTO_STATIC_HDRS} ${DUMP_PROTO_STATIC_SRCS}) +add_library(ge_executor STATIC ${SRC_LIST} ${PROTO_STATIC_HDRS}) target_compile_options(ge_executor PRIVATE $<$,$>:-fvisibility=hidden -O2 -Werror -Wno-deprecated-declarations -fno-common> @@ -199,6 +224,7 @@ target_include_directories(ge_executor SYSTEM PRIVATE ${METADEF_DIR}/inc/external/graph ${METADEF_DIR}/inc/graph ${CMAKE_BINARY_DIR} + ${CMAKE_BINARY_DIR}/proto/ge_dump ${CMAKE_BINARY_DIR}/proto/ge_static #### yellow zone #### ${GE_CODE_DIR}/../inc @@ -212,12 +238,13 @@ target_link_libraries(ge_executor PRIVATE json ascend_protobuf_static c_sec + ge_proto_dump $<$>:-lrt> -ldl ) ######## libge_executor.so ######## -add_library(ge_executor_shared SHARED ${SRC_LIST} ${PROTO_HDRS} ${DUMP_PROTO_SRCS}) +add_library(ge_executor_shared SHARED ${SRC_LIST} ${PROTO_HDRS}) target_compile_options(ge_executor_shared PRIVATE -fno-common @@ -245,6 +272,7 @@ target_include_directories(ge_executor_shared PRIVATE ${METADEF_DIR}/inc/external/graph ${METADEF_DIR}/inc/graph ${CMAKE_BINARY_DIR} + ${CMAKE_BINARY_DIR}/proto/ge_dump ${CMAKE_BINARY_DIR}/proto/ge #### yellow zone #### ${GE_CODE_DIR}/../inc @@ -261,6 +289,7 @@ target_link_libraries(ge_executor_shared PRIVATE $ msprofiler static_mmpa + ge_proto_dump -Wl,--no-as-needed ge_common runtime From 823c4c1e69884935a6b4a85cac16f318c86736bd Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 16 Apr 2021 14:02:45 +0800 Subject: [PATCH 2/3] Fix windows compile. --- ge/executor/CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ge/executor/CMakeLists.txt b/ge/executor/CMakeLists.txt index 7a2eacb8..6372c548 100644 --- a/ge/executor/CMakeLists.txt +++ b/ge/executor/CMakeLists.txt @@ -22,12 +22,16 @@ add_library(ge_proto_dump STATIC target_compile_definitions(ge_proto_dump PRIVATE PROTOBUF_INLINE_NOT_IN_HEADERS=0 google=ascend_private + $,OS_TYPE=WIN,OS_TYPE=0> + $<$:SECUREC_USING_STD_SECURE_LIB=0 NOMINMAX> ) target_compile_options(ge_proto_dump PRIVATE -O2 -fno-common -fvisibility=hidden + $<$,$>:/MTd> + $<$,$>:/MT> ) target_link_libraries(ge_proto_dump PRIVATE From 277830617bc0fd4c50ffc444f54851a26085045b Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 16 Apr 2021 14:05:21 +0800 Subject: [PATCH 3/3] Fix windows compile. --- ge/executor/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/ge/executor/CMakeLists.txt b/ge/executor/CMakeLists.txt index 6372c548..054080ec 100644 --- a/ge/executor/CMakeLists.txt +++ b/ge/executor/CMakeLists.txt @@ -287,6 +287,7 @@ target_include_directories(ge_executor_shared PRIVATE target_link_options(ge_executor_shared PRIVATE -Wl,-Bsymbolic + -Wl,--exclude-libs,ALL ) target_link_libraries(ge_executor_shared PRIVATE