Browse Source

!894 Enable -Werror=unused-const-variable

From: @zhangxiaokun9
Reviewed-by: @xchu42,@wqtshg
Signed-off-by: @wqtshg
tags/v1.2.0
mindspore-ci-bot Gitee 3 years ago
parent
commit
2b183e25d5
3 changed files with 60 additions and 10 deletions
  1. +1
    -1
      cmake/external_libs/protobuf_shared.cmake
  2. +1
    -1
      cmake/external_libs/protobuf_static.cmake
  3. +58
    -8
      ge/CMakeLists.txt

+ 1
- 1
cmake/external_libs/protobuf_shared.cmake View File

@@ -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 INTERFACE ${PROTOBUF_SHARED_PKG_DIR}/include)
target_include_directories(ascend_protobuf SYSTEM INTERFACE ${PROTOBUF_SHARED_PKG_DIR}/include)

set(INSTALL_BASE_DIR "")
set(INSTALL_LIBRARY_DIR lib)


+ 1
- 1
cmake/external_libs/protobuf_static.cmake View File

@@ -51,7 +51,7 @@ set_target_properties(ascend_protobuf_static_lib PROPERTIES
)

add_library(ascend_protobuf_static INTERFACE)
target_include_directories(ascend_protobuf_static INTERFACE ${PROTOBUF_STATIC_PKG_DIR}/include)
target_include_directories(ascend_protobuf_static SYSTEM 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)


+ 58
- 8
ge/CMakeLists.txt View File

@@ -32,6 +32,49 @@ 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
$<BUILD_INTERFACE:intf_pub>
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
$<BUILD_INTERFACE:intf_pub>
ascend_protobuf
)
endif ()

##################################################################
set(TRAIN_SRC_LIST
"common/formats/format_transfers/datatype_transfer.cc"
"common/formats/format_transfers/format_transfer_c1hwncoc0_hwcn.cc"
@@ -629,10 +672,8 @@ 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}
${PROTO_SRCS}
${PROTO_CLIENT_SRCS}
$<TARGET_OBJECTS:$<IF:$<TARGET_EXISTS:msprofiler_fwk>,msprofiler_fwk,msprofiler_fwk_object>>
${TRAIN_SRC_LIST}
$<TARGET_OBJECTS:$<IF:$<TARGET_EXISTS:msprofiler_fwk>,msprofiler_fwk,msprofiler_fwk_object>>
)

add_library(msprofiler_fwk_object OBJECT IMPORTED GLOBAL)
@@ -641,7 +682,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})
@@ -659,9 +700,11 @@ target_compile_definitions(ge_runner PRIVATE
target_compile_options(ge_runner PRIVATE
-O2
-fno-common
$<$<STREQUAL:${CMAKE_HOST_SYSTEM_PROCESSOR},aarch64>:-Werror=unused-variable>
$<$<STREQUAL:${CMAKE_HOST_SYSTEM_PROCESSOR},aarch64>:-Werror=unused-const-variable>
)

target_include_directories(ge_runner PRIVATE
target_include_directories(ge_runner SYSTEM PRIVATE
${GE_CODE_DIR}/ge
${GE_CODE_DIR}/ge/analyzer
${GE_CODE_DIR}/inc
@@ -691,6 +734,8 @@ target_link_libraries(ge_runner PRIVATE
$<BUILD_INTERFACE:intf_pub>
adump_server
static_mmpa
ge_proto_common
ge_proto_client
-Wl,--no-as-needed
graph
ge_common
@@ -708,7 +753,9 @@ target_link_libraries(ge_runner PRIVATE
)

############ libge_compiler.so ############
add_library(ge_compiler SHARED ${INFER_SRC_LIST} ${PROTO_SRCS})
add_library(ge_compiler SHARED
${INFER_SRC_LIST}
)

target_compile_definitions(ge_compiler PRIVATE
PROTOBUF_INLINE_NOT_IN_HEADERS=0
@@ -722,9 +769,11 @@ target_compile_definitions(ge_compiler PRIVATE
target_compile_options(ge_compiler PRIVATE
-O2
-fno-common
$<$<STREQUAL:${CMAKE_HOST_SYSTEM_PROCESSOR},aarch64>:-Werror=unused-variable>
$<$<STREQUAL:${CMAKE_HOST_SYSTEM_PROCESSOR},aarch64>:-Werror=unused-const-variable>
)

target_include_directories(ge_compiler PRIVATE
target_include_directories(ge_compiler SYSTEM PRIVATE
${GE_CODE_DIR}/ge
${GE_CODE_DIR}/ge/analyzer
${GE_CODE_DIR}/inc
@@ -753,6 +802,7 @@ target_include_directories(ge_compiler PRIVATE
target_link_libraries(ge_compiler PRIVATE
$<BUILD_INTERFACE:intf_pub>
static_mmpa
ge_proto_common
-Wl,--no-as-needed
graph
ge_common


Loading…
Cancel
Save