From b5ca3d3711ec781df0c1c82037c9c0f9e50be00a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AE=A1=E6=99=A8?= Date: Thu, 7 Jan 2021 18:14:43 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9B=9E=E9=80=80=20'Pull=20Request=20!894=20:?= =?UTF-8?q?=20Enable=20-Werror=3Dunused-const-variable'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmake/external_libs/protobuf_shared.cmake | 2 +- cmake/external_libs/protobuf_static.cmake | 2 +- ge/CMakeLists.txt | 66 +++-------------------- 3 files changed, 10 insertions(+), 60 deletions(-) diff --git a/cmake/external_libs/protobuf_shared.cmake b/cmake/external_libs/protobuf_shared.cmake index 6a072a8b..6334c8a3 100755 --- a/cmake/external_libs/protobuf_shared.cmake +++ b/cmake/external_libs/protobuf_shared.cmake @@ -53,7 +53,7 @@ set_target_properties(ascend_protobuf PROPERTIES IMPORTED_LOCATION ${PROTOBUF_SHARED_PKG_DIR}/${CMAKE_INSTALL_LIBDIR}/libascend_protobuf.so ) -target_include_directories(ascend_protobuf SYSTEM INTERFACE ${PROTOBUF_SHARED_PKG_DIR}/include) +target_include_directories(ascend_protobuf INTERFACE ${PROTOBUF_SHARED_PKG_DIR}/include) set(INSTALL_BASE_DIR "") set(INSTALL_LIBRARY_DIR lib) diff --git a/cmake/external_libs/protobuf_static.cmake b/cmake/external_libs/protobuf_static.cmake index 4defa4f4..e4bbb9a0 100755 --- a/cmake/external_libs/protobuf_static.cmake +++ b/cmake/external_libs/protobuf_static.cmake @@ -51,7 +51,7 @@ set_target_properties(ascend_protobuf_static_lib PROPERTIES ) add_library(ascend_protobuf_static INTERFACE) -target_include_directories(ascend_protobuf_static SYSTEM INTERFACE ${PROTOBUF_STATIC_PKG_DIR}/include) +target_include_directories(ascend_protobuf_static INTERFACE ${PROTOBUF_STATIC_PKG_DIR}/include) target_link_libraries(ascend_protobuf_static INTERFACE ascend_protobuf_static_lib) if (ENABLE_D OR ENABLE_ACL OR ENABLE_MS_TESTCASES) include_directories(${PROTOBUF_STATIC_PKG_DIR}/include) diff --git a/ge/CMakeLists.txt b/ge/CMakeLists.txt index 32a64858..317ff00a 100755 --- a/ge/CMakeLists.txt +++ b/ge/CMakeLists.txt @@ -32,49 +32,6 @@ protobuf_generate(ge PROTO_SRCS PROTO_HDRS ${PROTO_LIST}) protobuf_generate(ge PROTO_CLIENT_SRCS PROTO_CLIENT_HDRS ${PROTO_CLIENT_LIST}) protobuf_generate(ge PROTO_HEADER_SRCS PROTO_HEADER_HDRS ${PROTO_HEADER_LIST}) -if (NOT ENABLE_D AND NOT ENABLE_ACL AND NOT ENABLE_MS_TESTCASES) -############ libge_proto_common.a ############ -add_library(ge_proto_common STATIC - ${PROTO_SRCS} -) - -target_compile_definitions(ge_proto_common PRIVATE - PROTOBUF_INLINE_NOT_IN_HEADERS=0 - google=ascend_private -) - -target_compile_options(ge_proto_common PRIVATE - -O2 - -fno-common -) - -target_link_libraries(ge_proto_common PRIVATE - $ - ascend_protobuf -) - -############ libge_proto_client.a ############ -add_library(ge_proto_client STATIC - ${PROTO_CLIENT_SRCS} -) - -target_compile_definitions(ge_proto_client PRIVATE - PROTOBUF_INLINE_NOT_IN_HEADERS=0 - google=ascend_private -) - -target_compile_options(ge_proto_client PRIVATE - -O2 - -fno-common -) - -target_link_libraries(ge_proto_client PRIVATE - $ - ascend_protobuf -) -endif () - -################################################################## set(TRAIN_SRC_LIST "common/formats/format_transfers/datatype_transfer.cc" "common/formats/format_transfers/format_transfer_c1hwncoc0_hwcn.cc" @@ -672,8 +629,10 @@ set(INFER_SRC_LIST if (NOT ENABLE_D AND NOT ENABLE_ACL AND NOT ENABLE_MS_TESTCASES) ############ libge_runner.so ############ add_library(ge_runner SHARED - ${TRAIN_SRC_LIST} - $,msprofiler_fwk,msprofiler_fwk_object>> + ${TRAIN_SRC_LIST} + ${PROTO_SRCS} + ${PROTO_CLIENT_SRCS} + $,msprofiler_fwk,msprofiler_fwk_object>> ) add_library(msprofiler_fwk_object OBJECT IMPORTED GLOBAL) @@ -682,7 +641,7 @@ if (msprofiler_fwk_ext_LIBRARY_DIR) file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/msprofiler_fwk_object) execute_process( COMMAND ar x ${msprofiler_fwk_ext_LIBRARY_DIR} - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/msprofiler_fwk_object + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/msprofiler_fwk_object ) file(GLOB MSPROFILER_FWK_OBJECT_LIST ${CMAKE_CURRENT_BINARY_DIR}/msprofiler_fwk_object/*.o) set_property(TARGET msprofiler_fwk_object PROPERTY IMPORTED_OBJECTS ${MSPROFILER_FWK_OBJECT_LIST}) @@ -700,11 +659,9 @@ target_compile_definitions(ge_runner PRIVATE target_compile_options(ge_runner PRIVATE -O2 -fno-common - $<$:-Werror=unused-variable> - $<$:-Werror=unused-const-variable> ) -target_include_directories(ge_runner SYSTEM PRIVATE +target_include_directories(ge_runner PRIVATE ${GE_CODE_DIR}/ge ${GE_CODE_DIR}/ge/analyzer ${GE_CODE_DIR}/inc @@ -734,8 +691,6 @@ target_link_libraries(ge_runner PRIVATE $ adump_server static_mmpa - ge_proto_common - ge_proto_client -Wl,--no-as-needed graph ge_common @@ -753,9 +708,7 @@ target_link_libraries(ge_runner PRIVATE ) ############ libge_compiler.so ############ -add_library(ge_compiler SHARED - ${INFER_SRC_LIST} -) +add_library(ge_compiler SHARED ${INFER_SRC_LIST} ${PROTO_SRCS}) target_compile_definitions(ge_compiler PRIVATE PROTOBUF_INLINE_NOT_IN_HEADERS=0 @@ -769,11 +722,9 @@ target_compile_definitions(ge_compiler PRIVATE target_compile_options(ge_compiler PRIVATE -O2 -fno-common - $<$:-Werror=unused-variable> - $<$:-Werror=unused-const-variable> ) -target_include_directories(ge_compiler SYSTEM PRIVATE +target_include_directories(ge_compiler PRIVATE ${GE_CODE_DIR}/ge ${GE_CODE_DIR}/ge/analyzer ${GE_CODE_DIR}/inc @@ -802,7 +753,6 @@ target_include_directories(ge_compiler SYSTEM PRIVATE target_link_libraries(ge_compiler PRIVATE $ static_mmpa - ge_proto_common -Wl,--no-as-needed graph ge_common